Issues related to compiling apache, php etc.. LibXML Compile Error: relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC

Issues related to compiling apache, php etc.. LibXML Compile Error: relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC

If there you get the following error during a libxml compile with a 64-bit system:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libm.a(s_floor.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libm.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Though It means the configuration needs to be changed.

Usually,

for an -fPIC error like this, the best way is to recompile the source library to resolve the issue, then recompile libxml the same way it is.

However,

in this case, the cause is libml.a, which is part of the OS distribution, so it is better to avoid that, and make everything with the inverse instead.

In this case, the solution is to tune libxml to not use fPIC or shared libraries.
Edit the build script.

In the doLibxml2  section, find the line:

./configure –prefix=/usr/local –without-python

and change it to:

./configure –prefix=/usr/local –without-python –disable-shared –without-pic

Save/exit.
Then type:

./build libxml

and that should compile libxml for you.


Note:

Whether That after further work on this issue, I was able to prevent the error, without need the above items.  The fix basically includes a full reinstall of all of the dev, gcc, build-essentials type items using dpkg and the apt-get program.

I am not sure if it was related, but I also did a

 

 

 

 

which did not get rid of the above error, but in case it was partly related to solve the issue on Debian 5, 64-bit.  Related dpkg and apt-get commands using (after much trial and error):

aptitude remove libc6-dev libsasl2-dev libstdc++6-4.1-dev zlib1g-dev g++-4.1 build-essential libssl-dev libcurl4-openssl-dev comerr-dev gcc libkrb5-dev libc-dev libstdc++6-4.3-dev g++-4.3

and apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev build-essential

 

Webalizer compile: hashtab.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hash’

If there you get the following errors when trying to compile webalizer:

 

 

 

hashtab.c:163: error: ‘hval’ undeclared (first use in this function)
hashtab.c:163: warning: implicit declaration of function ‘hash’
hashtab.c: In function ‘put_unode’:
hashtab.c:362: error: ‘uint32_t’ undeclared (first use in this function)
hashtab.c:362: error: expected ‘;’ before ‘hval’
hashtab.c:366: error: ‘hval’ undeclared (first use in this function)
hashtab.c: In function ‘put_rnode’:
hashtab.c:491: error: ‘uint32_t’ undeclared (first use in this function)
hashtab.c:491: error: expected ‘;’ before ‘hval’
hashtab.c:495: error: ‘hval’ undeclared (first use in this function)
hashtab.c: In function ‘put_anode’:
hashtab.c:617: error: ‘uint32_t’ undeclared (first use in this function)
hashtab.c:617: error: expected ‘;’ before ‘hval’
hashtab.c:621: error: ‘hval’ undeclared (first use in this function)
hashtab.c: In function ‘put_snode’:
hashtab.c:734: error: ‘uint32_t’ undeclared (first use in this function)
hashtab.c:734: error: expected ‘;’ before ‘hval’
hashtab.c:738: error: ‘hval’ undeclared (first use in this function)
hashtab.c: In function ‘put_inode’:
hashtab.c:850: error: ‘uint32_t’ undeclared (first use in this function)
hashtab.c:850: error: expected ‘;’ before ‘hval’
hashtab.c:854: error: ‘hval’ undeclared (first use in this function)
hashtab.c: At top level:
hashtab.c:1231: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hash’
make: *** [hashtab.o] Error 1

a reported solution is to install db4-devel:

yum install db4-devel

Leave a Reply

Your email address will not be published. Required fields are marked *