[cmake-developers] [CMake 0012601]: CLang with Opiton -working-directory leads CMake to ommit fPIC in CXX_FLAGS for shared libs

Mantis Bug Tracker mantis at public.kitware.com
Wed Nov 30 06:58:04 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12601 
====================================================================== 
Reported By:                doob
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12601
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-11-30 06:58 EST
Last Modified:              2011-11-30 06:58 EST
====================================================================== 
Summary:                    CLang with Opiton -working-directory leads CMake to
ommit fPIC in CXX_FLAGS for shared libs
Description: 
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. 


Steps to Reproduce: 
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. 



====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-30 06:58 doob           New Issue                                    
======================================================================




More information about the cmake-developers mailing list