I run my web servers by compiling the most important components from source code, which makes it possible for me to add security fixes more quickly and fine-tune my installations of Apache, MySQL and PHP. While compiling the new release PHP 5.2.8 this weekend, the make process failed with this error:
/usr/bin/ld: /usr/mysql/lib/mysql/libz.a(compress.o): relocation R_X86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/mysql/lib/mysql/libz.a: could not read symbols: Bad value
Naturally, I had absolutely no idea what this meant.
The file libz.a is part of the Zlib compression library, which apparently is included in MySQL 5.0. A Google search for the error message uncovered a bunch of people suffering the same problem I encountered when compiling programs on Linux. The best explanation I found was a Gentoo Linux page on how to fix -fPIC errors. Unfortunately, none of Gentoo's tips worked for me.
Through trial and error (and error and error), I finally solved the problem by compiling a new copy of Zlib and specifying that it create a Unix shared library using the
option:Next, I added the option configure to prepare PHP for installation. This didn't work until I figured out one last obstacle -- the Zlib option must be placed before the option. Otherwise, PHP tries to use the copy of Zlib included with MySQL.
when runningEverything now compiles and runs successfully. So until the next time I try to install something, I can return my ego to its upright position. My new Linux technique is unstoppable.
Rogers,
If people saw how software was actual "made" they would insist on giving the people who make it "tips"...
well, they might hope someone would leave something in your open
briefcase...
well, they might wonder why people spend so much time when they never even have to bother. "Who's the genius?"
But... as you say... "security". A stitch in time.
good -fPIC to you sir.
I updated the Gentoo Linux link on this post, which has disappeared and must be retrieved from the Internet Archive.
All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).