Multiple definitions of '_gfortran_[...]' in Windows

Post here if you have a question about the installation process

Multiple definitions of '_gfortran_[...]' in Windows

Postby adamalb » Mon Jul 23, 2018 3:54 pm

I am trying to install LAPACK for Windows using MinGW following the instructions in 'Easy Windows Build' - https://icl.cs.utk.edu/lapack-for-windows/lapack/
Ultimately I just want to be able to link LAPACk libraries to compilation in gfortran out of Visual Studio and without Intel compilers.
I consistently get this error when running 'make' from MinGW:

[ 44%] Linking Fortran shared library ..\bin\liblapack.dll
C:/mingw-w64/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:/mingw-w64/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:/mingw-w64/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:/mingw-w64/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:/mingw-w64/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:/mingw-w64/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
mingw32-make[2]: *** [SRC\CMakeFiles\lapack.dir\build.make:27686: bin/liblapack.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:163: SRC/CMakeFiles/lapack.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2


I am using the latest version of MinGW (.txt in folder says 'version : MinGW-W64-builds-4.3.5'), CMake 3.12.0 and LAPACK 3.8.0, although I have tried other LAPACK and MinGW versions with similar errors.
Switching between native compilers of 32 and 64 bits in CMake does not affect, I still get the same error.
I am building the files with CMake checking LAPACKE. Not checking its box gives the same error, but at stage [100%].
I am using Windows 10 Education.

What kind of error is this? Can I solve it myself? Is there any combination of program version that solve this issue?
adamalb
 
Posts: 1
Joined: Fri Jul 20, 2018 9:32 pm

Re: Multiple definitions of '_gfortran_[...]' in Windows

Postby poetlyu » Tue Jul 24, 2018 3:59 am

I've encountered completely the same problem as yours. I also tried different versions of Mingw or Lapack, it didn't work.
poetlyu
 
Posts: 1
Joined: Tue Jul 24, 2018 1:14 am

Re: Multiple definitions of '_gfortran_[...]' in Windows

Postby admin » Tue Jul 24, 2018 11:34 am

Did you try adding -lgfortran in your linking sequence?
Julie
admin
Site Admin
 
Posts: 616
Joined: Wed Dec 08, 2004 7:07 pm

Re: Multiple definitions of '_gfortran_[...]' in Windows

Postby yuzhoushenling » Wed Jul 25, 2018 9:35 pm

I have the same problem. My system is Win 10, how can I add -lgfortran? in which file?
yuzhoushenling
 
Posts: 1
Joined: Wed Jul 25, 2018 2:34 am

Re: Multiple definitions of '_gfortran_[...]' in Windows

Postby TsarpalisD » Mon Feb 25, 2019 7:25 pm

Hello Lapack community. I'm stuck in the same issue (I followed exactly the steps mentioned on "Easy Windows Build"). Admin could be please be more explanatory about adding -lgfortran in the linking sequence?
Thanks in advance
TsarpalisD
 
Posts: 1
Joined: Mon Feb 25, 2019 7:17 pm

Re: Multiple definitions of '_gfortran_[...]' in Windows

Postby kimumasamune » Sun Mar 03, 2019 12:57 pm

It solves by editing the next file created by Cmake.
..\SRC\CMakeFiles\lapack.dir\link.txt

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

ex.
...
C:\MinGW\bin\x86_64-w64-mingw32-gfortran.exe -O2 -DNDEBUG -O2 -shared -o ..\bin\liblapack.dll -Wl,--out-implib,..\lib\liblapack.dll.a -Wl,--major-image-version,3,--minor-image-version,8 -Wl,--whole-archive CMakeFiles\lapack.dir/objects.a -Wl,--no-whole-archive @CMakeFiles\lapack.dir\linklibs.rsp -Wl,--output-def,lapack.def
...


Please refer to the following site.
https://qiita.com/kimurap/items/756e7d38622cad34773b
kimumasamune
 
Posts: 1
Joined: Sun Mar 03, 2019 12:45 pm


Return to Installation

Who is online

Users browsing this forum: No registered users and 3 guests

cron