View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010913CMakeCMakepublic2010-06-30 04:462010-09-10 00:06
ReporterIvar Gaitan 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.3Fixed in VersionCMake 2.8.3 
Summary0010913: Try_compile fails when generating MinGW Makefiles
DescriptionResponse files (i.e. -Wl,@ option) in MinGW does not work with version 2.16 of ld.exe. When switching to ld.exe version 2.20, everything works ok.


Specifically, the following line fails:

C:\...\CMakeTmp>gcc.exe -Wl,@CMakeFiles\cmTryCompileExec.dir\objects1.rsp -o cmTryCompileExec.exe -Wl,--out-implib,libcmTryCompileExec.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
ld.exe: @CMakeFiles\cmTryCompileExec.dir\objects1.rsp: No such file: No such file or directory
collect2: ld returned 1 exit status
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0021193)
Ivar Gaitan (reporter)
2010-06-30 04:51

This is related to issue 0010401
(0021383)
Brad King (manager)
2010-07-13 10:01

What "--help" output does each version of ld provide? Does the output also appear through "gcc --help" or "gcc -v --help"? Perhaps we can detect whether the response file syntax is supported.
(0021662)
Ivar Gaitan (reporter)
2010-08-05 10:11

With respect to '@FILE' they give identical outputs.

"gcc --help" doesn't mention it and "gcc -v --help" just echos the ld.exe help output.


======
C:\...\mingw\mingw32\bin>ld_2.16.exe --help
Usage: ld_2.16.exe [options] file...
Options:
  [...]
  @FILE Read options from FILE


C:\...\mingw\mingw32\bin>ld_2.20.exe --help
Usage: ld_2.20.exe [options] file...
Options:
  [...]
  @FILE Read options from FILE
(0021664)
Brad King (manager)
2010-08-05 10:32

So the ld 2.16 help says that the option is supported, but it does not work?
(0021665)
Ivar Gaitan (reporter)
2010-08-05 10:34

Yes, just double checked.


C:\...\mingw\mingw32\bin>ld_2.16.exe -v
GNU ld version 2.16.91 20060119
(0021666)
Brad King (manager)
2010-08-05 10:50

Okay, take a look at Modules/Platform/Windows-GNU.cmake for the code

  set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
  set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@")

Try adding this:

  execute_process(
    COMMAND ld -v
    OUTPUT_VARIABLE _help
    ERROR_VARIABLE _help
    )
  if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]")
    set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 0)
  endif()
(0021685)
Ivar Gaitan (reporter)
2010-08-06 05:58

That does the trick!
(0021686)
Brad King (manager)
2010-08-06 09:42

Great, thanks for testing it. I've published a similar fix:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b03f4ec0 [^]

 Issue History
Date Modified Username Field Change
2010-06-30 04:46 Ivar Gaitan New Issue
2010-06-30 04:51 Ivar Gaitan Note Added: 0021193
2010-07-13 09:22 Bill Hoffman Status new => assigned
2010-07-13 09:22 Bill Hoffman Assigned To => Brad King
2010-07-13 10:01 Brad King Note Added: 0021383
2010-08-05 10:11 Ivar Gaitan Note Added: 0021662
2010-08-05 10:32 Brad King Note Added: 0021664
2010-08-05 10:34 Ivar Gaitan Note Added: 0021665
2010-08-05 10:50 Brad King Note Added: 0021666
2010-08-06 05:58 Ivar Gaitan Note Added: 0021685
2010-08-06 09:42 Brad King Note Added: 0021686
2010-08-06 09:42 Brad King Status assigned => closed
2010-08-06 09:42 Brad King Resolution open => fixed
2010-09-10 00:06 David Cole Fixed in Version => CMake 2.8.3
2010-09-10 00:06 David Cole Target Version => CMake 2.8.3


Copyright © 2000 - 2018 MantisBT Team