<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 3:00 AM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Tue, Oct 8, 2013 at 2:54 AM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Tue, Oct 8, 2013 at 2:50 AM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Steve Borho <<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>><br>
# Date 1381194546 18000<br>
#      Mon Oct 07 20:09:06 2013 -0500<br>
# Node ID 6b457a8c52376af24ddcad014ad1793209574e74<br>
# Parent  9b3a427a1009d1853bbdc30abe1fd891864e6b38<br>
cmake: use cmake 2.8 OBJECT target type to manage static and share libs<br></blockquote><div><br></div></div><div>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.<br>


<br></div><div>However on Linux x64 I get this inexplicable error about -fPIC when clearly everything is getting built with -fPIC (gcc) or -DPIC (yasm):<br></div></div></div></div></blockquote><div><br></div></div><div>Argh: beware CTRL+Enter with gmail.  Anyway, here is the error message:<br>

<br>/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<br>/usr/bin/ld: final link failed: Bad value<br>

collect2: ld returned 1 exit status<br>make[2]: *** [libx265.so] Error 1<br><br></div><div>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?</div>
</div></div></div></blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div></div><div><br></div>-- <br>Steve Borho
</div></div>