DrTimothyAldenDavis/SuiteSparse

building lapack: MinGW in x64-windows failed.

Closed this issue · 3 comments

Host Environment

  • OS: windows 10
  • Compiler: MinGW

After configuring done and Generating done in cmake ,i failed when input ‘’D:\MinGW\mingw64\bin\mingw32-make.exe'' in cmd window.

Failure logs
[ 50%] Building Fortran object SRC/CMakeFiles/lapack.dir/zgedmdq.f90.obj
[ 50%] Linking Fortran shared library ..\bin\liblapack.dll
D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(string_intrinsics.o):(.text$_gfortran_concat_string+0x0): multiple definition of _gfortran_concat_string' ../lib/libblas.dll.a(d000008.o):(.text+0x0): first defined here D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(string_intrinsics.o):(.text$_gfortran_string_len_trim+0x0): multiple definition of _gfortran_string_len_trim'
../lib/libblas.dll.a(d000038.o):(.text+0x0): first defined here
D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(transfer.o):(.text$_gfortran_transfer_integer_write+0x0): multiple definition of _gfortran_transfer_integer_write' ../lib/libblas.dll.a(d000058.o):(.text+0x0): first defined here D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(transfer.o):(.text$_gfortran_transfer_character_write+0x0): multiple definition of _gfortran_transfer_character_write'
../lib/libblas.dll.a(d000053.o):(.text+0x0): first defined here
D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(transfer.o):(.text$_gfortran_st_write+0x0): multiple definition of _gfortran_st_write' ../lib/libblas.dll.a(d000032.o):(.text+0x0): first defined here D:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/libgfortran.a(transfer.o):(.text$_gfortran_st_write_done+0x0): multiple definition of _gfortran_st_write_done'
../lib/libblas.dll.a(d000033.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: [SRC\CMakeFiles\lapack.dir\build.make:29048: bin/liblapack.dll] Error 1
mingw32-make[1]: [CMakeFiles\Makefile2:448: SRC/CMakeFiles/lapack.dir/all] Error 2
mingw32-make: [Makefile:155: all] Error 2

How can i solve this issue?

Where did you get your libblas.dll from? Iiuc, it shouldn't export the symbols from the GFortran library. Maybe, the linker that was used to produce that library is broken or it was invoked incorrectly?

Anyway, it might be possible to work around the issue with your (faulty) BLAS library by adding -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition" to your CMake configure flags.

However, it might be better to track down why your BLAS library is exporting those symbols and fix that.

Looking at the output again: Are you sure you are reporting this to the correct project?
Could it be that the error occurs while you are building the reference implementation of the LAPACK library (and not the SuiteSparse libraries)?
In that case, it might be better to contact that project if you have questions about their build system: https://github.com/Reference-LAPACK/lapack

Afaict, that issue was reported to the reference LAPACK project before. And people suggested the same workaround:
Reference-LAPACK/lapack#305 (comment)

I agree with the last commenter there that that issue should better be fixed instead of using that workaround (in every Fortran project that links to that BLAS library)...

In any case: This is not an issue in SuiteSparse. So, this could probably be closed.