[cmake-developers] [CMake 0013479]: buildig shared libs from object libraries fails because of missing -fPIC opion

Mantis Bug Tracker mantis at public.kitware.com
Fri Aug 17 05:23:37 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://cmake.org/Bug/view.php?id=13479 
====================================================================== 
Reported By:                Markus Blatt
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13479
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2012-08-17 05:23 EDT
Last Modified:              2012-08-17 05:23 EDT
====================================================================== 
Summary:                    buildig shared libs from object libraries fails
because of missing -fPIC opion
Description: 
I need to used the object libraries for building libs out of serveral convenient
libraries.

When trying to build shared libraries by using set(BUILD_SHARED_LIBS ON) the
compilation with gcc fails with

"[100%] Building CXX object CMakeFiles/a.dir/dummy.cc.o
[100%] Built target a
Linking CXX shared library libb.so
/usr/bin/ld: CMakeFiles/a.dir/dummy.cc.o: relocation R_X86_64_32 against
`_ZSt4cout' can not be used when making a shared object; recompile with -fPIC
CMakeFiles/a.dir/dummy.cc.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libb.so] Error 1
make[1]: *** [CMakeFiles/b.dir/all] Error 2
make: *** [all] Error 2
"


Steps to Reproduce: 
Setup the attached testcase and call cmake && make
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-08-17 05:23 Markus Blatt   New Issue                                    
2012-08-17 05:23 Markus Blatt   File Added: testcase.tar.gz                    
======================================================================




More information about the cmake-developers mailing list