[CMake] CXX_COMPILER_FLAGS also passed to the linker?

Mike Jackson mike.jackson at imts.us
Wed Jan 3 00:05:57 EST 2007



On Jan 2, 2007, at 5:08 PM, Bill Hoffman wrote:

> Mike Jackson wrote:
>> I am using the intel c++ compiler for OS X and I am trying to  
>> shutoff some remarks that the compiler kicks out. According to the  
>> Intel Docs if I pass "-wd[RemarkNum],[RemarkNum]..." to the  
>> compiler I can shutoff what I want.
>>   So I fired up ccmake and set the CMAKE_CXX_FLAGS to "-wd981" and  
>> then ran make. The compile proceeds file (without the remarks)  
>> until the link phase. The linker is dying because "d981" is being  
>> passed to the linker which is not right. Is this a bug in CMake or  
>> am I not using ccmake correctly?
>>
>>
>> /usr/bin/icpc   -DHDFWrapper_EXPORTS -wd981 -I/usr/local/include/ 
>> boost-1_33_1 -I/Users/mjackson/Task_7/Workspace/PFImport/src -I/ 
>> Users/mjackson/Task_7/Workspace/PFImport/.. -I/Developer/Headers/ 
>> FlatCarbon -I/Users/mjackson/Task_7/Workspace/MHDataModel/.. -I/ 
>> Users/mjackson/Task_7/Workspace/MHDFInterface/..   -DDEBUG -Wall - 
>> o MHDataModel/MHDFInterface/CMakeFiles/HDFWrapper.dir/Users/ 
>> mjackson/Task_7/Workspace/MHDFInterface/MHDFInterface.o -c /Users/ 
>> mjackson/Task_7/Workspace/MHDFInterface/MHDFInterface.cpp
>>
>>
>> Linking CXX shared library ../../Bin/libHDFWrapper.dylib
>> cd /Users/mjackson/Task_7/Workspace/PFImport/Build-Intel/ 
>> MHDataModel/MHDFInterface && /usr/local/bin/cmake -P CMakeFiles/ 
>> HDFWrapper.dir/cmake_clean_target.cmake
>> cd /Users/mjackson/Task_7/Workspace/PFImport/Build-Intel/ 
>> MHDataModel/MHDFInterface && /usr/local/bin/cmake -E  
>> cmake_link_script CMakeFiles/HDFWrapper.dir/link.txt --verbose=1
>> /usr/bin/icpc  d981 -dynamiclib -headerpad_max_install_names  - 
>> o ../../Bin/libHDFWrapper.dylib -install_name /Users/mjackson/ 
>> Task_7/Workspace/PFImport/Build-Intel/Bin/libHDFWrapper.dylib  
>> "CMakeFiles/HDFWrapper.dir/Users/mjackson/Task_7/Workspace/ 
>> MHDFInterface/utilities.o" "CMakeFiles/HDFWrapper.dir/Users/ 
>> mjackson/Task_7/Workspace/MHDFInterface/MHDFInterface.o" -L/usr/ 
>> local/lib -lz -lhdf5_hl -lhdf5 -lhdf5_hl -lhdf5 -lhdf5_hl -lhdf5 - 
>> ltiff
>> IPO Warning: can not find "d981"
>> libtool: can't open file: d981 (No such file or directory)
>> make[2]: *** [Bin/libHDFWrapper.dylib] Error 1
>> make[1]: *** [MHDataModel/MHDFInterface/CMakeFiles/HDFWrapper.dir/ 
>> all] Error 2
>> make: *** [all] Error 2
> Currently, they are because on many systems it is require.  When  
> building shared libraries the compiler sometimes compiles code that  
> is generated on the fly and the flags need to match.  Also, when  
> doing template instantiatiation at link time compilers need the  
> flags.  Most compilers just ignore the flags they don't need.  What  
> is icpc?
>
> -Bill
>

Bill,
   icpc is the Intel C++ compiler. icc is the C compiler.

Exactly.. the flags _do not_ match. If you look closely in all the  
mumbo jumbo.. in the compile the flag is "-wd981" but in the link  
phase the flag is "d981". note the missing characters up front. This  
is causing the problems. So.. CMake bug or operator error?

Thanks
-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services





More information about the CMake mailing list