Ubuntu amd64 (x86_64)version 7.04 issues with compiling php from source
Hi
I am a Linux rookie so here we go. I am trying to install php 5.2.3 on my ubuntu machine (yes I do understand that I could easily install ubuntu's packaged version which is 5.2.1 but I wanted to grow in learning about compiling from source) moreover, while trying to install php am able to ./configure the php source but when trying to use make i get an error " /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/libxml2.a(entities.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.1.2/../../../../lib64/libxml2.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 " - gcc version is 4.1.2 - I have apache2 installed - I used --enable-so when configuring apache - i have set apxs2= /path/to/apxs - I have search on different search engines -I used "sudo ./configure --prefix=/usr/local/web --with-apxs2=/path/to/apxs" to config installation - I tried using make clean still didn't work - when using ./configure --prefix=/usr/local/web (no apxs) " to config installation make seems to work fine. any assistance will be appreciated. if there is a better place to post this error or necessary information is missing please inform me & |
You're trying to use the statically built libxml archive which isn't PIC-enabled. When GCC is given the -l flag to link to a library (libxml in this case), it falls back to the static archive when it can't find a shared library. Ideally, you would rebuild libxml and enable the shared library (which should be default anyway). At least you need to rebuild the static libxml using the -fPIC flag.
|
Do you have a link that can show me how to rebukd a static library. I have researched and tried and have only failed.
|
Sorry.. I mean.. can you find a link to a site that can show me how to do this?
Forgive me of my ignorance. |
You have to add -fPIC to CFLAGS/CXXFLAGS or pass it to gcc when you build the library. The way I would do it (although libxml2 should build PIC-enable by default) on my x86_64 machine
Code:
CC="gcc ${BUILD64} -fPIC" ./configure --prefix=/usr --libdir=/usr/lib64 && |
Hey,
so it seems that you were completely correct. The reason for my problem seems to be that i had a broken symbolic link to libxml2.so in my /usr/lib64 There was a file named libxml2.so.2 which seemed to be pointing to a latter version of libxml2.so. I had assumed that php was recognizing this file as my libxml2.so.. I thought that possibly renaming this link would fix it but I though couldn't be.. well i finally decided to go against my own expectations and well it worked( yes yes I am a newbie). And no matter how ridiculous I feel about how long it took me to solve this issue. I am amazed at all of the other things that I learned while researching this issue. That I would have never spent my time learning. weibullguy.. I thank you for helping this community to work for people like me. |
All times are GMT -5. The time now is 07:11 PM. |