You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译ARPACK时大量源文件未编译,求编译器选择建议

ARPACK Compilation & Compiler Choice for Fortran 90 on Windows 10

Hey there! Let's tackle your two key questions—compiler selection for ARPACK, and fixing the "massive source files not compiled" issue—since you're working with VS2017, Intel Fortran (ifort), and MKL on 64-bit Windows 10.

1. Should I use gfortran or ifort to compile ARPACK? Are there differences?

First off, both compilers work for ARPACK, but there are practical differences tied to your existing setup:

  • Intel Fortran (ifort) + MKL: This is your best bet right now, given you already have VS2017, ifort, and MKL set up.
    • ARPACK relies on BLAS/LAPACK, and MKL provides highly optimized implementations of these libraries—so linking ARPACK with MKL will give you great performance.
    • ifort has excellent compatibility with older Fortran standards (ARPACK has significant Fortran 77 code) and integrates seamlessly with your Visual Studio workflow. You can easily add the compiled ARPACK library to your Fortran 90 projects in VS.
  • gfortran (via MSYS2/MinGW-w64): This is a solid open-source alternative, but it’s better suited if you want to stick to a fully free toolchain.
    • MSYS2 even has pre-built ARPACK packages you can install directly with pacman -S mingw-w64-x86_64-arpack—skipping the hassle of manual compilation entirely.
    • The catch: Mixing gfortran-compiled libraries with ifort projects can lead to linking errors (due to different compiler ABIs). If you go this route, you’ll likely need to compile your entire Fortran 90 codebase with gfortran too.

In terms of core functionality? No difference—ARPACK’s eigenvalue solvers will behave the same regardless of which compiler you use. The choice comes down to your existing toolchain and whether you prioritize seamless VS integration or open-source freedom.

2. Fixing "massive source files not compiled" during ARPACK build

Most of the time, this issue stems from a misconfigured build script (makefile) that doesn’t match your compiler or platform. Here’s how to troubleshoot:

  • Adapt the ARPACK makefile for ifort:
    The default ARPACK makefile is often set up for Unix compilers or gfortran. Open the makefile and adjust these key settings:

    FC = ifort
    FFLAGS = -O2 -warn all -DMKL_ILP64  # Add MKL defines if using MKL
    BLAS_LIBS = -L"$(MKLROOT)/lib/intel64" -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm
    LAPACK_LIBS = $(BLAS_LIBS)  # MKL includes LAPACK, so reuse BLAS links
    

    Make sure MKLROOT is set correctly (it should be automatically set in the VS Developer Command Prompt).

  • Verify 64-bit platform alignment:
    Ensure the makefile is targeting 64-bit Windows. Look for flags like -m64 (for gfortran) or confirm that ifort is set to compile 64-bit code (in VS, this is under Project Properties > Platform > x64).

  • Use CMake for simpler configuration:
    If manual makefile edits feel tedious, use CMake to generate a VS solution or makefile tailored to your environment:

    1. Create a build directory inside the ARPACK source folder.
    2. Run cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_Fortran_COMPILER=ifort -DARPACK_USE_MKL=ON in the build directory.
    3. Open the generated .sln file in VS, or run cmake --build . to compile directly.
  • Check build output for specific errors:
    When you run make or build in VS, look for specific error messages (e.g., "file not found", "undefined reference"). Common issues include missing source file paths, incorrect include directories, or missing BLAS/LAPACK links. Fix those specific issues first—they’re usually the root cause of uncompiled files.


内容的提问来源于stack exchange,提问作者Kai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:35:31