Undefined references to gfortran functions when using LAPACK

Open discussion regarding features, bugs, issues, vendors, etc.

Undefined references to gfortran functions when using LAPACK

Postby WFrane » Fri Feb 25, 2011 5:40 pm

Hello,

I've just started used LAPACK with MinGW on Windows XP in C++. I'm able to use some functions (e.g., dgesv) without any problems, but attempting to use others (e.g., dgeqrf) results in compiler errors related to gfortran functions. I've included the build commands for my test program below as well as some of the errors.
Code: Select all
mingw32-g++.exe -Wall -fexceptions  -g     -c "C:\Documents and Settings\WFrane\My Documents\C++ code\lapack_test\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe  -o bin\Debug\lapack_test.exe obj\Debug\main.o    "C:\Documents and Settings\WFrane\My Documents\Downloads\GotoBLAS2\libgoto2_opteronp-r1.13.lib" "C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a"
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(ilaenv.o):ilaenv.f:(.text+0x23a): undefined reference to `_gfortran_compare_string'
(... More undefined reference errors for _gfortran_compare_string ...)
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(ilaenv.o):ilaenv.f:(.text+0x30b): undefined reference to `_gfortran_compare_string'
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(ilaenv.o):ilaenv.f:(.text+0x333): more undefined references to `_gfortran_compare_string' follow
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(dlarft.o):dlarft.f:(.text+0x40b): undefined reference to `dgemv_'
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(dlarft.o):dlarft.f:(.text+0x48d): undefined reference to `dtrmv_'
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(dlarfb.o):dlarfb.f:(.text+0x222): undefined reference to `dcopy_'
C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a(dlarfb.o):dlarfb.f:(.text+0x2a7): undefined reference to `dtrmm_'
(... etc...)


This seems to point to a problem related to how I built lapack_WIN32.a, so I've included the steps I used to set up BLAS and LAPACK below (I've italicized file and folder names and put lines within individual files in bold).


Any assistance would be appreciated; I'm not particularly experienced with the use of makefiles, so I suspect I omitted something in the make.inc file for LAPACK.

Thanks!

William
WFrane
 
Posts: 2
Joined: Thu Feb 24, 2011 1:03 pm

Re: Undefined references to gfortran functions when using LA

Postby WFrane » Mon Feb 28, 2011 11:23 am

Hello,

It turned out to be a simple matter of adding -lgfortran to the build command for my test program (I thought I had tried this already when I first posted, but I realized I had made an error) and reversing the order of the LAPACK and GotoBLAS2 libraries. To be specific, I changed
Code: Select all
mingw32-g++.exe  -o bin\Debug\lapack_test.exe obj\Debug\main.o    "C:\Documents and Settings\WFrane\My Documents\Downloads\GotoBLAS2\libgoto2_opteronp-r1.13.lib" "C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a"
to
Code: Select all
mingw32-g++.exe  -o bin\Debug\lapack_test.exe obj\Debug\main.o    "C:\Documents and Settings\WFrane\My Documents\Downloads\lapack-3.3.0\lapack_WIN32.a" "C:\Documents and Settings\WFrane\My Documents\Downloads\GotoBLAS2\libgoto2_opteronp-r1.13.lib" -lgfortran

So the problem wasn't actually due to how I'd made LAPACK.

Sorry for the unnecessary post!

William
WFrane
 
Posts: 2
Joined: Thu Feb 24, 2011 1:03 pm


Return to User Discussion

Who is online

Users browsing this forum: Bing [Bot] and 6 guests

cron