[squid-users] relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

From: Niki Gorchilov <niki_at_gorchilov.com>
Date: Thu, 3 Oct 2013 16:46:23 +0300

I'm trying to compile 3.4.0.1 on Ubuntu 12.04 LTS I get the following errors:

/usr/bin/ld: /z/src/squid-3.4.0.1/compat/libcompat-squid.a(eui64_aton.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a
shared object; recompile with -fPIC
/z/src/squid-3.4.0.1/compat/libcompat-squid.a: could not read symbols: Bad value

./configure shows the following lines:
...
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
....
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes

And yes, most of the files are compiled with -fPIC option, but not the
compat/ directory:

===[cut]===
Making all in compat
make[1]: Entering directory `/z/src/squid-3.4.0.1/compat'
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o assert.o assert.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o compat.o compat.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o debug.o debug.cc
gcc -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -Wall -Wpointer-arith -Wwrite-strings
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow
-Werror -pipe -D_REENTRANT -m64 -c GnuRegex.c
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o shm.o shm.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o strnstr.o strnstr.cc
gcc -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -Wall -Wpointer-arith -Wwrite-strings
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow
-Werror -pipe -D_REENTRANT -m64 -c strnrchr.c
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o xalloc.o xalloc.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o xstrerror.o xstrerror.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o xstring.o xstring.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o xstrto.o xstrto.cc
g++ -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -I/usr/include/libxml2 -Wall -Wpointer-arith
-Wwrite-strings -Wcomments -Wshadow -Werror -pipe -D_REENTRANT -m64 -g
-O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -march=native -std=c++0x -c
-o mswindows.o mswindows.cc
gcc -DHAVE_CONFIG_H -I.. -I../include -I../lib -I../src -I../include
-I/usr/include -I../libltdl -I/usr/include/libxml2
-D_FORTIFY_SOURCE=2 -Wall -Wpointer-arith -Wwrite-strings
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow
-Werror -pipe -D_REENTRANT -m64 -c eui64_aton.c
rm -f libcompat-squid.a
/usr/bin/ar cru libcompat-squid.a assert.o compat.o debug.o GnuRegex.o
shm.o strnstr.o strnrchr.o xalloc.o xstrerror.o xstring.o xstrto.o
mswindows.o eui64_aton.o
ranlib libcompat-squid.a
make[1]: Leaving directory `/z/src/squid-3.4.0.1/compat'
===[cut]===

Please help me fix this issue.

Best,
Niki
Received on Thu Oct 03 2013 - 13:47:10 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 03 2013 - 12:00:06 MDT