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

在Windows10 64位MSYS2环境下使用BLAS、LAPACK、ARPACK的编译咨询

Fixing gfortran Compilation Issues with dgelsx.f in MSYS2 MinGW64

Hey there, let's troubleshoot this compilation problem step by step. Since you're using OpenBLAS/LAPACK instead of Intel MKL (the original environment for that example), the main issues likely revolve around library linking or source code compatibility. Here's what you can try:

1. Correct Your Compilation Command

The most common mistake is not linking the required libraries, or using the wrong order (gfortran requires libraries to come after the source file). Use this command instead:

gfortran dgelsx.f -o dgelsx -llapack -lopenblas

If you want to make sure you're using the right library paths, use pkg-config to auto-generate the linker flags:

# First verify pkg-config can find your libraries
pkg-config --libs lapack openblas
# Then compile with those flags
gfortran dgelsx.f -o dgelsx $(pkg-config --libs lapack openblas)

2. Remove MKL-Specific Dependencies from the Source

The dgelsx.f example from MKL might have hardcoded references to MKL's LAPACK interface. Open the file and check for lines like:

USE MKL_LAPACK
If you find this, replace it with:

USE LAPACK

Or comment it out entirely—this will tell the compiler to use the open-source LAPACK library you installed instead of MKL's version.

3. Verify Your Library Installation

Double-check that your OpenBLAS and LAPACK packages are fully installed and not corrupted:

pacman -S --reinstall mingw-w64-x86_64-openblas mingw-w64-x86_64-lapack

4. Ensure You're Using the Correct Terminal

Make sure you're running the MinGW64 Terminal (not the regular MSYS Terminal) when compiling. This terminal automatically sets up the correct environment variables for the 64-bit MinGW toolchain, so gfortran can find your installed libraries without extra path configuration.

If you still run into errors, share the exact error message you're getting, and we can narrow it down further!

内容的提问来源于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:57:27