From 385566e4ba57d803921a13306ead66f354cee0a2 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 29 Mar 2013 11:10:58 +0900 Subject: emit position-independent code for linking it to the shared library Background: when linking libimagequant built in the source tree on my machine (Debian wheezy amd64 / gcc 4.7.2), I got the following message. > [ 36%] Building C object src/CMakeFiles/gd.dir/gdhelpers.c.o > [ 37%] Building C object src/CMakeFiles/gd.dir/gdkanji.c.o > [ 38%] Building C object src/CMakeFiles/gd.dir/gdtables.c.o > [ 39%] Building C object src/CMakeFiles/gd.dir/gdxpm.c.o > [ 40%] Building C object src/CMakeFiles/gd.dir/wbmp.c.o > Linking CXX shared library libgd.so > /usr/bin/ld: ../libimagequant/libimagequant.a(libimagequant.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC > ../libimagequant/libimagequant.a: could not read symbols: Bad value > collect2: error: ld returned 1 exit status > make[2]: *** [src/libgd.so] Error 1 > make[1]: *** [src/CMakeFiles/gd.dir/all] Error 2 > make: *** [all] Error 2 --- cmake/modules/FindLIQ.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/modules/FindLIQ.cmake b/cmake/modules/FindLIQ.cmake index 19f490d..08713f5 100644 --- a/cmake/modules/FindLIQ.cmake +++ b/cmake/modules/FindLIQ.cmake @@ -44,7 +44,7 @@ ELSE (LIQ_FOUND) INSTALL_DIR libimagequant INSTALL_COMMAND true CONFIGURE_COMMAND true - BUILD_COMMAND make static + BUILD_COMMAND make static CFLAGSADD='-fPIC' ) SET(LIQ_FOUND "SORTOF") -- cgit v1.2.1