[x265] [PATCH] cmake: use cmake 2.8 OBJECT target type to manage static and share libs

Steve Borho steve at borho.org
Wed Oct 9 05:41:25 CEST 2013


On Tue, Oct 8, 2013 at 3:00 AM, Steve Borho <steve at borho.org> wrote:

>
>
>
> On Tue, Oct 8, 2013 at 2:54 AM, Steve Borho <steve at borho.org> wrote:
>
>>
>>
>>
>> On Tue, Oct 8, 2013 at 2:50 AM, Steve Borho <steve at borho.org> wrote:
>>
>>> # HG changeset patch
>>> # User Steve Borho <steve at borho.org>
>>> # Date 1381194546 18000
>>> #      Mon Oct 07 20:09:06 2013 -0500
>>> # Node ID 6b457a8c52376af24ddcad014ad1793209574e74
>>> # Parent  9b3a427a1009d1853bbdc30abe1fd891864e6b38
>>> cmake: use cmake 2.8 OBJECT target type to manage static and share libs
>>>
>>
>> This seems like the correct approach to deal with needing to create a
>> static lib and shared lib from the same source base that spans several
>> directories; and it works perfectly with MinGW/GCC and MSVC.
>>
>> However on Linux x64 I get this inexplicable error about -fPIC when
>> clearly everything is getting built with -fPIC (gcc) or -DPIC (yasm):
>>
>
> Argh: beware CTRL+Enter with gmail.  Anyway, here is the error message:
>
> /usr/bin/ld: common/CMakeFiles/common.dir/x86/pixel-a.asm.o: relocation
> R_X86_64_PC32 against symbol `x265_pw_00ff' can not be used when making a
> shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
> make[2]: *** [libx265.so] Error 1
>
> This is a symbol exported by const-a.asm and imported by pixel-a.asm and
> others.  I don't see how this could be messed up.  Does this ring any bells
> to anyone?
>

BugMaster pointed me to -Wl,-Wsymbolic linker flags and those indeed fixed
the 64bit Linux linker problems so I've pushed this change.  x265 now
requires cmake 2.8, which kind of stinks, but now we're able to build a
static lib and a shared lib reliably from the same object files, and I
could get rid of the ugly hacks that were required to make the shared
library.

This is a large change, in terms of CMake internals, so I recommend nuking
your old build folder and starting anew if you encounter any build or link
issues.

-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131008/0178cd81/attachment-0001.html>


More information about the x265-devel mailing list