PHP can't compile

Manuel

New member
Joined
Jun 14, 2009
Messages
1
Hi all!

I'm just new to this forum and I've been expirimenting with DA for a long time now and I've never seen this error what I now have.

I tryed to compile PHP5.2.9 / MySQL 5.0 (exact version number I must look up).
Under here is the error:

"/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /usr/local/mysql/lib/mysql/libmysqlclient.a: could not read symbols: Bad value
*** Error code 1
1 error
-e \n*** The make has failed, do you want to try to make again (y,n): "

As you can see it's the above error.
I already Google'd for a while now but still I can't get a answer to this error, some said that it was a bug in MySQL and the other said that it's a bug in ./build php.

By the way, my server:
OS: FreeBSD 7.2 amd64
DA: 1.336

If someone could help me with this problem it would be fine!

Regards,
Manuel de Ruiter
 
OS: FreeBSD 7.0 amd64
DA: 1.336

I use PHP method CGI it is urgently necessary CLI and here the such
*********************************************************
server# ./build php n
File already exists: php-5.2.9.tar.gz
MD5 Checksum on php-5.2.9.tar.gz passed.
File already exists: php-5.2.9-mail-header.patch
MD5 Checksum on php-5.2.9-mail-header.patch passed.
Found /usr/local/directadmin/custombuild/php-5.2.9.tar.gz
Extracting ...
.........
.........
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/mysql/libmysqlclient_r.a: could not read symbols: Bad value
*** Error code 1
1 error
server#
*********************************************************
Thanks
 
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/mysql/libmysqlclient_r.a: could not read symbols: Bad value
*** Error code 1
1 error
server#
That's the same error that I get.

Thanks for posting. I'll move back to 7.1
 
Still a problem

Guys, this problem still exist with me, does anyone have a conclusive answer. I NEED to get my Apache up and running:
FreeBSD 7.1 64 bits Intel.

If I do a 'build all' I get the error below, and it's killing me! same thing if I build just php 'build php n' (which seems to be the problem, although the error seems to have to do with mysql).

Code:
#PHP settings. default_php possible values - 5 or 6
default_php=5
php5_cli=yes
php5_cgi=no
php6_cli=no
php6_cgi=no
php_ini=no
#Possible values - recommended or dist
php_ini_type=recommended
zend=no

#Possible values - 5.0, 5.1
mysql=5.1
mysql_inst=yes
mysql_backup=yes

#Possible values - 1.3, 2.0 or 2.2
apache_ver=2.2

#Web applications
phpmyadmin=yes
atmail=no
squirrelmail=yes
roundcube=yes
uebimiau=no

#Mail options
exim=yes
mail-header-patch=yes
dovecot=yes
eximconf=yes

#Statistics
awstats=yes
webalizer=yes

#FTP options
proftpd=yes

#Jailed shell
jail=no

#Custombuild options
custombuild=1.2
autover=no
bold=yes
clean=yes
cleanapache=no
clean_old_tarballs=no
clean_old_webapps=yes
fileserver=1

#Cron settings
cron=yes
[email protected]
notifications=yes
da_autoupdate=no
updates=no
webapps_updates=yes

I get this error:

Code:
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/mysql/libmysqlclient.a: could not read symbols: Bad value
*** Error code 1

Stop in /usr/local/directadmin/custombuild/php-5.2.11.

This is absolutely frustrating as there seems to be no DirectAdmin solution any where.
 
Last edited:
Okay, how stupid this sounds. Here's the solution:
Apparently MYSQL 5.1 has a dynamic/ static compile difference with PHP 5.2.
This difference causes it to fail on compile.
The solution is to grab the binary version of MySQL 5.1 from the MySQL website. Untar it, copy it into /usr/local/. make a link called 'mysql' in that directory pointing to the directory you just copied there.
Now, compile PHP in the custombuild directory. When it succeeds, restore the 'mysql' link in /usr/local/ to whatever it was (likely the DA compiled version of MySQL), start Apache and MySQL and bob's your uncle.

THIS IS AN BUG! So the DA guys should really check out this combination of things ... the MySQL should compile in a way it can be used by PHP 5.2 cli.
 
Hello,

I have duplicate this issue on our build system.
Over the last few days I've been trying several different compiler options to try and resolve it. I'm now looking at the ports system configure options for mysql 5.1 to see what they're using, and I'll try and adopt whatever works from theirs into our configure. Note that this take a decent amount of time per test as a full mysql recompile, install and php compile is required. But we are aware of it and are trying to figure it out.

John
 
Thanks John. If possible, please let us know if the issue is resolved. Or drop a line to what place we should check out to monitor the status.
Cheers.
 
Hi, I have a problem installing a Pearl module the DPD::mysql and got the same errors on libmysql.o.

Code:
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/lib" /usr/local/bin/perl5.10.1 myld cc  -shared  -L/usr/local/lib -fstack-protector dbdimp.o  mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so         -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm -lmygcc
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/mysql/libmysqlclient.a: could not read symbols: Bad value
*** Error code 1

Sould I wait for this solution, or maybe this is an another problem?

Thanks,
Abraham
FreeBSD 7.2 x64
 
Okay, how stupid this sounds. Here's the solution:
Apparently MYSQL 5.1 has a dynamic/ static compile difference with PHP 5.2.
This difference causes it to fail on compile.
The solution is to grab the binary version of MySQL 5.1 from the MySQL website. Untar it, copy it into /usr/local/. make a link called 'mysql' in that directory pointing to the directory you just copied there.
Now, compile PHP in the custombuild directory. When it succeeds, restore the 'mysql' link in /usr/local/ to whatever it was (likely the DA compiled version of MySQL), start Apache and MySQL and bob's your uncle.

THIS IS AN BUG! So the DA guys should really check out this combination of things ... the MySQL should compile in a way it can be used by PHP 5.2 cli.

This worked, thank you. I will detail it exactly how I did it for future reference, and in case someone needs to know. When I got this problem on a production server, my heart skipped a beat.

The steps:

1. Stop MySQL on the server.
# /usr/local/etc/rc.d/mysqld stop

Make sure the service stopped successfully before moving on. Check with:
# ps aux | grep mysql

If there are no MySQL processes running, continue with the instructions.

2. Download MySQL 5.1.45 x86_64 for FreeBSD 7.0 from MySQL.
Source: http://dev.mysql.com/downloads/mirror.php?id=385525#mirrors

# cd /usr/local/
# wget http://dev.mysql.com/get/Downloads/...6_64.tar.gz/from/http://mysql.mirror.iweb.ca/

3. Untar it.
# tar -zxvf mysql-5.1.45-freebsd7.0-x86_64.tar.gz

4. Remove the existing MySQL link from /usr/local/
# rm mysql

5. Create the new MySQL link in /usr/local/
# ln -s mysql-5.1.45-freebsd7.0-x86_64 mysql

6. Time to update PHP. I used version 5.2.13, but I *think* 5.3.2 will work as well.
# cd /usr/local/directadmin/custombuild/
# ./build php n

PHP should successfully compile at this point.

7. Time to put back the DA MySQL binary.
# cd /usr/local/
# rm mysql
# ln -s mysql-5.1.45-freebsd7.2-x86_64 mysql

8. Start the DA MySQL service.
# /usr/local/etc/rc.d/mysqld start

9. Everything should be running smoothly. If sites still don't work, check Apache.
# ps aux | grep httpd

If Apache is dead, try:
# apachectl start

I hope this save's someone life...
 
Quick update: the above only works temporarily... I had to revert to 5.0.77 as Apache couldn't find libphp5.so.
 
You do not need to revert back, just link /usr/local/mysql/data to /home/mysql and it should have no problems.

How-to:
Code:
/usr/local/etc/rc.d/mysqld stop
cd /usr/local
wget -O mysql-5.1.45-freebsd7.0-x86_64.tar.gz "http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.45-freebsd7.0-x86_64.tar.gz/from/http://mirror.leaseweb.com/mysql/"
tar xzf mysql-5.1.45-freebsd7.0-x86_64.tar.gz
rm -f mysql
ln -s mysql-5.1.45-freebsd7.0-x86_64 mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql-5.1.45-freebsd7.0-x86_64
cd mysql
rm -rf data
ln -s /home/mysql ./data
touch /home/mysql/my.cnf
rm -f /usr/local/bin/mysql_config
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
/usr/local/etc/rc.d/mysqld start
 
Last edited:
Still not solved...

Hello,

has this been resolved finally? I've got this same problem on FreeBSD 8.1 x64, with MySQL 5.1.49 while compiling PHP 5.2.14, and I need proper solution.

Or can you build MySQL 5.1.49 and PHP 5.2.14 on FBSD 8.1 and put it on files.directadmin.com?

Code:
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/mysql/libmysqlclient.a: could not read symbols: Bad value

Thanks,
Andrzej
 
I am having this problem on freebsd 8.0 64bit..

How do I fix this?!?!?
 
SOLVED reliably.

This problem is caused because of a bug in custombuild script. Apply the following patch to 'build' file to fix MySQL build problem. It basically changes MySQL configure option --disable-shared to --enable-shared (in line 2596 as of current version).

Code:
--- build-orig  2010-12-13 22:50:05.000000000 +0100
+++ build       2010-12-19 00:29:56.000000000 +0100
@@ -2593,7 +2593,7 @@

                 CFLAGS=-DHAVE_BROKEN_REALPATH
                 ./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client \
-                         --enable-local-infile --enable-assembler --with-named-z-libs=not-used --disable-shared \
+                         --enable-local-infile --enable-assembler --with-named-z-libs=not-used --enable-shared \
                          --enable-static --with-innodb
                 echo "Done. Making ${MYSQLPACK}...";
                 while

Delete /usr/local/directadmin/custombuild/mysql-5.x.y to be sure that ./build will fully rebuild it. As a side effect, MySQL sources will be (re)downloaded.

Build MySQL with:
Code:
./build mysql

Build PHP with:
Code:
./build php n

At this point everything should work as expected. Tested on FreeBSD 8.1 RELEASE on amd64. YMMV.
 
Back
Top