roxen.lists.pike.general

Subject Author Date
trying to compile pike as a library Yvan Vander Sanden <yvan[at]youngmusic[dot]org> 17-10-2009
Hey.

I am trying to compile pike as a library for embedding in a c++ application.

Using the command "make libpike" i get this error at the end of the process:

Linking libpike.so
/usr/bin/ld: language.o: relocation R_X86_64_32 against `a local symbol' can
not be used when making a shared object; recompile with -fPIC
language.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Linking failed:
/home/yvan/Desktop/pike-sourc/bin/smartlink gcc -shared
-L/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/bundles/lib64
-L/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/bundles/lib/64
-L/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/bundles/lib/.
-L/usr/lib/gcc/x86_64-linux-gnu/4.3 -R/usr/lib/gcc/x86_64-linux-gnu/4.3
-L/usr/local/lib -R/usr/local/lib -rdynamic -o libpike.so language.o
security.o bignum.o pike_cpulib.o interpret.o constants.o cpp.o fdlib.o
cyclic.o array.o backend.o callback.o encode.o docode.o dynamic_buffer.o
dynamic_load.o error.o fd_control.o fsort.o gc.o hashtable.o lex.o
multiset.o signal_handler.o pike_search.o pike_types.o pike_embed.o
mapping.o pike_memory.o module_support.o pikecode.o object.o opcodes.o
operators.o port.o program.o rbtree.o rusage.o sscanf.o stralloc.o stuff.o
threads.o version.o queue.o builtin.o iterators.o facetgroup.o svalue.o
las.o builtin_functions.o peep.o tmodule.o
/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/modules/Gmp/module.a
-lgmp -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64
-R/usr/lib/jvm/java-6-openjdk/jre/lib/amd64
-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads
-R/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads
-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server
-R/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server modules/Mysql/dummy.o
modules/_Image_TIFF/dummy.o
/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/modules/_math/module.a
-lm
/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/modules/files/module.a
-lnsl
/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/modules/sprintf/module.a
/home/yvan/Desktop/pike-sourc/build/linux-2.6.27-11-generic-x86_64/modules/system/module.a
-lnsl -ldl -lrt -lnsl -lm -lpthread -lcrypt
make[2]: *** [libpike.so] Error 1
make[1]: *** [_make_in_builddir] Error 2
make: *** [libpike] Error 2

This makes sense, adding fPIC when compiling a library. Normally, I'd add
fPIC to the CFLAGS variable, but apparently that is not used in the pike
build system. I'm staring at the Makefile for some time now, but have not
found yet where to add fPIC. Anyone encountered this before?

Regards,

yvan

-- 
Copyright only exists in the imagination of those who do not have any.