OpenSim-Gui - Linux

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Luis Figueredo
Posts: 5
Joined: Tue Nov 20, 2018 3:10 am

OpenSim-Gui - Linux

Post by Luis Figueredo » Tue Nov 20, 2018 3:12 pm

Hi everyone,
I've just started using OpenSim and had a bit of a hard time installing the Gui.
This post is just a resume of the procedure I did to make it work. Hope it helps others. :)

INSTALLING THE API

This should work without any problem. The detailed instructions are very well described at https://github.com/opensim-org/opensim- ... -makefiles

The list of specific commands for different ubuntu distros are given at
https://github.com/opensim-org/opensim- ... ent-ubuntu
And, they worked like a charm.

Before Installation, you should add the JAVA_HOME to the env.

Code: Select all

echo `export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"` >> ~/.bashrc
source ~/.bashrc
if you have a different java or installed it in a different place, search it using

Code: Select all

sudo updatedb
locate java | grep openjdk 
Set the environment variables
A list of environment variables set-up can be found here: https://simtk-confluence.stanford.edu/d ... ux+Support
To ease the work, the summarized code goes as follows

Code: Select all

echo `export OPENSIM_HOME="/INSTALLATION FOLDER (PLEASE CHANGE HERE)/opensim_install"` >> ~/.bashrc
source ~/.bashrc
echo `export LIBRARY_PATH="$OPENSIM_HOME/lib"` >> ~/.bashrc
sudo `export LD_LIBRARY_PATH="$OPENSIM_HOME/lib"` >> ~/.bashrc
source ~/.bashrc
sudo ln -s $OPENSIM_HOME/bin/opensim-cmd /usr/local/bin


INSTALLING OPENSIM-GUI AND VISUALIZER FOR LINUX


Downloading
At this point, you will need the OpenSim-Gui, Visualizer, models and Threejs.
All are required but are located in different submodules at the OpenSim git.
Part of the instructions can be found in the OpenSim-Gui git folder: https://github.com/opensim-org/opensim-gui
But, to fully work (at least for me :), you need to dig on the shell script used for OSX: https://github.com/opensim-org/opensim- ... _on_mac.sh

In the desired folder (likely the main folder where you downloaded the OpenSim-Core above), you need to git clone all these modules.

Code: Select all

git clone https://github.com/opensim-org/opensim-gui 
cd opensim-gui
git submodule update --init --recursive -- \
        opensim-models \
        opensim-visualizer \
        Gui/opensim/threejs

Installing netbeans
This should be done without any issue.
To ease the installation, create a temp environment variable (at the open terminal):

Code: Select all

export NETBEANS_HOME="[ netbeans installation folder]"
export OPENSIMGUI_HOME="/[CURRENT ADDRESS WHERE YOU DOWNLOADED opensim-gui]"

Installing
First, you need to create a build directory. Then, following the instructions from (https://github.com/opensim-org/opensim-gui), you need to make sure to add the proper variables (see below) to the cmake:
  • OpenSim_DIR: The directory containing OpenSimConfig.cmake.
  • Simbody_DIR: The directory containing SimbodyConfig.cmake
  • Ant_EXECUTABLE: If you want to use the Ant that comes with NetBeans, specify something like $NETBEANS_HOME/extide/ant/bin/ant
To find OpenSimConfig.cmake and SimbodyConfig.cmake directories (the same for the Ant executable). Please use

Code: Select all

locate OpenSimConfig.cmake
locate SimbodyConfig.cmake
Following partially the instructions at https://github.com/opensim-org/opensim- ... _on_mac.sh, inside the opensim-gui folder, compile it.

Code: Select all

mkdir ../opensim-gui-build 
cd ../opensim-gui-build 
cmake $OPENSIMGUI_HOME -DOpenSim_DIR="$OPENSIM_HOME/lib/cmake/OpenSim/" -DSimbody_DIR="$OPENSIM_HOME/../opensim_dependencies_install/simbody/lib/cmake/simbody/" -DAnt_EXECUTABLE="$OPENSIM_HOME/extide/ant/bin/ant" -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=$OPENSIM_HOME;-Dnbplatform.default.harness.dir=$OPENSIM_HOME/harness"
make CopyOpenSimCore
make CopyVisualizer
make CopyModels


Linkage problem
There is a continuous problem that has only be fixed following the procedures in https://github.com/opensim-org/opensim-gui/issues/186
Add to the end of the file ....../opensim/nbproject/project.properties
run.args.extra=-J-Djava.library.path=${LD_LIBRARY_PATH}
(if for some reason LD_LIBRARY_PATH does not work, replace it for the absolute path. The important point here is to add to the Djava library path the path to the folder containing libosimJavaJNI.so. If you don't know which folder is that, just do
locate libosimJavaJNI.so

If the linkage error described above persists, the command-line at runtime (see below) should help to bypass the problem.


Runtime
Using Netbeans, just follows the procedures at the end of https://simtk-confluence.stanford.edu/d ... ng+the+GUI
The following is copied from the above link.
  • Start Netbeans, and the click on File->Open Project
  • Browse (starting with the folder containing the OpenSim source code) to one of its OpenSim sub-folder's named Gui/ and then open the "project" opensim.
  • Click on the green arrow button (run project button) to automatically compile all the source and launch the OpenSim GUI (which may look a bit different and contain extra menu items/windows depending on your version of Netbeans -- but the functionality is there).
  • If the GUI crashes while running through Netbeans you may have to manually delete the residual lock file contained in the OpenSim source code subfolder Gui/opensim/build/testuserdir/lock. Failing to do so may result in access violation errors during subsequent runs.
Using command-line:

Code: Select all

sudo ln -s $NETBEANS_HOME/extide/ant/bin/ant /usr/local/bin/ant
ant -Dnbplatform.default.netbeans.dest.dir="$NETBEANS_HOME" -Dnbplatform.default.harness.dir="$NETBEANS_HOME/harness"  -f "/[ADDRESS WHERE YOU INSTALLED opensim-gui]/Gui/opensim run
Use -v instead of run to check for libraries etc.

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: OpenSim-Gui - Linux

Post by jimmy d » Tue Nov 20, 2018 5:22 pm

Thanks, Luis. These are really great instructions. I would encourage you to contribute these to the GUI repo; I started an issue to keep a track of it, here

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: OpenSim-Gui - Linux

Post by Christopher Dembia » Tue Nov 20, 2018 5:31 pm

Luis, you have accomplished quite a feat. Could you share a screenshot of the GUI on Linux to show off your success? If you're up for it, you could share a shell script that automates all of these tasks (similar to `build_on_mac.sh`) and we could keep this somewhere in the `opensim-gui` or `opensim-build-releases` repository.

User avatar
Luis Figueredo
Posts: 5
Joined: Tue Nov 20, 2018 3:10 am

Re: OpenSim-Gui - Linux

Post by Luis Figueredo » Wed Nov 21, 2018 1:18 pm

Hi Chris,
I guess the screenshot doesn't look very different from win or osx, but here it goes :)
screenshot_2018_11_21.png
screenshot_2018_11_21.png (504.05 KiB) Viewed 1653 times
ps.: sorry for the image quality (I had to reduce it).


James, I'd be glad to help with the GUI repo.
Let me first build a shell script with all these steps as Chris suggested (it shouldn't be very difficult), and try it in different PCs (I only tried on 16.04). I'll probably do it over the weekend when I have a bit more time, but I'll keep you posted. :)

ps.: I've seen in the other post (in the Gui repo) that someone else has already built a shell for 18.04. That is great! Anyways, the more the better I guess, and if one does not work for any reason, there is always the other one.

User avatar
David Frenkel
Posts: 4
Joined: Tue Jul 14, 2015 1:58 pm

Re: OpenSim-Gui - Linux

Post by David Frenkel » Mon Jul 22, 2019 1:25 pm

We have a question about building the OpenSim GUI on Linux, but we are interested in the 3.3 version that we are still using.

1) Is the GUI source code available for the 3.3 version? The 3.3 tag is "missing" in the opensim-gui git repo (just as it does in the opensim-core repo), and we are not sure where else to look for the 3.3 GUI code.

2) If we can locate the source code, we will try to build it based on miscellaneous instructions, including the ones in this thread, but it would be nice to know if anyone has ever had success on any Linux with the 3.3 GUI. (We have previously compiled the command-line tools on CentOS.)

Thank you,
David Frenkel

POST REPLY