mechmotum / cyipopt

Cython interface for the interior point optimzer IPOPT
Eclipse Public License 2.0
229 stars 54 forks source link

Conda Forge binaries with HSL: undefined symbol: metis_nodend_ #192

Closed CYDXYYJ closed 1 year ago

CYDXYYJ commented 1 year ago

The current installation tutorial will result in an error that is _undefined symbol: metis_nodend__. Concretely, I found that direct compile and install coinhsl package cannot make sense. Instead, utilizing the ThirdParty-HSL can generate a feasible dynamic library libcoinhsl.so. The details are provided as follows:

$ git clone https://github.com/coin-or-tools/ThirdParty-HSL.git
$ cd ThirdParty-HSL

Now unpack the Coin-HSL sources archive, move and rename the resulting directory so that it becomes ThirdParty-HSL/coinhsl. Then, in ThirdParty-HSL, configure, build, and install the HSL sources:

$ ./configure
$ make
$ sudo make install

Then, link them.

$ sudo ln -s /usr/local/lib/libcoinhsl.so ~/miniconda/env/hsl-test/lib/libcoinhsl.so

moorepants commented 1 year ago

If I understand, the instructions should be changed to use the git repo you linked to build a binary for HSL instead of simply using the instructions in the HSL binary. Is that correct?

CYDXYYJ commented 1 year ago

Yes, it is right. Moreover, as reflected by IPOPT official installation tutorial
ThirdParty-HSL will look automatically for a METIS installation in your system and should work with both METIS 4 and METIS 5, from which I think that this repo can deal with this error. Nonetheless, the detailed method I proposed above may be not a perfect one as it needs to install some other dynamic library such as Fortran, etc..

moorepants commented 1 year ago

The method we currently have ensures that you link HSL against the same binaries that Ipopt is linked against. This may not be entirely necessary but often is. Maybe there are config options in the repo that you link which we can also do that. I wonder if this issue is because Metis is newly version 5 in conda forge? I didn't have this issue before when I made the documentation instructions.

CYDXYYJ commented 1 year ago

I highly agree with you that you can do a similar thing based on the repo I propose. Towards the exact reason, I have a similar suspicion as you since the elder version of HSL can make sense, e.g., 2021 version.