Build Instructions
From OpenSimulator
(→Ubuntu 10.04 and later) |
(→MS Windows) |
||
Line 27: | Line 27: | ||
# Build (or Debug) -> Build Solution. | # Build (or Debug) -> Build Solution. | ||
− | + | ===Compiling at the Command Prompt === | |
# Run "runprebuild.bat". | # Run "runprebuild.bat". | ||
# Run the resulting "compile.bat" file or run "nant". This will build the executable using MSBuild(the former) or nant(the latter). | # Run the resulting "compile.bat" file or run "nant". This will build the executable using MSBuild(the former) or nant(the latter). |
Revision as of 10:58, 25 July 2012
This page covers building OpenSimulator from source code on multiple platforms. Please help us keep this page up to date as the project progresses. If you just want to run OpenSimulator, Download and run the binary build instead. In the most cases, you should be fine with binaries.
Contents |
Obtaining the OpenSimulator Source Code
Check out the Download page for instructions on obtaining an OpenSimulator source release. If you want the current development code (i.e. the Git master branch) see Developer_Documentation#Source_Code_Repository_Access.
Building
Although this page is long, building is generally quite simple. See the BUILDING.txt file in the distribution itself for simplified instructions.
MS Windows
OpenSimulator requires either the .Net Framework version 3.5, or Mono 2.4.3 or newer.
Supported Compilers
- Visual Studio 2010
- Visual Studio 2008
- Any editions should work fine, including free Microsoft Visual C# Express Edition. Note that OpenSimulator is written in C#, not C++.
- Note that Visual Studio 2005 or earlier are no longer supported(opensim-dev proposal, opensim-dev approved).
Compiling in an IDE
- Run "runprebuild.bat"(if 2008) or "runprebuild2010.bat"(if 2010).
- Open the resulting "OpenSim.sln" in any Visual Studio IDE.
- Build (or Debug) -> Build Solution.
Compiling at the Command Prompt
- Run "runprebuild.bat".
- Run the resulting "compile.bat" file or run "nant". This will build the executable using MSBuild(the former) or nant(the latter).
Additional Notes
- You can run OpenSimulator on 64-bit Windows(Vista, Windows 7 ...) today, but if you want to debug it in Visual Studio, you'll need to add OpenSim.32BitLaunch to the solution and set it as startup project. See OpenSimulator in Visual Studio on Win64@Tedds blog for details.
- For those that use a Cygwin shell, you may need to fix DLLs permissions issue by typing "chmod 755 *.dll *.exe" in the bin directory.
Mac OS X
Mac OS X 10.5 and later, Intel
Only you have to do is to get :
- Mono SDK from Mono Download Page
- MonoDevelop package from MonoDevelop Download Page
and then install them - now no need to install XCode nor MacPort (you can still install mono dev libraries and nant with MacPort though).
When you run nano to build OpenSimulator, it may show an error like "Unable to locate 'mono' module using pkg-config. Download the Mono development packages". I suspect XCode or MacPort causes something wrong (since it worked fine after I removed both), but I'm not sure. Anyway, insert a line into /usr/bin/nant script file to manage this problem :
#!/bin/sh export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Libraries/pkgconfig # add this! exec /Library/Frameworks/Mono.framework/Versions/2.10.2/bin/mono \ /Library/Frameworks/Mono.framework/Versions/2.10.2/share/NAnt/bin/NAnt.exe "$@"
You can even compile and debug OpenSimulator with MonoDevelop IDE after running "runprebuild.sh". Open the solution file(*.sln) with MonoDevelop IDE then select Build -> Build All from the menu.
Mac OS X 10.4/10.5 on PowerPC
OpenSimulator can run on PowerPC Macs (such as G4, G5). These instructions were tested on 10.5.8. Note that two libraries must also be built from source. Caveat: the OpenSimulator app was only briefly tested in self-contained mode. There may well be issues with this build. Feel free to note any issues you find below (or in a new wiki page? discussion?).
Unfortunately, the OpenSimulator version used here must be compiled on one version of Mono (2.6.7) and run on another (2.8.2). This means either upgrading Mono after the build, or having both versions installed and accessing the older version when you want to build. These instructions let you have both versions installed.
- Install Xcode 3.1.4 Developer Tools from from http://developer.apple.com/. You must have a free Apple developer account to access the downloads. 3.1.4 was the last PowerPC Xcode.
- (10.4 only) Install X11 from the Optional Install (or see if it's a Customize option when you install Xcode). 10.5 gets X11 by default (from OS X or dev tools?).
- Install Mono 2.6.7 PowerPC Framework from here: http://www.go-mono.com/mono-downloads/download.html (binary OS X Framework, no need to build from source)
- Then install Mono 2.8.2 PowerPC framework. For these instructions to work, you must first install 2.6.7, THEN 2.8.2. (The old framework is not deleted, but "Current" symlinks are updated).
- Download OpenSimulator 0.7.0.2 source tarball: http://dist.opensimulator.org/opensim-0.7.0.2-source.tar.gz Expand to a suitable folder for development and running.
- Feel free to try a newer version of OpenSimulator (the repository is on git now).
- If you used a newer OpenSimulator version, check BUILDING.txt for any changes to build instructions (we fall under "Linux")
- Edit or create .profile or .bash_profile in your OS X home folder, with the following lines:
# remember real PATH export OSIM_HACK_ORIG_PATH=$PATH # normal path for running OpenSimulator export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/bin:/usr/local/mysql/bin # Just for nant: export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/2.6.7/lib/pkgconfig alias oldpath="export PATH=$OSIM_HACK_ORIG_PATH:/Library/Frameworks/Mono.framework/Versions/2.6.7/bin"
- Open a new Terminal window, and cd to your uncompressed OpenSimulator source folder (shortcut: type "cd " then drag the folder to the Terminal window). The enter these commands:
oldpath ./runprebuild.sh nant
- nant should take around 10 minutes to compile your OpenSimulator. If you get through that without errors, you're halfway there! (I did get 234 warnings).
- *Important* Before we forget, open a new Terminal window (necessary to avoid the effects of "oldpath").
- Now we need PowerPC versions of two libraries. Build each one and replace the compiled .dylib files in the opensim/bin folder.
- libode.dylib http://cdnetworks-us-1.dl.sourceforge.net/project/opende/ODE/0.11.1/ode-0.11.1.zip
- libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib (checked out with svn:)
svn co http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk/openjpeg-dotnet libopenmetaverse-read-only cd libopenmetaverse-read-only
- To build, remove the Makefile file, which is for Linux, and rename Makefile.osx to just Makefile, then give the command: make )
- Remove the other versions of the two libraries (similar names, different extensions, like "libode-x86_64.so". Two libode's and three libopenjpeg's).
- Configure your sim: Copy OpenSim.ini.example to OpenSim.ini and customize it per its comments.
- Likewise copy and customize StandaloneCommon.ini in bin/config-include
- Note that the comments say that the current SQLite plugin doesn't work on OS X. Either solve that, or install MySQL, which requires no compiling and is relatively easy to set up:
- From http://downloads.mysql.com/archives.php?p=mysql-5.1&v=5.1.40, download MySQL 5.1.40 for 10.5 PowerPC (installer, not 64-bit)
- Run the installer. (which installs to /usr/local)
- Install MySQL.prefPane into System Preferences by double-clicking it.
- Open the pref pane and start MySQL.
- (Optional:) For unattended startup, install MySQLStartupItem (doesn't always work for me).
- (Recommended:) In Terminal, do the one-time setup of MySQL with this command: mysql_secure_installation
- In MySQL, create the opensim user per the comments in OpenSim.ini. Give it all the create privileges.
- Since this is a Mac, you could use Sequel Pro (donationware) to do that in a nice GUI. Standard connection, host: 127.0.0.1 (if on the same Mac)
- You're ready to run OpenSimulator. In that new Terminal window, cd to your OpenSim-source/bin folder.
mono OpenSim.exe
- If all is well, you will be prompted "New region name []: "
- Turn to "Running OpenSimulator for the first time" on wiki page Configuration
- When fully up and running, the prompt is "Region (<region-name>) #"
Linux
Ubuntu
For Ubuntu users on older distributions (7.10, 8.04, 9.10 etc.) you need to upgrade your version of mono to at least 2.4.3. For anyone who needs to upgrade their Mono, see Update Mono on Ubuntu.
Ubuntu Karmic (9.10) includes mono 2.4.2.3 packages.
Ubuntu Lucid (10.04) includes mono 2.4.4 packages.
Ubuntu Maverick (10.10) includes mono 2.6.7 packages.
Ubuntu Natty (11.04) includes mono 2.6.7 packages.
Ubuntu 10.04 and later
In this version, one only needs to install mono-complete - this will pull down all the other required packages as dependencies. Thus, to build:
sudo apt-get install mono-complete Download opensim cd opensim ./runprebuild.sh xbuild
As of mono 2.6 series, xbuild works well enough to drive a complete build of OpenSimulator. Since xbuild is included within the mono-complete package on Ubuntu, you don't have to install any additional packages if you don't have any particular reason to prefer nant over xbuild. They are just two different build systems that invoke the same C# compiler based on two different build script formats.
If you do want to build using nant, then you will need to install the nant apt-get package and execute
nant
instead of
xbuild
after ./runprebuild.sh
OPTIONAL (for developers): To run the regression test suite, you will also need to install nunit-console, like so
sudo apt-get install nunit-console nant test
Debian
Debian 4 (Etch) is no longer supported by debian.org. Update at least to 5 (Lenny) before running OpenSimulator. See Upgrades from previous release@debian.org for detail.
For Debian 5 (Lenny) or later, just type:
sudo aptitude install nant
before run runprebuild.sh and nant. You can even use apt-get instead of aptitude. They both will also install dependent packages.
Tested on Debian 5 "Lenny" oldstable, Debian 6 "Squeeze" stable and Debian 7 "Wheezy" testing.
RHEL, Fedora, CentOS or other RedHats
After getting run your OpenSimulator binary distributions, you'll need to get mono development library and install nant to build OpenSimulator from the source. See both sections below.
Getting Mono Libraries
If you have installed mono packages from the core repository for your distributions when you run OpenSim.exe binary distribusion, just type:
sudo yum install mono-devel
If not, just type (given that you have already set up yum repository for mono) :
sudo yum install mono-addon-devel
Both command will install its dependencies as well.
Installing NAnt
Run "yum info nant" to check the version of nant package. If you find the package, then just type:
sudo yum install nant
You can now run nant out-of-the-box.
If you can't find nant package in yum repository, or you feel its version is too early for building OpenSimulator, obtain NAnt from NAnt Project Site. See User Manual there for detailed instruction. As of 0.90, you will need to create startup script like that (given you have expanded NAnt to /usr/local/nant) :
sudo vi /usr/bin/nant
Then inside this file :
#!/bin/sh exec mono /usr/local/nant/bin/NAnt.exe "$@"
After that, make it executable :
sudo chmod +x /usr/bin/nant
You can now run runprebuild.sh and nant to compile OpenSimulator.
openSUSE
Just type:
sudo zypper install nant
before run runprebuild.sh and nant. It will also install dependent packages.
FreeBSD
On FreeBSD 6.2 and later
su cd /usr/ports/devel/subversion/ && make install clean (you may also need to rebuild apr-svn if this step fails) cd /usr/ports/lang/mono/ && make install clean cd /usr/ports/devel/nant/ && make install clean cd /usr/ports/databases/sqlite3/ && make install clean cd /usr/ports/x11-toolkits/libgdiplus/ && make install clean cd /opensim/installation/directory/ Download opensim cd opensim ./runprebuild.sh nant
If you get "System.DllNotFoundException: libopenjpeg" errors, follow one of these fixes (depending of the lib appearing in the error message):
For ODE Physics you must do the following:
cd /usr/ports/graphics/libGL/ && make install clean cd /usr/ports/graphics/libGLU/ && make install clean cd /opensim/installation/directory/ git clone git://opensimulator.org/git/opensim-libs cd opensim-libs/trunk/unmanaged/OpenDynamicsEngine-r1755 sh autogen.sh ./configure --enable-shared --enable-release --disable-demos --without-x --enable-old-trimesh make cp ./ode/src/.libs/libode.so /opensim/installation/directory/opensim/bin/libode.so (32 bit) cp ./ode/src/.libs/libode.so /opensim/installation/directory/opensim/bin/libode-x86_64.so (64 bit)
Configuration
After building, OpenSimulator needs to be configured before it can be run. Unlike the binary distributions, the source distributions and the source code obtained directly from Git will not already have bin/OpenSim.ini and a bin/config-include/StandaloneCommon.ini or a bin/config-include/Grid.ini file. You will need to copy those from their respective .example files (e.g. bin/OpenSim.ini.example) and configure as appropriate.