在IPOPT安装后使用MINGW64编译HSL时遇metis_nodend_未定义引用错误的解决求助
metis_nodend_ When Compiling HSL for IPOPT on MinGW64 The error you're hitting is a standard linker issue—your build is trying to use functions from the METIS graph partitioning library, but the linker can't find the required library files to resolve symbols like metis_nodend_. Here are actionable fixes tailored to your MinGW64 environment:
Option 1: Install and Link METIS Properly (Recommended)
METIS is a dependency for key HSL modules like MA57 and MC68. Let's get it set up correctly:
Install METIS via MSYS2 Package Manager
Open your MinGW64 terminal and run this command to install precompiled METIS:pacman -S mingw-w64-x86_64-metisThis will place the library and headers directly into your MinGW64 system paths.
Rebuild HSL with Detected METIS
Clean your existing build artifacts and reconfigure to let the build system pick up METIS:make clean ./configure makeThe configure script should automatically detect METIS and update the link commands to include the
-lmetisflag.Quick Fix for the Current Link Command
If you don't want to restart the full build, modify your existing link command to add-lmetisright after-lopenblas:gfortran -shared .libs/libcoinhsl-0.dll.def common/.libs/deps90.o common/.libs/deps.o common/.libs/dump.o mc19/.libs/mc19d.o ma27/.libs/ma27d.o ma28/.libs/ma28d.o ma57/.libs/ma57d.o hsl_ma77/.libs/hsl_ma77d.o hsl_ma77/C/.libs/hsl_ma77d_ciface.o hsl_ma86/.libs/hsl_ma86d.o hsl_ma86/C/.libs/hsl_ma86d_ciface.o hsl_mc68/C/.libs/hsl_mc68i_ciface.o hsl_ma97/.libs/hsl_ma97d.o hsl_ma97/C/.libs/hsl_ma97d_ciface.o loadmetis/.libs/loadmetis.o -L/mingw64/lib/ -lopenblas -lmetis -lpthread -lgfortran -O2 -Wl,-rpath -Wl,/mingw64/lib -o .libs/libcoinhsl-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libcoinhsl.dll.aRun this modified command, and the linker should resolve the missing symbols.
Option 2: Disable METIS Dependency (If You Don't Need It)
If you don't require METIS-based graph partitioning features in HSL, you can disable this dependency entirely:
- Reconfigure with METIS Disabled
This skips compiling METIS-dependent code, so the linker won't look for those symbols anymore.make clean ./configure --without-metis make
Why This Error Occurs
Your HSL build was configured to use METIS (either by default, because METIS headers were present during initial configure), but the final link command didn't include the -lmetis flag to link against the actual METIS library. The linker needs this flag to find and connect the missing function definitions.
内容的提问来源于stack exchange,提问作者Thomas




