php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33328 compile fails when configured with both --with-mysql and --with-mysqli flags
Submitted: 2005-06-13 23:57 UTC Modified: 2005-06-28 00:47 UTC
From: agould at ucop dot edu Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.0.4 OS: linux 2.6.5, SuSE 9.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: agould at ucop dot edu
New email:
PHP Version: OS:

 

 [2005-06-13 23:57 UTC] agould at ucop dot edu
Description:
------------
Building php5.0.4 with both mysql and mysqli support fails during final stage of compile with the error:

[cut]
: multiple definition of `my_net_read'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9f0): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0xc60): In function `my_net_init':
: multiple definition of `my_net_init'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0xc60): first defined here
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

It appears libtool is trying to source mysql client library /usr/lib/mysql/libmysqlclient.a twice.


I found I could correct this error by editing the Makefile line "EXTRA_LIBS=" and removing one of the iterations of the string -lmysqlclient

before:
EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lmysqlclient -lz -lcrypt -lnsl -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt

after:
EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lz -lcrypt -lnsl -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt

Reproduce code:
---------------
I'm building against mysql provided rpm: MySQL-server-standard-4.1.12-0.sles9.i586.rpm. 

./configure  --with-apxs=/usr/local/apache/bin/apxs \ --with-mysqli=/usr/bin/mysql_config \ --with-mysql=/usr/lib/mysql

make




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-15 03:13 UTC] agould at ucop dot edu
Still fails:

agould@web5:~/build/php5-STABLE-200506150034> ./configure  --with-apxs=/usr/local/apache/bin/apxs --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr/lib/mysql 
agould@web5:~/build/php5-STABLE-200506150034> make

[cut]
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9f0): In function `my_net_read':
: multiple definition of `my_net_read'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9f0): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0xc60): In function `my_net_init':
: multiple definition of `my_net_init'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0xc60): first defined here
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1


Again, removing one of the "-lmysqlclient" iterations in
"EXTRA_LIBS" fixes it:

agould@web5:~/build/php5-STABLE-200506150034> vi Makefile
agould@web5:~/build/php5-STABLE-200506150034> grep "EXTRA_LIBS =" Makefile
EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lz -lcrypt -lnsl -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt

agould@web5:~/build/php5-STABLE-200506150034> make
[cut]
cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lmysqlclient -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lz -lcrypt -lnsl -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt  -o sapi/cli/php

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
 [2005-06-15 15:28 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

That 'STABLE' branch is obsolete, 5.1 is the way to go, so give it a go. Also note: You can't have multiple versions of Mysql installed for this to work..

 [2005-06-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-06-28 00:43 UTC] agould at ucop dot edu
Sorry, I was on vacation.

http://snaps.php.net/php5-latest.tar.gz solved the problem.
I tried the version:
php5-200506172230
 [2005-06-28 00:47 UTC] johannes@php.net
Problem solved -> closed  
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 11 04:00:03 2025 UTC