coin-or / Ipopt

COIN-OR Interior Point Optimizer IPOPT
https://coin-or.github.io/Ipopt
Other
1.41k stars 281 forks source link

Error installing Ipopt with HSL: Symbol '_metis_nodend_' not found #775

Closed ryan-david-murphy closed 3 months ago

ryan-david-murphy commented 3 months ago

I'm trying to install Ipopt with third-party HSL (CoinHSL.v2023.11.17.aarch64-apple-darwin-libgfortran5) libraries on macOS, but I'm encountering errors during the make test step. All tests are failing with the same error:

dyld[XXXXX]: symbol not found in flat namespace '_metis_nodend_'

Environment:

Steps to reproduce:

  1. Configured Ipopt with ../configure
  2. Ran sudo make
  3. Ran sudo make test

All tests failed with the same error. It seems that the '_metisnodend' symbol is missing, which suggests an issue with the METIS library integration.

Any guidance on resolving this issue would be greatly appreciated. Thanks

svigerske commented 3 months ago

METIS would be used by the HSL solvers, so maybe there is problem with these prebuild HSL libraries. Either they are missing METIS, or the METIS dependencies needs to be still installed.

CC @amontoison

amontoison commented 3 months ago

I don't have the computer with me but you should have a libmetis.dylib in the archive of CoinHSL.v2023.11.17. Maybe you need to update an environment variable like DYLD_LIBRARY_PATH on Mac?

amontoison commented 3 months ago

@ryan-david-murphy @svigerske I confirm that the precompiled archive contains libmetis.dylib. You probably need to update DYLD_FALLBACK_LIBRARY_PATH to add the path CoinHSL.v2023.11.17.aarch64-apple-darwin-libgfortran5/lib. Note that a more recent version is available (CoinHSL.v2024.5.15.aarch64-apple-darwin-libgfortran5.tar.gz).

ryan-david-murphy commented 3 months ago

Thanks @svigerske @amontoison -- apologies for the delayed reply.

Before reinstalling, I purged all files associated with Ipopt and HSL. I have now downloaded CoinHSL.v2024.5.15.aarch64-apple-darwin-libgfortran5.tar.gz.

I have now appended CoinHSL.v2024.5.15.aarch64-apple-darwin-libgfortran5.tar.gz/lib to DYLD_FALLBACK_LIBRARY_PATH, DYLD_LIBRARY_PATH and LD_LIBRARY_PATH in separate installation instances.

For all cases, I now encounter the following error:

Exception of type: DYNAMIC_LIBRARY_FAILURE in file "../../src/Common/IpLibraryLoader.cpp" at line 86:
 Exception message: dlopen(libhsl.dylib, 0x0002): tried: '~/Development/Ipopt-releases-3.14.16/build/src/.libs/libhsl.dylib' (no such file), 'libhsl.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibhsl.dylib' (no such file), '/usr/lib/libhsl.dylib' (no such file, not in dyld cache), 'libhsl.dylib' (no such file)

If I understand this correctly, the environment variables are not being recognised? (I have ensured that they are correct using echo).

Would you be able to suggest anything else? Thanks

amontoison commented 3 months ago

Coin-HSL cointains libcoinhsl.dylib and not libhsl.dylib so you didn't linked Ipopt correctly with your HSL library.

If you don't want to link libipopt.dylib with libcoinhsl.dylib, you can also provide the specific path of the HSL library at runtime.

ryan-david-murphy commented 3 months ago

For clarity, could you please explain the correct way to link Coin-HSL?

I have created a folder in $IPOPT_DIR called ThirdParty-HSL and simply copied and unzipped CoinHSL.v2024.5.15.aarch64-apple-darwin-libgfortran5.tar.gz in ThirdParty-HSL and renamed it to coinhsl.

I then run the same commands as detailed above.

ryan-david-murphy commented 3 months ago

I resolved this issue by following these steps:

1) Clone the repository: git clone https://github.com/coin-or-tools/ThirdParty-HSL

2) Move coinhsl-2024.05.15.tar.gz into the cloned directory, unzip it, and rename the folder to coinhsl.

3) Compile using Homebrew's Metis: ./configure --with-metis-cflags="-I/opt/homebrew/Cellar/metis/5.1.0/include" --with-metis-lflags="-L/opt/homebrew/Cellar/metis/5.1.0/lib -lmetis" make make install

4) To install IPOPT using Homebrew's LLVM Clang compiler (to avoid the 'unsupported option -fopenmp' error), set the following environment variables: export CC="/opt/homebrew/opt/llvm/bin/clang" export CXX="/opt/homebrew/opt/llvm/bin/clang++" export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

Then proceed with the IPOPT installation as detailed above.

svigerske commented 3 months ago

Exception message: dlopen(libhsl.dylib, 0x0002): tried: '~/Development/Ipopt-releases-3.14.16/build/src/.libs/libhsl.dylib' (no such file), 'libhsl.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibhsl.dylib' (no such file), '/usr/lib/libhsl.dylib' (no such file, not in dyld cache), 'libhsl.dylib' (no such file)

Replace ~ by $HOME when setting DYLD_LIBRARY_PATH. ~ is interpreted by shells, not by the linker.

ryan-david-murphy commented 3 months ago

The full path is generated.

To obscure the full path for privacy, I replaced it with ~

amontoison commented 3 months ago

@svigerske Should we add a note about ThirdParty-HSL in the next release of Coin-HSL? I thought that it was not needed anymore with the new Meson build system but a lot of users still rely on it.

svigerske commented 3 months ago

What should the note say?

I don't know how Coin-HSL's own buildsystem integrate with the COIN-OR projects that rely on the autotools/BuildTools. I cannot just download current Coin-HSL anymore due to its now very strict license requirements (just doing academic work isn't enough; you now have to confirm to be employed by an academic institution, or be a student there). I haven't had a reason to move away from ThirdParty-HSL. Also, I don't have meson.