On 07/07, Dan Kegel wrote:
> On Tue, Jul 7, 2015 at 12:36 PM, Steve Borho <st...@borho.org> wrote:
> > /bin/ld: common/CMakeFiles/common.dir/x86/pixel-a.asm.o: relocation
> > R_X86_64_PC32 against symbol `x265_pw_1' can not be used when making a
> > shared object; recompile with -fPIC
> > ...
> > 2 - is there some invocation that will force cmake to build the static
> >   libraries such that they are still safe for linking into a shared
> >   library?
> >
> >   I've already tried these unsuccessfully:
> >     set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
> >     set_target_properties(x265-static PROPERTIES POSITION_INDEPENDENT_CODE 
> > TRUE)
> >     set_target_properties(x265-static PROPERTIES LINK_FLAGS "-fPIC")
> >
> > 3 - is there another intermediate format that cmake can output that
> >   preserves -fPIC, or some way to access the object libraries of the
> >   other external builds?
> 
> Try
>      set_target_properties(x265-static PROPERTIES COMPILE_FLAGS "-fPIC")
> 
> Alternately, something like
> set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
> when compiling the files in question.

sadly that didn't help.

We're already adding -fPIC to the compile flags for the two object
libraries. This way one set of objects can be used to output the shared
library and the static library. So the C++ files are already compiled
with -fPIC. It is only a problem when we need to link a static library
from one build into the shared library of another build.  The static
library itself no longer supports PIC.

-- 
Steve Borho
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to