DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.11k stars 256 forks source link

building lapack: MinGW in x64-windows failed. #846

Closed apemole closed 11 hours ago

apemole commented 3 days ago

Host Environment

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?

mmuetzel commented 2 days ago

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.

mmuetzel commented 2 days ago

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

mmuetzel commented 17 hours ago

Afaict, that issue was reported to the reference LAPACK project before. And people suggested the same workaround: https://github.com/Reference-LAPACK/lapack/issues/305#issuecomment-1979260536

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.