MantisBT - CMake
View Issue Details
0012601CMakeCMakepublic2011-11-30 06:582012-04-02 10:10
doob 
Brad King 
normalminoralways
closedsuspended 
Linux x86_64Linux OpenSuse11.4
CMake 2.8.6 
 
0012601: CLang with Opiton -working-directory leads CMake to ommit fPIC in CXX_FLAGS for shared libs
I tried using CLang as drop in replacement for GCC with CMake and it worked just fine. (CLang Version 3.0) I just set CLang/CLang++ as the native C/CXX compiler in CMake.

However since qtcreator didn't recognized the paths given by warning and error messages from CLang I forced CLang to output absolute paths always by setting -working-directory "/" to output paths relative to the root directory.

However this seams to fool some internal setup/path detection or whatever process of CMake. If I use CLang together with -working-directory "/" I can't build shared libraries anymore, because CMake somehow fails on setting the proper fPIC flags then.
On a shared library target building project:
- set clang/clang++ as the native C/CXX compiler in CMake
- build the project
---> everything should be fine
---> grep -l -R fPIC . will show you that fPIC is actually in the compile line. Look into your ./**/flags.make files.



- add -working-directory "/" to C/CXX flags in CMake
- make rebuild_cache
- build the project
---> linker complains about missing fPIC on your object files with something like: relocation R_X86_64_32S against `.bss' can not be used when making a shared object

---> grep -l -R fPIC . will show you that fPIC is missing in the compile line. Look into your ./**/flags.make files.


No tags attached.
Issue History
2011-11-30 06:58doobNew Issue
2011-11-30 09:07Brad KingNote Added: 0027873
2011-11-30 09:07Brad KingStatusnew => resolved
2011-11-30 09:07Brad KingResolutionopen => suspended
2011-11-30 09:07Brad KingAssigned To => Brad King
2012-04-02 10:10David ColeNote Added: 0029054
2012-04-02 10:10David ColeStatusresolved => closed

Notes
(0027873)
Brad King   
2011-11-30 09:07   
Please bring this up on the users list first to see if anyone else can reproduce it and help:

  http://www.cmake.org/mailman/listinfo/cmake [^]
(0029054)
David Cole   
2012-04-02 10:10   
Closing resolved issues that have not been updated in more than 4 months.