Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux install script matlab/SWIG bindings connection issues Moco/Tropter #3400

Closed
cvhammond opened this issue Feb 14, 2023 · 6 comments
Closed

Comments

@cvhammond
Copy link
Member

Attempting to install opensim-core via the install script on Ubuntu 22.04.

If you run the install with Moco then the error: java.lang.UnsatisfiedLinkError: /home/claire/opensim-core/sdk/lib/libosimJavaJNI.so: libadolc.so.2: cannot open shared object file: No such file or directory pops up after running model = org.opensim.modeling.Model() after running configureOpenSim.m and restarting Matlab.

If you look in the directory, there is a file libadolc.so.2.1.0 which seems similar. I even changed the name of it, but received another linking error.

If you download the pre-built Linux build from the continuous-integration GitHub Action for this repository with the 'no-moco' tag, then it works out of the box, but crashes on model.initSystem() for the model that we are using without issue elsewhere. I have attached the model, it is a Rajagopal-like model. I assume Moco and associated libraries are required for the model's system to be initialized. An empty model's system can be initialized without crashing.

Rajagopal_4.0_RCNL_markers_scaled.zip

Can the install script be updated or is the bug related to how Moco libraries are included and the effect on resultant libosimJavaJNI.so file? I've basically reached a dead-end, this is Linux specific because the Matlab bindings are working great for Mac and Windows

@halleysfifthinc
Copy link

halleysfifthinc commented Feb 14, 2023

Your first issue should be solved once #2930 is finished/merged.

using without issue elsewhere

Elsewhere being not in MATLAB and/or on Linux? If the MATLAB/Linux combo is the problem, then based on my own experiences1 trying to use the OpenSim API in MATLAB on Linux, your second issue is #2928. Basically, anything which uses a BLAS function crashes because libosimJavaJNI is incorrectly trying to use a BLAS function from the BLAS (Intel MKL) that MATLAB ships with. I guess this is probably due to similar linking/RPATH issues as ADOLC, but I haven't had time to investigate further.

Footnotes

  1. Including with the Rajagopal model, as well as others

@AlbertoCasasOrtiz
Copy link
Contributor

Hi @cvhammond, I am sorry to hear you are having this issue. This is something we are working on, related to how libraries are loaded in Linux. We are working on fixing this on this PR #2930, as @halleysfifthinc mentioned.

If you installed opensim-core or opensim-gui using the install script, you can try the workaround mentioned in opensim-org/opensim-gui#1393. Try executing the following commands before executing opensim or matlab (don't forget to substitute <user_name> with your ubuntu username!):

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/<user_name>/opensim-workspace/opensim-core-dependencies-install/adol-c/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/<user_name>/opensim-workspace/opensim-core-dependencies-install/ipopt/lib

@cvhammond
Copy link
Member Author

Glad to see this is already on your radar. I tried a few of the suggestions without success; looking forward to the issues being resolved!

@aymanhab
Copy link
Member

@cvhammond now that PR #2930 is merged, feel free to test the install script again and close the issue if fixed. Thanks for reporting.

@cvhammond
Copy link
Member Author

To report:

I reinstalled MATLAB, matlab-support (apt-get install) and then OpenSim from the linux-build-script (w/moco) on Ubuntu 22.04.

After configureOpenSim.m I received an error similar to: cannot find GLIBCXX_3.4.29 in file /usr/local/MATLAB/R2022b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6

I found this link showing that you can just copy the libstdc++.so.6 from /usr/lib/x86_64-linux-gnu/ and it seems to work.

Specifically, I can now load the model attached above without error. I have not yet done significant additional testing.

Regarding copying the libstdc++, I guess the gcc that ships with MATLAB internally hasn't been updated to later versions and uses an older GLIBCXX but OpenSim expects a newer one or something. Unfortunately, I'm not too booked-up on compiler stuff

Technically, using OpenSim with MATLAB out-of-the-box on Ubuntu is not yet possible, please advise to close issue or leave open until the GLIBCXX issue is somehow resolved in the build script.

@aymanhab
Copy link
Member

Thanks for reporting @cvhammond The bottom line is that the two systems (OpenSim and Matlab) make different choices regarding what low level system libraries are assumed to live on the target machine, and end up relying on different GLIBCXX. The fact that the choices are different is not a bug since we're self-conatined but an issue that clients/users have to contend with. Ideally the advanced cmake dialog would give you option to override the default choices. As such I would test a Moco problem (to exercise other call sequences trough the libraries needed to run Moco) and if all works, then close the issue.

We can add a line to documentation somewhere describing the problem and workaround for future users of Matab on linux. Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants