Build Instructions
From OpenSimulator
(→Ahead of Time compilation (AOT)) |
(→Ahead of Time compilation (AOT)) |
||
Line 103: | Line 103: | ||
Since JIT is done at runtime, it has limited time to do extensive code optimizations, AOT on the other hand can do all.<br> | Since JIT is done at runtime, it has limited time to do extensive code optimizations, AOT on the other hand can do all.<br> | ||
AOT should this way be faster to load, save some the memory needed by JIT work, and reduce latency due to code generation when a new code section is needed.<br> | AOT should this way be faster to load, save some the memory needed by JIT work, and reduce latency due to code generation when a new code section is needed.<br> | ||
− | This way | + | This way AOT helps reduce the huge performance gap between C# and a more proper language like C++, even considering JIT can do some optimization dependent on current code execution state, that AOT can't. (if you think c# is as fast as competent c++ code, better stop smoking what you are smoking..)<br> |
In fact both .net and mono do AOT on their components during install<br> | In fact both .net and mono do AOT on their components during install<br> | ||
JIT will still be active, compiling some other code at run time. OpenSim and used .net/mono framework parts depend on it.<br> | JIT will still be active, compiling some other code at run time. OpenSim and used .net/mono framework parts depend on it.<br> |
Revision as of 09:18, 17 October 2020
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 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.
Requirements
OpenSimulator 0.9.0.x requires either
- .NET Framework 4.0 on Windows
- Mono on Linux or Mac. Mono 2.10.8 is the minimum version.
You may also need nant tool.
OpenSimulator 0.9.1 (including current master) requires
- .NET Framework 4.6 on Windows
- Mono on Linux or Mac. Mono 5.12 is the minimum recommended version.
Note: rather than using your Linux distro's Mono packages, which may be missing required components, please install from the official Mono repo for your distro.
recommend compiling with msbuild.
Other platforms may have own mono distributions, or may need to compile mono on them.
Other libraries used by OpenSimulator can be found at our opensim-libs git repo:
git clone git://opensimulator.org/git/opensim-libs
libOpenMetaVerse used can be found at https://bitbucket.org/opensimulator/
You may need to compile them for your platform, in particular the unmanaged ones like Bullet or ODE native code libraries
MS Windows
Supported Compilers
- Visual Studio Community 2017
- Or any version that does support the .Net version. At least VS2010 for versions prior to 0.91, VS2015 for 0.91 and after.
- OpenSimulator 0.9.1 Support Microsoft Visual Studio 2019 Enterprise Professional Community (runprebuild.bat ln11-18).
Compiling in an IDE
- Run "runprebuild.bat"
- Open the resulting "OpenSim.sln" in Visual Studio IDE.
- Select Debug or Release configuration
- Menu Build -> Build Solution.
Compiling at the Command Prompt
- Run "runprebuild.bat".
- Run the resulting "compile.bat" file.
Linux and Other Mono Platforms
Prepare to compile
To create the several project files run on the folder opensim:
./runprebuild.sh
Compile with Nant
On some mono versions, in particular old ones may need the use of nant to proper compile OpenSimulator, in that case just run:
nant
Compile with xbuild
On mono versions you can just use xbuild. (msbuild is recommended for 0.9.1.0.0+)
xbuild
xbuild is no longer recommended on mono 5.x, but currently still works (5.12)
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
On more recent mono versions Release configuration may give some performance gain, but you do lose some debug capabilities. to compile Release configuration:
xbuild /p:Configuration=Release
Compile with msbuild
For Opensim 0.9.1 you can still use xbuild but Mono recommends the use of msbuild. You might need to install the package msbuild in addition to mono-complete for that. (Currently msbuild is included if you install mono-complete, on Ubuntu, from the official mono repositories. https://www.mono-project.com/download/stable/#download-lin )
Use xbuild on the other cases as a last resort.
Recent improvements, specially on JIT runtime, justify compiling in Release configuration, but you do lose some debug capabilities.
to compile with Debug configuration:
msbuild
to compile with Release configuration:
msbuild /p:Configuration=Release
to compile with the debug configuration and detailed opensim.log file can then be read with a text editor:
msbuild /p:Configuration=Debug /fileLogger /flp:logfile=opensim.log /v:d
you can specify the following values for the level of detail of the opensim.log file:
q [quiet], m [minimal], n [normal], d [detailed] and diag [diagnostic].
Ahead of Time compilation (AOT)
As you all know the files *.exe and .ddl created by the compiling process above do no contain native code for the machine.
With those files, the native code required by the cpu is created at runtime, as needed, in a process known as Just in Time (JIT)
It is possible to do another compile stage on those files to create native code, that will ready when the program starts. This is the Ahead of time process (AOT).
Since JIT is done at runtime, it has limited time to do extensive code optimizations, AOT on the other hand can do all.
AOT should this way be faster to load, save some the memory needed by JIT work, and reduce latency due to code generation when a new code section is needed.
This way AOT helps reduce the huge performance gap between C# and a more proper language like C++, even considering JIT can do some optimization dependent on current code execution state, that AOT can't. (if you think c# is as fast as competent c++ code, better stop smoking what you are smoking..)
In fact both .net and mono do AOT on their components during install
JIT will still be active, compiling some other code at run time. OpenSim and used .net/mono framework parts depend on it.
For Linux, 0.9.2.0 now includes scripts makeaot.sh and cleanaot.sh to help testing AOT.
Run makeaot.sh after the compile stage above, to generate the native code files. The option -O=all must be added to mono when executing opensim.exe, ex:
mono --desktop -O=all OpenSim.exe
Script cleanaot.sh removes the binary files used by AOT. You must run it if you recompile the code (to be safe even if running makeaot).
DO NOT FORGET to run makeaot.sh or cleanaot.sh after recompile!
The generated files are specific for that machine. Do not copy the native code files to other machine, unless it is absolutely identical
The original .exe and .dll are still needed
AOT is also possible in windows, but using different tools, and those add things to central repository on the machine, harder to isolate and maintain. see ngen
Macs are.. Macs.. Future models may totally forbid JIT, like their mobile products do. Mono AOT on current Macs may work as on Linux
In practical use, don't expect much more than a bit faster loading.
Additionally, since compilation is different, it may add new issues. So test with care
Opensim performance issues are mostly on its own code, terrible bad communications protocols, use of bad .net/mono framework code (demo quality in same cases), etc.
And of course stupid eternally broken GC
But... well every ns counts..
Configuration
See Configuration.