lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


thanks for your answers. i already changed makefile. 



2013/3/23 Philipp Janda <siffiejoe@gmx.net>
Am 23.03.2013 12:29 schröbte andreas graeper:
hi,

Hi!


i tried to install lpeg from source:

gcc -Wall -Wextra -pedantic -Waggregate-return -Wbad-function-cast
-Wcast-align -Wcast-qual -Wdeclaration-after-statement
-Wdisabled-optimization -Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef
-Wwrite-strings  -O2 -DNDEBUG -ansi -I/usr/include/lua5.1/   -c -o lpeg.o
lpeg.c
env  gcc -shared -fpic lpeg.o -o lpeg.so
/usr/bin/ld: lpeg.o: relocation R_X86_64_32S against `.rodata' can not be
used when making a shared object; recompile with -fPIC
lpeg.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [lpeg.so] Error 1

i think its cause of using implicit rules in makefile when compiling .c to
.o, missing -fpic, what is used instead when
generating .so from .o (there it is not neccessary ?!)

gcc -fpic -c x.c -o x.o
gcc -shared -o x.so x.o

Yes, -fpic (or -fPIC) is necessary in the first gcc invocation, but not the second. Just add -fpic to CFLAGS in the makefile (and optionally remove it from DLLFLAGS).


???


Philipp