-
Notifications
You must be signed in to change notification settings - Fork 319
Build Instructions
This page provides with Build Scripts for Windows, MacOS and Linux (Ubuntu and Debian). The scripts take care of downloading, building and installing OpenSim Core and all of its dependencies.
For each platform you will find: build instructions, a configuration section, and a troubleshooting section with solutions to the most common problems we have identified. If you find an error in the build scripts or have any problem while executing them that is not addressed in the troubleshooting sections, please submit an Issue.
Note: If you have any problem with the scripts, or you want to follow the old build instructions, they are in the Build Instructions (Old Deprecated) wiki page.
Note: Tested on Windows 10 and Windows 11. These instructions should work for other versions with some modifications (e.g., package manager, package names, etc).
-
Download the build script from here.
-
Open Windows PowerShell as Administrator and execute the script as follows:
& 'opensim-core-windows-build-script.ps1'
-
Wait until the building process has finished.
-
Build type:
-
You can change the debug type by setting the
-d
flag value. The values allowed are:- Debug: debugger symbols. No optimizations (more than 10x slower). Library names end with _d.
- Release: No debugger symbols. Optimized.
- RelWithDebInfo: Debugger symbols. Optimized. Bigger but not slower than Release. Choose this if unsure.
- MinSizeRel: Minimum size. Optimized.
-
The default value is
Release
. -
Example:
& 'opensim-core-windows-build-script.ps1' -d Release
-
Note: The same build type should be used for opensim-core and opensim-core-dependencies to avoid mysterious errors.
-
-
Number of jobs (threads):
-
You can change the number of jobs used to build by setting the
-j
flag value. The values allowed are integer numbers >=1. -
The default value is
4
. -
Example:
& 'opensim-core-windows-build-script.ps1' -j 4
-
-
Casadi/Tropter:
-
You can disable Moco build by setting the
-s
flag. This flag takes no arguments. -
Example:
& 'opensim-core-windows-build-script.ps1' -s
-
-
Branch name (for developers):
-
You can specify the opensim-core branch you want to clone by setting the
-c
flag. -
The default value is
main
. -
Example:
& 'opensim-core-windows-build-script.ps1' -c main
-
-
Running scripts is disabled on the system:
-
Error message:
&: File <path-to-script> cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
-
Solution (more details on this link):
In PowerShell, as Administrator, you can allow execution of scripts with the following command
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Once you are done, you can set the policy back to default (Recommended):
Set-ExecutionPpolicy Restricted -Scope CurrentUser
-
Note: Tested on Ubuntu 18.04, 20.04 and 22.04, and Debian 10 and 11. These instructions should work for other distributions with some modifications (e.g., package manager, package names, etc).
-
Download the build script from here.
-
Open the terminal and execute the script as follows:
./opensim-core-linux-build-script.sh
-
Wait until the building process has finished.
-
Build type:
-
You can change the debug type by setting the
-d
flag value. The values allowed are:- Debug: debugger symbols. No optimizations (more than 10x slower). Library names end with _d.
- Release: No debugger symbols. Optimized.
- RelWithDebInfo: Debugger symbols. Optimized. Bigger but not slower than Release. Choose this if unsure.
- MinSizeRel: Minimum size. Optimized.
-
The default value is
Release
. -
Example:
./opensim-core-linux-build-script.sh -dRelease
-
Note: The same build type should be used for opensim-core and opensim-core-dependencies to avoid mysterious errors.
-
-
Number of jobs (threads) used to build:
-
You can change the number of jobs used to build by setting the
-j
flag value. The values allowed are integer numbers >=1. -
The default value is
4
. -
Example:
./opensim-core-linux-build-script.sh -j4
-
-
Casadi/Tropter:
-
You can disable Moco build by setting the
-s
flag. This flag takes no arguments. -
Example:
./opensim-core-linux-build-script.sh -s
-
-
Branch name (for developers):
-
You can specify the opensim-core branch you want to clone by setting the
-c
flag. -
The default value is
main
. -
Example:
./opensim-core-linux-build-script.sh -cmain
-
-
Permission denied:
-
Error message:
bash: ./opensim-core-linux-build-script.sh: Permission denied
-
Solution: Grant execution permission to the script:
sudo chmod +x opensim-core-linux-build-script.sh
-
-
Failed to load libraries when executing opensim after build:
-
Error message:
~/opensim-core/sdk/lib/libosimJavaJNI.so: libadolc.so.2: cannot open shared object file: No such file or directory.
-
Solution:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-workspace/opensim-core-dependencies-install/simbody/lib
-
-
Build process is consuming more virtual memory than available:
-
Error message: The error message can be different depending of your OS. Here are examples of error messages in Ubuntu and Debian.
killed: signal terminated program cc1plus
virtual memory exhausted: Cannot allocate memory
Additionally, you can confirm that the error is caused by the build process consuming too much virtual memory by executing the following command:
sudo dmesg | grep cc1plus
.The following line should appear (among others):
Out of memory: Killed process <process-number> (cc1plus)...
-
Solution: The most probable scenarios when this error appears are:
- You are using more jobs when executing the build script (
-j
flag) than your system can afford. Increasing the number of jobs increases the virtual memory consumption of the build process. The solution, in this case, is to decrease the number of jobs. Remember that the default number of jobs in our script is 4, so you may need to set it to a lower value. - You have low virtual memory (RAM) available. The solution, in this case, is to increase the memory of your machine (this should be easy if your are building OpenSim in a virtual machine)
- You are using more jobs when executing the build script (
-
-
After installing OpenSim Core,
opensim-cmd
cannot be found:-
Error message:
opensim-cmd: command not found.
-
Solution: opensim-cmd is not in path, you have to execute the following commands:
echo 'export PATH=~/opensim-core/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
-
-
After installing OpenSim Core,
libopenblas.so.0
cannot be found:-
Error message:
./opensim-cmd: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory
-
Solution: We do not distribute low level libraries like this, these need to be installed outside in standard system locations. In the case of this library, you can install it with:
sudo apt install libopenblas-base
-
-
is not in the sudoers file. This incident will be reported.:
-
Error message:
<user> is not in the sudoers file. This incident will be reported. Installation of dependencies using apt-get failed.
-
Solution: You have to install opensim using a user with privileges. You can also try adding your user to sudoers following the instructions in this linkk.
-
Note: Tested on MacOS 11 (Big Sur). These instructions should work for other Mac versions with some modifications (e.g., package names, etc).
-
Download the build script from here.
-
Open the terminal and execute the script as follows:
./opensim-core-macos-build-script.sh
-
Wait until the building process has finished.
-
Build type:
-
You can change the debug type by setting the
-d
flag value. The values allowed are:- Debug: debugger symbols. No optimizations (more than 10x slower). Library names end with _d.
- Release: No debugger symbols. Optimized.
- RelWithDebInfo: Debugger symbols. Optimized. Bigger but not slower than Release. Choose this if unsure.
- MinSizeRel: Minimum size. Optimized.
-
The default value is
Release
. -
Example:
./opensim-core-macos-build-script.sh -dRelease
-
Note: The same build type should be used for opensim-core and opensim-core-dependencies to avoid mysterious errors.
-
-
Number of jobs (threads) used to build:
-
You can change the number of jobs used to build by setting the
-j
flag value. The values allowed are integer numbers >=1. -
The default value is
4
. -
Example:
./opensim-core-macos-build-script.sh -j4
-
-
Casadi/Tropter:
-
You can disable Moco build by setting the
-s
flag. This flag takes no arguments. -
Example:
./opensim-core-macos-build-script.sh -s
-
-
Branch name (for developers):
-
You can specify the opensim-core branch you want to clone by setting the
-c
flag. -
The default value is
main
. -
Example:
./opensim-core-macos-build-script.sh -cmain
-
-
Permission denied:
-
Error message:
zsh: Permission denied ./opensim-core-macos-build-script.sh
-
Solution: Grant execution permission to the script:
sudo chmod +x opensim-core-macos-build-script.sh
-
-
Need sudo access on macOS:
-
Error message:
Need sudo access on macOS (e.g. the user <user-name> needs to be an Administrator)!
-
Solution: Execute the following command to have
sudo
access:sudo su -- <user-name>
Where
<user-name>
is the username logged in on your machine.
-
-
After installing OpenSim Core, opesim-cmd cannot be found:
-
Error message:
opensim-cmd: command not found.
-
Solution: opensim-cmd is not in path, you have to execute the following commands.:
echo 'export PATH=~/opensim-core/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
-