You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

在IPOPT安装后使用MINGW64编译HSL时遇metis_nodend_未定义引用错误的解决求助

Fixing Undefined Reference to 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:

METIS is a dependency for key HSL modules like MA57 and MC68. Let's get it set up correctly:

  1. Install METIS via MSYS2 Package Manager
    Open your MinGW64 terminal and run this command to install precompiled METIS:

    pacman -S mingw-w64-x86_64-metis
    

    This will place the library and headers directly into your MinGW64 system paths.

  2. Rebuild HSL with Detected METIS
    Clean your existing build artifacts and reconfigure to let the build system pick up METIS:

    make clean
    ./configure
    make
    

    The configure script should automatically detect METIS and update the link commands to include the -lmetis flag.

  3. Quick Fix for the Current Link Command
    If you don't want to restart the full build, modify your existing link command to add -lmetis right 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.a
    

    Run 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:

  1. Reconfigure with METIS Disabled
    make clean
    ./configure --without-metis
    make
    
    This skips compiling METIS-dependent code, so the linker won't look for those symbols anymore.

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

火山引擎 最新活动