MantisBT - CMake
View Issue Details
0010222CMakeCMakepublic2010-02-01 15:582016-06-10 14:31
Daniel Richard G. 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-8 
 
0010222: Default linker flags fail with Intel 9.0 C/C++ compiler (icl)
I am using CMake 2.8.0 with the Intel 9.0 C/C++ compiler:

C:\>icl
Intel(R) C++ Compiler for Intel(R) EM64T-based applications, Version 9.0 Build 20060222 Package ID: W_CC_C_9.0.030
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

If I configure the Hello example from the CMake sources, I get the following:

----begin CMake invocation----
C:\work\Hello-build>c:\tmp\cmake-2.8.0-win32-x86\bin\cmake.exe -G"NMake Makefiles" -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl ..\Hello
-- The C compiler identification is Intel
-- The CXX compiler identification is Intel
-- Check for working C compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe
-- Check for working C compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe -- broken
CMake Error at C:/tmp/cmake-2.8.0-win32-x86/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):
  The C compiler "C:/Program Files
  (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe" is not able to compile a
  simple test program.

  It fails with the following output:

   Change Dir: C:/work/Hello-build/CMakeFiles/CMakeTmp



  Run Build Command:nmake /NOLOGO "cmTryCompileExec\fast"

      nmake -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L
  CMakeFiles\cmTryCompileExec.dir\build

      C:\tmp\cmake-2.8.0-win32-x86\bin\cmake.exe -E cmake_progress_report
  C:\work\Hello-build\CMakeFiles\CMakeTmp\CMakeFiles 1

  Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj

      C:\PROGRA~2\Intel\Compiler\C__~1\9.0\EM64T\Bin\icl.exe
  @C:\DOCUME~1\cport\LOCALS~1\Temp\1\nm94.tmp

  testCCompiler.c

  Linking C executable cmTryCompileExec.exe

      C:\tmp\cmake-2.8.0-win32-x86\bin\cmake.exe -E vs_link_exe
  C:\PROGRA~2\Intel\Compiler\C__~1\9.0\EM64T\Bin\icl.exe /nologo
  @C:\DOCUME~1\cport\LOCALS~1\Temp\1\nm95.tmp

  (0): internal error: backend signals



  icl: error: problem during multi-file optimization compilation (code 4)

  LINK Pass 1 failed. with 4

  NMAKE : fatal error U1077:
  'C:\tmp\cmake-2.8.0-win32-x86\bin\cmake.exe' : return code
  '0xffffffff'

  Stop.

  NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Platform
  SDK\Bin\nmake.exe"' : return code '0x2'

  Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):



-- Configuring incomplete, errors occurred!
----end CMake invocation----

(Note: I am specifying CMAKE_C_COMPILER and CMAKE_CXX_COMPILER because MSVC's cl.exe is also in my PATH, and CMake defaults to that unless I specify otherwise.)

If I edit CMake's Windows-icl.cmake file, and change the value of CMAKE_EXE_LINKER_FLAGS_INIT to include /INCREMENTAL:NO instead of /INCREMENTAL:YES (or no /INCREMENTAL option at all), then everything works correctly:

----begin CMake invocation----
C:\work\Hello-build>c:\tmp\cmake-2.8.0-win32-x86\bin\cmake.exe -G"NMake Makefiles" -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl ..\Hello
-- The C compiler identification is Intel
-- The CXX compiler identification is Intel
-- Check for working C compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe
-- Check for working C compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/Compiler/C++/9.0/EM64T/Bin/icl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cygwin/tmp/Hello-build
----end CMake invocation----

It's that /INCREMENTAL:YES option that screws everything up.
No tags attached.
related to 0010225closed Bill Hoffman Cannot override CMAKE_EXE_LINKER_FLAGS_INIT with CMAKE_USER_MAKE_RULES_OVERRIDE + Intel compiler 
txt trycompile.txt (4,327) 2010-02-02 12:30
https://public.kitware.com/Bug/file/2843/trycompile.txt
Issue History
2010-02-01 15:58Daniel Richard G.New Issue
2010-02-01 16:28Bill HoffmanStatusnew => assigned
2010-02-01 16:28Bill HoffmanAssigned To => Bill Hoffman
2010-02-02 11:02Bill HoffmanNote Added: 0019434
2010-02-02 12:30Daniel Richard G.Note Added: 0019438
2010-02-02 12:30Daniel Richard G.File Added: trycompile.txt
2010-02-02 16:12Bill HoffmanNote Added: 0019442
2010-02-02 16:36Daniel Richard G.Note Added: 0019443
2010-02-02 17:36Bill HoffmanNote Added: 0019444
2010-02-02 17:38Bill HoffmanNote Added: 0019445
2010-02-02 19:30Daniel Richard G.Note Added: 0019448
2010-02-04 09:00Bill HoffmanRelationship addedrelated to 0010225
2016-06-10 14:27Kitware RobotNote Added: 0041651
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0019434)
Bill Hoffman   
2010-02-02 11:02   
Can you run with --debug-trycompile?

Then run make VERBOSE=1 in the CMakeFiles/CMakeTmp directory.

Also, change Platforms/Windows.cmake : uncomment the following:


# uncomment these out to debug nmake and borland makefiles
#SET(CMAKE_START_TEMP_FILE "")
#SET(CMAKE_END_TEMP_FILE "")
#SET(CMAKE_VERBOSE_MAKEFILE 1)

Then send the output.
(0019438)
Daniel Richard G.   
2010-02-02 12:30   
I am attaching an output file prepared as you requested.

I tried editing away the /INCREMENTAL:YES option in CMakeFiles/CMakeTmp/CMakeFiles/cmTryCompileExec.dir/build.make, but it still gets passed to the compiler. Even if I edit it out of CMakeFiles/CMakeTmp/CMakeCache.txt, it _still_ gets passed! So apparently, even though /INCREMENTAL:YES is no longer present in any file (other than error logs) specific to the TRY_COMPILE() test, the flag is still finding its way in there and causing the test to fail.

u@h:/cygdrive/c/work/Hello-build$ grep -Rli INCREMENTAL:YES CMakeFiles
CMakeFiles/CMakeError.log
CMakeFiles/CMakeTmp/CMakeFiles/CMakeError.log
(0019442)
Bill Hoffman   
2010-02-02 16:12   
Can you try and run this by hand:

C:\PROGRA~2\Intel\Compiler\C__~1\9.0\EM64T\Bin\icl.exe /W3 /Zm1000 /GX /GR
  /MD /O2 "CMakeFiles\cmTryCompileExec.dir\testCXXCompiler.cxx.obj"
  /FecmTryCompileExec.exe -link /implib:cmTryCompileExec.lib /STACK:10000000
  /INCREMENTAL:YES /subsystem:console kernel32.lib user32.lib gdi32.lib
  winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
  uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib

I want to see if we can get icl to crash on the link without CMake, and then work backwards to figure out what we are doing that would cause it to die. For what it is worth we are running icl-11.1 32 bit and 64 bit on the nightly CMake dashboards with no problems....
(0019443)
Daniel Richard G.   
2010-02-02 16:36   
The command line you gave me works correctly.

I should add that, prior to filing this bug, I did some investigation on this, and found that the same compiler invocation that failed in CMake would work correctly when run by hand in CMD. I ran the compiler through a batch wrapper script that would write out all the environment variables into a file, both in CMake and by hand, and found some minor differences---but even if I adjusted the program environment in the wrapper under CMake to exactly match that when run by hand, the link error _still_ happened.

I don't know how else the two execution environments could differ that would make a difference to the compiler. As it is, this looks like a compiler bug. (I don't suppose you have an Intel support account that would let you download version 9.0?)
(0019444)
Bill Hoffman   
2010-02-02 17:36   
What if you run it with the RC command as well:

1. Remove all but testCXXCompiler.cxx.obj

2. run this RC command

C:/Program Files/Microsoft Platform SDK/Bin/RC.Exe
  /focmTryCompileExec.exe.embed.manifest.res
  cmTryCompileExec.exe.resource.txt

3. run this link command:

  C:\PROGRA~2\Intel\Compiler\C__~1\9.0\EM64T\Bin\icl.exe /W3 /Zm1000 /GX /GR
  /MD /O2 CMakeFiles\cmTryCompileExec.dir\testCXXCompiler.cxx.obj
  /FecmTryCompileExec.exe -link /implib:cmTryCompileExec.lib /STACK:10000000
  /INCREMENTAL:YES /subsystem:console kernel32.lib user32.lib gdi32.lib
  winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
  uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /MANIFEST
  /MANIFESTFILE:cmTryCompileExec.exe.intermediate.manifest
  cmTryCompileExec.exe.embed.manifest.res

It may have something to do with the manifest files. Perhaps it does not like the empty resource file that is initially created...
(0019445)
Bill Hoffman   
2010-02-02 17:38   
http://docs.google.com/viewer?a=v&q=cache:ZT2W5cckx_AJ:software.intel.com/file/15355+incremental+manifest+icl:+error:+problem+during+multi-file+optimization+compilation+%28code+4%29&hl=en&gl=us&sig=AHIEtbT0NipPtw77xHgNtq1Jr-kq6bwyjA [^]

Says this:

Manifests in Visual Studio 2005
Manifests are a Visual Studio 2005 feature and are XML files that describe run-
time dependencies of a buiit application. The Intel C++ Compiler supports
generation of manifest files, which are typically placed alongside the EXE or DLL
with a file type of .manifest. Manifest files can also be embedded in the EXE or
DLL, but this is not done if incremental linking is enabled. In such situations, you
will see the following warning:
Warning: Manifest file not embedded because incremental
linking property is specified. To embed manifest file, set
"Linker>General>Enable Incremental Linking" to "No".


It maybe that 9.1 can not support embedded manifests
(0019448)
Daniel Richard G.   
2010-02-02 19:30   
I think you may be onto something here. I recreated the .res file using that RC invocation, and then...

C:\work\Hello-build\CMakeFiles\CMakeTmp>C:\PROGRA~2\Intel\Compiler\C__~1\9.0\EM64T\Bin\icl.exe /W3 /Zm1000 /GX /GR /MD /O2 CMakeFiles\cmTryCompileExec.dir\testCXXCompiler.cxx.obj /FecmTryCompileExec.exe -link /implib:cmTryCompileExec.lib /STACK:10000000 /INCREMENTAL:YES /subsystem:console kernel32.lib user32.libgdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /MANIFEST /MANIFESTFILE:cmTryCompileExec.exe.intermediate.manifest cmTryCompileExec.exe.embed.manifest.res
Intel(R) C++ Compiler for Intel(R) EM64T-based applications, Version 9.0 Build 20060222 Package ID: W_CC_C_9.0.030
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

(0): internal error: backend signals

icl: error: problem during multi-file optimization compilation (code 4)


If I take out that final argument (the .res file) then it links correctly.
(0041651)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.