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

Error linking ipopt libraries to tropter during build #3952

Closed
saehuber opened this issue Oct 25, 2024 · 8 comments
Closed

Error linking ipopt libraries to tropter during build #3952

saehuber opened this issue Oct 25, 2024 · 8 comments

Comments

@saehuber
Copy link

saehuber commented Oct 25, 2024

I'm trying to build Opensim 4.5.1 from source on Linux and running into issues. It looks like the copy of libtropter in my build folder is not able to find the ipopt and colpack libraries during the test_derivatives linking step below, though in the configure step, CMake does appear to find these libraries successfully. Maybe something is missing from the cmake setup for this step?

I have the following options set for my configuration

configopts = "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_PYTHON_WRAPPING=ON -DBUILD_JAVA_WRAPPING=ON -DWITH_BTK=ON \
-DOPENSIM_WITH_CASADI=ON -DOPENSIM_WITH_TROPTER=ON -Ddocopt_DIR=%(builddir)s/opensim_dependencies_install/docopt/lib64/cmake/docopt/ \
-DOPENSIM_DEPENDENCIES_DIR=%(builddir)s/opensim_dependencies_install \
-DCMAKE_SKIP_INSTALL_RPATH=OFF \
-DTROPTER_COPY_DEPENDENCIES=ON \
-DTROPTER_WITH_OPENMP=ON"

I'm using intel compilers and CMake 3.27.7

[ 14%] Linking CXX executable ../../../test_derivatives
....
icpx: warning: argument unused during compilation: '-ftz' [-Wunused-command-line-argument]
/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/x86_64-pc-linux-gnu/binutils-bin/2.41/ld: warning: libipopt.so.3, needed by ../../../libtropter.so, not found (try using -rpath or -rpath-link)
/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/x86_64-pc-linux-gnu/binutils-bin/2.41/ld: warning: libColPack.so.0, needed by /tmp/shuber/avx2/opensim/4.5.1/iofbf-2023a/opensim_dependencies_install/adol-c/lib64/libadolc.so, not found (try using -rpath or -rpath-link)
/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/x86_64-pc-linux-gnu/binutils-bin/2.41/ld: ../../../libtropter.so: undefined reference to `IpoptApplicationFactory'
icpx: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Vendors/tropter/tests/CMakeFiles/test_derivatives.dir/build.make:104: test_derivatives] Error 1
@nickbianco
Copy link
Member

@saehuber, thanks for reporting. Before we start looking for CMake bugs, could you confirm that the opensim_dependencies_install folder contains ipopt and colpack folders. If not, you probably need to set OPENSIM_WITH_TROPTER=ON and OPENSIM_WITH_CASADI=ON when building the dependencies CMake project.

@saehuber
Copy link
Author

Thanks! Yes, ipopt and colpack both built correctly during the dependencies build and are in the opensim_dependencies_install folder.

@nickbianco
Copy link
Member

Okay good, thanks for checking that. A couple more questions/commnets:

  • Are you building off of the main branch or the directly from the 4.5.1 tag?
  • It looks like you're building off the Gentoo Linux distro? We have not done any testing with this distro ourselves, but note that we do build OpenSim on Ubuntu nightly via CI (GitHub Actions scripts here).
  • Have you tried using gcc or clang instead of icpx? Similarly, we have not done any testing with this compiler.

It is likely that the choice of distro and compiler are breaking the rpaths. If switching to Ubuntu or a different compiler is not an option for you, then @aymanhab or I could try to help sort out the rpath issue.

@aymanhab
Copy link
Member

I'd also add that we use patchelf to modify rpath on linux/ ubuntu.

@saehuber
Copy link
Author

saehuber commented Oct 29, 2024

Thanks, both. I've switched to gcc 12.3 but it's still failing with the same error; unfortunately switching distros is not an option. I'm building from the 4.5.1 tag. Let me know if there's more output that would be helpful in figuring out the rpaths issue.

@nickbianco
Copy link
Member

I think the next things to try are:

  1. Verify that libraries needed by tropter (libipopt.so.3 and libColPack.so.0) exist in the dependencies installation directory. And if so...
  2. Try running -rpath or -rpath-link, like the error messages suggest.

@aymanhab
Copy link
Member

Due to the long list of dependencies, are you sure you want to build tropter or moco altogether for your workflow?

@saehuber
Copy link
Author

Thanks for the recommendations, I've now tested and did manage to get past the error with adding the following to my CMake call:
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath-link,path/to/colpack/libdir:path/to/mumps/libdir:path/to/ipopt/libdir
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath-link,path/to/colpack/libdir:path/to/mumps/libdir:path/to/ipopt/libdir
It sounds like this is an issue specific to my setup so I'll close the issue now.

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

3 participants