Ipopt: Unable to load hsl solvers with ipopt 3.14.15
I have installed ipopt 3.14.15 with conda on Windows.
If I try to use a hsl linear solver, I get the following exception:
Exception of type: DYNAMIC_LIBRARY_FAILURE in file "D:\bld\ipopt_1712819048605\work\src\Common\IpLibraryLoader.cpp" at line 60:
Exception message: Error 87 while loading DLL libhsl.dll: The parameter is incorrect.
If I use the 3.14.14 version instead it works fine.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- try again with LoadLibrary if LoadLibraryExA failed, for #759 — committed to coin-or/Ipopt by svigerske 3 years ago
- change loadLibrary on Windows to LoadLibraryA + LoadLibraryExA - try LoadLibraryA first in any case - try LoadLibraryExA if that failed - print error from both, unless second failed with invalid pa... — committed to coin-or/Ipopt by svigerske 3 years ago
- use LoadLibraryExA for absolute paths to libs only - LoadLibraryExA with relative path and LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR gives an incorrect parameter error - LoadLibraryExA with relative path an... — committed to mcx/Ipopt by svigerske 3 years ago
Thanks @svigerske for the quick reply ! I backported the patch in conda binaries for 3.14.15 in https://github.com/conda-forge/ipopt-feedstock/pull/103, I also enable upload of test artifacts (see https://conda-forge.org/docs/maintainer/updating_pkgs/#downloading-prebuilt-packages-from-ci), so @S-Dafarra you can test if that PR solve your problem (just install with
conda install <downloaded_package>.condathe downloaded package).Unfortunately at the moment we are using a custom CMake script for ipopt mantained at https://github.com/conda-forge/ipopt-feedstock/blob/main/recipe/cmake/CMakeLists.txt . It would be great to be aligned with upstream, but to be honest I never looked into how to make autotools works with the rest of the Windows conda-forge machinery.
For what regards HSL’s dll, actually those are built with a fix we did to HSL’s upstream meson build system, we actually still need to report that fix upstream.
I have tested the version mentioned in https://github.com/conda-forge/ipopt-feedstock/pull/103#issuecomment-2067222479 and it also works with the default relative setting. Thanks a lot @svigerske and @traversaro for the super quick support!
By passing the absolute path using the
hslliboption, it worksThanks for the fix!
Sorry, I missed that comment. I am not sure how widespread those are, but I guess that check may be fail when using UNC or DOS device path (see https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths). Anyhow, I guess those are kind of seldomly used, and anyhow if they are used the normal
LoadLibraryAthat was used before 3.14.15 will be used, so I guess this is ok.In the next release,
LoadLibraryExAwithLOAD_LIBRARY_SEARCH_DLL_LOAD_DIRwill only be used iflibnameseems to be an absolute path. Otherwise, it will be as before 3.14.15, i.e.,LoadLibraryAis used.This seems to work on my system when specifying a library as absolute path or when having it in PATH.
CC @metab0t
Actually I had checked https://github.com/coin-or/Ipopt/pull/755 back when it was proposed, and it seemed fine. However, looking into the details of the documentation I noticed that in https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa it reads that if
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIRoption is used, “The lpFileName parameter must specify a fully qualified path.”. Perhaps this is the problem? @S-Dafarra can you try to pass the absolute path to thelibhsl.dll? If that is the case, I guess it make sense to use https://github.com/coin-or/Ipopt/commit/9a36a9ed0d19900cbc7553209de4d0207c731afa . Or perhaps we should check iflibnameis an absolute path, and just useLoadLibraryExAin that case?Hmm, one would think that this setup would work. I have no clue what it means by a parameter being incorrect.
An original suggestion in #755 was to try both
LoadLibrary(as in 3.14.14) andLoadLibraryExA(as in 3.14.15). I’ve done this in 9a36a9ed and here are windows DLLs: https://cloud.gams.com/s/PCZY3RnGKZj5bND If you like, you could try whether these work. I don’t know how the conda libraries are build.Damn it. The dynamic loading of libraries like HSL on Windows is the one thing that changed from 3.14.14 to 3.14.15 (#755).
Can you say more about your setup? Where do you have the HSL DLL located, from where do you run Ipopt, and do you have the path to the HSL DLL in the
PATHenvironment variable?