[CMake] 3.1 can't link my MinGW executables any more.

Bill Somerville bill at classdesign.com
Sat Nov 29 07:02:42 EST 2014


On 29/11/2014 11:58, Bill Somerville wrote:
> Hi,
>
> I have just tried 3.1.0-rc2 and my executable links are failing 
> because all the link libraries are not being added.
>
> I use:
>
> add_executable (jt65code lib/jt65code.f90 wsjtx.rc)
> target_link_libraries (jt65code wsjt)
>
> where wsjt is a static library target with Fortran and C functions. 
> This normally gives a link edit step of:
>
> C:\Tools\Qt\Tools\mingw48_32\bin\g++.exe   -Wall -Wextra -std=c++11 
> -fexceptions -frtti -pthread -g    -Wl,--whole-archive 
> CMakeFiles\jt65code.dir/objects.a -Wl,--no-whole-archive  -o 
> jt65code.exe -Wl,--out-implib,libjt65code.dll.a 
> -Wl,--major-image-version,0,--minor-image-version,0  libwsjt.a 
> -lgfortran -lquadmath -lm -lkernel32 -luser32 -lgdi32 -lwinspool 
> -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
>
> but in 3.1.0-rc2 I get:
>
> C:\Tools\Qt\Tools\mingw48_32\bin\ar.exe cr 
> CMakeFiles\jt65code.dir/objects.a @CMakeFiles\jt65code.dir\objects1.rsp
> C:\Tools\Qt\Tools\mingw48_32\bin\g++.exe   -Wall -Wextra -std=c++11 
> -fexceptions -frtti -pthread -g   -Wl,--whole-archive 
> CMakeFiles\jt65code.dir/objects.a -Wl,--no-whole-archive  -o 
> jt65code.exe -Wl,--out-implib,libjt65code.dll.a 
> -Wl,--major-image-version,0,--minor-image-version,0 
> @CMakeFiles\jt65code.dir\linklibs.rsp
>
> So it looks like the linklibs.rsp  response file doesn't have the 
> required entries.
>
> Looking at the build tree I find a linklibs.rsp in the top level 
> directory (CMakeFIles/jt65code.dir) with the correct entries but the 
> link edit command is passing a file in the subordinate 'lib' directory 
> that doesn't exist. Something wrong with the use of a source in a 
> subdirectory perhaps?
Sorry, I am talking rubbish here!

So something is wrong with the response file itself, here it is:

  libwsjt.a -lquadmath -lm -lkernel32 -luser32 -lgdi32 -lwinspool 
-lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

and the problem is in fact that -lgfortran is missing!
>
> Regards
> Bill Somerville.
Regards
Bill Somerville.


More information about the CMake mailing list