opensim-core
opensim-core copied to clipboard
Readme fix: the minimum Java development kit version should be 1.8.
I've just successfully built the master branch of opensim and opensim-gui on Ubuntu 20.04 and booted it up, loaded and model and all looks good : ). Not everything is perfect (every Matlab test fails, and a few Java tests fail), but nothing that the gui depends on has failed.
Now that I've been through this, I think there should be a note in the Readme for the Ubuntu installation: openjdk-1.8 should be used if you plan on building the opensim-gui. Now that the opensim-gui is using NetBeans 12.3 it requires openjdk-1.8, it won't compile with openjdk-1.7.
Thanks @mjhmilla for reporting, indeed we use 1.8 for ci, @AlbertoCasasOrtiz is updating the stale instructions in the README. Again ci java tests all pass, if you see failures please report.
On Ubuntu 20.04 I've built and installed the master branches of opensim (4.4-2022-05-23-29fd6bb4c) and opensim-gui (4.4-2022-05-23-5aa1e9b7). I've started the gui, loaded the double pendulum example, simulated it, and animated it. However, some of the tests in opensim fail.
Before digging into the failing tests, here are some details on the build
Dependencies:
- I've used the Superbuild all with RelWithDebInfo (dependencies, opensim, opensim-gui)
- I've built docopt, ezc3d, ipopt, simbody, spdlog, CASADI, but disabled Tropter(*)
- I had to install openjdk-8-jdk make openjdk-8-jdk the default version
-
sudo update-alternatives --config java
-sudo update-alternatives --config javac
- As usual, next JAVA_HOME, and JRE_HOME were added to the .bashrc file and the bin folder added to the path
-
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
-export JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
-export PATH=$PATH:$JRE_HOME/bin:$JAVA_HOME/bin
- Finally I had to install the compatible version of ant the compatible version of ant (1.10.7) which worked easily using
sudo get install ant
- *I have not build Tropter because it depends on Adolc, and Adolc was causing a build failure when the Java bindings were being compiled. Otherwise I followed the instructions of opensim's CI
OpenSim & OpenSim-Gui build and installation
- Opensim-core: Tropter disabled, otherwise defaults + settings from CI taken as is.
- Updated *.bashrc file:
-
export PATH=~/opensim-core-source-install/bin:$PATH
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/opensim-core-source-install/lib
- Opensim-gui: Followed the CI for Ubuntu. After 'make PrepareInstaller' I had to call 'make' which is missing from CI, but otherwise everything worked as is.
Now for the test failures:
119:Java_TestTables
123:Java_TestC3DFileAdapter
125:Java_TestXsensDataReader
127:Matlab_TugOfWar
128:Matlab_wiringInputsAndOutputsWithTableReporter
129:Matlab_RunHopper_answers
130:Matlab_RunHopperWithDevice_answers
131:Matlab_ConnectorsInputsOutputs
132:Matlab_AccessSubcomponents
133:Matlab_Simbody
134:Matlab_osimTableStruct
135:Matlab_testOsimVec3
136:Matlab_testOsimC3D
137:Matlab_testOsimList2MatlabCell
138:Matlab_testWalkerScripts
139:Matlab_SlidingMass
140:Matlab_MocoSWIGAdditionalInterface
141:Matlab_MocoWorkflow
Looking at the log files for the Matlab tests I can see that each of these tests produces this error message (using Matlab_TugOfWar as an example) when 'model=Model()' is reached:
All Matlab tests have a similar error:
Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: /home/mmillard/opensim-core-build/libosimJavaJNI.so: /usr/local/MATLAB/R2021b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/mmillard/opensim-core-build/libosimJavaJNI.so)
See https://simtk-confluence.stanford.edu/display/OpenSim40/Scripting+with+Matlab
An exception has been thrown during the execution
JavaException with properties:
ExceptionObject: [1x1 java.lang.UnsatisfiedLinkError]
identifier: 'MATLAB:Java:GenericException'
message: 'Java exception occurred: ...'
cause: {}
stack: [1x1 struct]
Correction: []
file: '/home/mmillard/opensim-core-source/Bindings/Java/Matlab/examples/OpenSimCreateTugOfWarModel.m'
name: 'OpenSimCreateTugOfWarModel'
line: 30
When I run the Java tests individually from the command line I see the following error messages:
TestTables:
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -enableassertions -Djava.library.path=/home/mmillard/opensim-core-build -classpath TestTables.jar:/home/mmillard/opensim-core-build/Bindings/Java/src/org-opensim-modeling.jar TestTables
" ... lots of tables written to the screen ..."
Exception in thread "main" java.lang.RuntimeException: Timestamp at row 0 with value 3,000000 is greater-than/equal to timestamp at row 1 with value 3,000000
Thrown at TimeSeriesTable.h:491 in validateRow().
at org.opensim.modeling.opensimCommonJNI.new_TimeSeriesTableVec3__SWIG_5(Native Method)
at org.opensim.modeling.TimeSeriesTableVec3.<init>(TimeSeriesTableVec3.java:96)
at TestTables.test_FlattenWithIK(TestTables.java:710)
at TestTables.main(TestTables.java:776)
TestC3DFileAdapter
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -enableassertions -Djava.library.path=/home/mmillard/opensim-core-build -classpath TestC3DFileAdapter.jar:/home/mmillard/opensim-core-build/Bindings/Java/src/org-opensim-modeling.jar TestC3DFileAdapter
Exception in thread "main" java.lang.AssertionError
at TestC3DFileAdapter.test_C3DFileAdapter(TestC3DFileAdapter.java:15)
at TestC3DFileAdapter.main(TestC3DFileAdapter.java:101)
Java_TestXsensDataReader
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -enableassertions -Djava.library.path=/home/mmillard/opensim-core-build -classpath TestXsensDataReader.jar:/home/mmillard/opensim-core-build/Bindings/Java/src/org-opensim-modeling.jar TestXsensDataReader
Exception in thread "main" java.lang.AssertionError
at TestXsensDataReader.test_XsensDataReader(TestXsensDataReader.java:25)
at TestXsensDataReader.main(TestXsensDataReader.java:57)
And another update:
On Windows using OpenSim 4.3 I can load the neck model of Mortensen et al. (https://simtk.org/projects/neckdynamics ), load a motion (after updating the format to post-4.0), and watch the head and neck move. When attempt to load the neck model of Mortensen et al. using the build mentioned above it brings the GUI down. Printed at the command window is the following:
~/opensim-gui/Gui/opensim/dist/installer/opensim/bin$ new OPENSIM_HOME =/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim Web Root URI: %s%nfile:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/ Loading plugins from directory /home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/bin/plugins [info] Loaded model HYOID_Subject_01 from file /home/mmillard/work/code/stuttgart/HYOID_1.2_ScaledStrenght_UpdatedInertia/Mortensen et al. 2018, PLOS ONE/HYOID_Subject_01_update.osim ./../platform/lib/nbexec: line 434: 158926 Segmentation fault (core dumped) "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" -Djdk.home="/usr/lib/jvm/java-8-openjdk-amd64/jre" -classpath "/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform/lib/boot.jar:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform/lib/org-openide-modules.jar:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform/lib/org-openide-util.jar:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform/lib/org-openide-util-lookup.jar:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform/lib/org-openide-util-ui.jar" -Dnetbeans.running.environment=gnome -Dnetbeans.dirs="/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/opensim:/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/ide:" -Dnetbeans.home="/home/mmillard/opensim-gui/Gui/opensim/dist/installer/opensim/platform" '-Xms24m' '-Xmx1024M' '-Djava.library.path=./../sdk/lib' '-Dopensim.buildnumber=4.4-2022-05-23-5aa1e9b7' -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/home/mmillard/.opensim/4.4-2022-05-23-5aa1e9b7/var/log/heapdump.hprof" org.netbeans.Main --cachedir "" --userdir "/home/mmillard/.opensim/4.4-2022-05-23-5aa1e9b7" "--branding"
@mjhmilla For the test cases, are you sure you're building with C3D parsing on? CMake variable OPENSIM_C3D_PARSER needs to be set to ezc3d (defaults to none). For the model failing to open, please attach the file. Main thing I can think of is if bodies have unspecified masses (rather than 0) that could be an issue, but we shouldn't crash. Please let me know what you find out
Actually I do have ezc3d on, @aymanhab. To make this process easier, I'm just going print the settings of the exposed cmake variables below. As for the model, the problem is a bit more complicated, but maybe not so serious:
details on Mortensen et al., OpenSim 4.4+ on Ubuntu 20.04
- The model that comes with Mortensen et al (HYOID_1.2_ScaledStrenght_UpdatedInertia) opens fine. When a motion file is played (updated using updatePre40KinematicsFIlesFor40MotionType) everything works just fine on OpenSim 4.4+ with Ubuntu 20.04.
- The scaled model "Mortensen et al. 2018, PLOS ONE/HYOID_Subject_01" has some problems:
- Loads fine using OpenSim 4.3 on a Windows machine
- Brings down the bleeding-edge OpenSim 4.4+ that I've built on Ubuntu 20.04. I've attached this version of the model here: HYOID_Subject_01.zip
- I played around a little bit with HYOID_Subject_01 on the OpenSim 4.4+ on Ubuntu 20.04:
- On the Windows machine I saved the scaled model, as there were some old components in the model (coupled coordinates) that were not up-to-date with OpenSim 4.0+
- I then opened this version on the Ubuntu machine, but it brought down OpenSim 4.4+.
opensim-dependencies
MAKE_BUILD_TYPE RelWithDebInfo
CMAKE_INSTALL_PREFIX /home/mmillard/opensim_dependencies_install
OPENSIM_WITH_CASADI ON
OPENSIM_WITH_TROPTER OFF
SUPERBUILD_BTK OFF
SUPERBUILD_docopt ON
SUPERBUILD_ezc3d ON
SUPERBUILD_ipopt ON
SUPERBUILD_simbody ON
SUPERBUILD_spdlog ON
opensim-core
ADOLC_DIR /home/mmillard/opensim_dependencies_install/adol-c
ADOLC_INCLUDES ADOLC_INCLUDES-NOTFOUND
ADOLC_LIBRARIES ADOLC_LIBRARIES-NOTFOUND
BUILD_API_EXAMPLES ON
BUILD_API_ONLY OFF
BUILD_JAVA_WRAPPING ON
BUILD_PLATFORM Linux:x64
BUILD_PYTHON_WRAPPING ON
BUILD_SIMM_TRANSLATOR OFF
BUILD_TESTING ON
CMAKE_BUILD_TYPE RelWithDebInfo
CMAKE_DEBUG_POSTFIX _d
CMAKE_INSTALL_PREFIX /home/mmillard/opensim-core-source-install
CMAKE_PREFIX_PATH /home/mmillard/opensim_dependencies_install/colpack;/home/mmillard/opensim_dependencies_install/eigen;/home/mmillar
ColPack_DIR /home/mmillard/opensim_dependencies_install/colpack/lib/cmake/ColPack
Eigen3_DIR /home/mmillard/opensim_dependencies_install/eigen/share/eigen3/cmake
Matlab_ROOT_DIR /usr/local/MATLAB/R2021b
OPENSIM_C3D_PARSER ezc3d
OPENSIM_DEPENDENCIES_DIR /home/mmillard/opensim-core-source/../opensim_dependencies_install
OPENSIM_DISABLE_LOG_FILE OFF
OPENSIM_DOXYGEN_USE_MATHJAX ON
OPENSIM_INSTALL_UNIX_FHS OFF
OPENSIM_JAVA_WRAPPING_PACKAGE org.opensim.modeling
OPENSIM_QUALIFIED_VERSION 4.4-2022-05-23-29fd6bb4c
OPENSIM_WITH_CASADI ON
OPENSIM_WITH_TROPTER OFF
Python3_ROOT_DIR
SIMBODY_HOME
TROPTER_WITH_OPENMP OFF
TROPTER_WITH_SNOPT OFF
casadi_DIR /home/mmillard/opensim_dependencies_install/casadi/lib/cmake/casadi
docopt_DIR /home/mmillard/opensim_dependencies_install/docopt/lib/cmake/docopt
ezc3d_DIR /home/mmillard/opensim_dependencies_install/ezc3d/lib/cmake/ezc3d
spdlog_DIR /home/mmillard/opensim_dependencies_install/spdlog/lib/spdlog/cmake
After configuring:
Python3_FOUND:TRUE Python3_VERSION:3.8.10 Python3_Development_FOUND:TRUE Python3_LIBRARIES:/usr/lib/x86_64-linux-gnu/libpython3.8.so Python3_Numpy_Include:/usr/lib/python3/dist-packages/numpy/core/include Python3_Numpy_VERSION:1.17.4
opensim-gui
CMAKE_BUILD_TYPE RelWithDebInfo
CMAKE_INSTALL_PREFIX /home/mmillard/opensim-gui-install
MODELS_REPO /home/mmillard/opensim-gui/opensim-models
OPENSIMGUI_BUILD_VERSION 4.4-2022-05-23-5aa1e9b7
OpenSim_DIR /home/mmillard/opensim-core-source-install/cmake
Simbody_DIR /home/mmillard/opensim-core-source-install/sdk/Simbody/lib/cmake/simbody
spdlog_DIR /home/mmillard/opensim-core-source-install/sdk/spdlog/lib/spdlog/cmake
@mjhmilla There's an issue with your locale where decimal point is European rather than US resulting in numbers being misinterpreted (message refers to 3,000000 rather than 3000000) you can adjust Locale and rerun.
@aymanhab thank you! It never occurred to me that this setting would affect these tests.
@AlbertoCasasOrtiz has this been addressed with your latest scripts/build files? Thanks
Hi @aymanhab Yes. The new readme and the build scripts use Java 1.8. I also searched in the source code for references to Java 1.7, and now everything is using 1.8 as minimum Java verion. This is the pull request: https://github.com/opensim-org/opensim-core/pull/3317