[CMake] relocation R_MIPS_HI16 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Feb 1 13:07:21 EST 2012


Hi all,

 I am trying to fix the following issue with building volview on mips:

https://buildd.debian.org/status/fetch.php?pkg=volview&arch=mipsel&ver=3.4-1&stamp=1327908956

Quote:
...
cd /build/buildd-volview_3.4-1-mipsel-QA92w9/volview-3.4/obj-mipsel-linux-gnu/VolViewLibraries/KWCommonPro
&& /usr/bin/cmake -E cmake_link_script
CMakeFiles/KWCommonPro.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC   -Wno-deprecated   -ftemplate-depth-50 -Wall
-Wno-deprecated -O2 -g      -shared -Wl,-soname,libKWCommonPro.so -o
../../bin/libKWCommonPro.so
CMakeFiles/KWCommonPro.dir/vtkAnalyzeReader.o
<...>
/usr/lib/libvtkHybrid.so.5.8.0 ../../bin/libKWCommon.so
/usr/lib/libvtkWidgets.so.5.8.0 ../../bin/libctnlib.a
/usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0
/usr/lib/libvtkVolumeRendering.so.5.8.0
/usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0
/usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0
/usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkCommon.so.5.8.0
/usr/lib/libvtksys.so.5.8.0 -ldl -lm
/usr/bin/ld: ../../bin/libctnlib.a(condition.o): relocation
R_MIPS_HI16 against `a local symbol' can not be used when making a
shared object; recompile with -fPIC
../../bin/libctnlib.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
...

Obviously there is a very simple workaround (adding -fPIC during the
compilation of ctnlib). However I am wondering if this is not a larger
issue, such as for example cmake not setting proper static compilation
flags on mipsel

Comments appreciated,
-- 
Mathieu


More information about the CMake mailing list