[asterisk-dev] dahdi-tools 2.11.1 : fix for relocation error on build

sean darcy seandarcy2 at gmail.com
Wed Mar 2 14:14:11 CST 2016


Building dahdi-tools 2.11.1:

gcc -DHAVE_CONFIG_H -I.     -g -Wall -O2 
-I/home/asterisk/rpmbuild/BUILD/dahdi-tools-2.11.1/include  -c -o 
fxstest.o fxstest.c
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -Wall -O2 
-I/home/asterisk/rpmbuild/BUILD/dahdi-tools-2.11.1/include 
-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o fxstest 
fxstest.o libtonezone.la -lpthread -lm
libtool: link: gcc -g -Wall -O2 
-I/home/asterisk/rpmbuild/BUILD/dahdi-tools-2.11.1/include -Wl,-z 
-Wl,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o .libs/fxstest 
fxstest.o  ./.libs/libtonezone.so -lpthread -lm -Wl,-rpath -Wl,/usr/lib64
/usr/bin/ld: fxstest.o: relocation R_X86_64_32 against `.rodata.str1.1' 
can not be used when making a shared object; recompile with -fPIC

Even though:

+ CFLAGS='-O2 -march=native -mtune=native -ftree-vectorize -ffast-math 
-fPIC'
+ export CFLAGS
+ CXXFLAGS='-O2 -march=native -mtune=native -ftree-vectorize -ffast-math 
-fPIC'
+ export CXXFLAGS

because CFLAGS doesn't override the Makefile CFLAGS. Notice no -fPIC above.

The fix: add -fPIC to CFLAGS in Makefile.am, ./bootstrap.sh, build.

sean





More information about the asterisk-dev mailing list