Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error while building LAPACK 3.8.0 with MinGW-W64 8.1.0 #305

Closed
jdx-gh opened this issue Nov 20, 2018 · 3 comments
Closed

Linking error while building LAPACK 3.8.0 with MinGW-W64 8.1.0 #305

jdx-gh opened this issue Nov 20, 2018 · 3 comments

Comments

@jdx-gh
Copy link

jdx-gh commented Nov 20, 2018

[  3%] Linking Fortran shared library ../bin/liblapack.dll
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
c:/Tools/MinGW-W64/i686-8.1.0-win32-sjlj-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-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
make[2]: *** [bin/liblapack.dll] Error 1
make[1]: *** [SRC/CMakeFiles/lapack.dir/all] Error 2
make: *** [all] Error 2 

Everything is fine when LAPACK is built with MinGW-W64 6.3.0. One significant difference I have noticed is that 8.1.0 has only static libgfortran, while 6.3.0 has both, and shared version is used by default.

@JohnLErvin
Copy link

JohnLErvin commented Jun 11, 2020

Verified this issue with MinGW 8.1.0 and LAPACK 3.9.0. Found a solution here.

After running CMake, open the SRC\CMakeFiles\lapack.dir\link.txt in the build directory

Add the following sentence as an option of x86_64-w64-mingw32-gfortran.exe:
-Wl,--allow-multiple-definition

Just paste it at the end, was a long line in the third line of the link.txt file.

@weslleyspereira
Copy link
Collaborator

Solution in #305 (comment)

@atsju
Copy link

atsju commented Mar 5, 2024

@weslleyspereira I don't get why this has been closed. This should be fixed from within Lapack repository cmake configuration. Not by letting the user fix a bad build configuration.

For other people passing by here. Do not modify link.txt that is a file generated by cmake and should not be modified manually. Prefer instead setting CMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition". You can do it from command line or cmake-gui

Full command line example : cmake -G "MinGW Makefiles" -S lapack -B build_lapack -D BUILD_SHARED_LIBS=ON -D CMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants