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 -s option:

Next, I added the option --with-zlib-dir=/usr/zlib when running 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 --with-mysql option. Otherwise, PHP tries to use the copy of Zlib included with MySQL.

Everything 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 Cadenhead

Comments

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.


 

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. dissertation proposal | statistics assignment | essay writing


 

Add a Comment

These HTML tags are permitted: p, b, i, a, and blockquote. A comment may not include more than three links. Participants in this discussion should note the site's moderation policy.

:
:
: