php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29860 Cannot compile with mysql and mysqli extensions
Submitted: 2004-08-27 08:08 UTC Modified: 2004-10-14 01:00 UTC
Votes:37
Avg. Score:4.4 ± 0.8
Reproduced:32 of 33 (97.0%)
Same Version:13 (40.6%)
Same OS:7 (21.9%)
From: rjanson at msn dot com Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.0.1 OS: Redhat 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rjanson at msn dot com
New email:
PHP Version: OS:

 

 [2004-08-27 08:08 UTC] rjanson at msn dot com
Description:
------------
I cannot compile php 5.0.1 (nor 5.0.0) with mysql and mysqli extensions. I can compile with either/or. At this point I need both. I am using mysql 4.1.3

Configure runs with no issues.

Reproduce code:
---------------
My configure options: 
./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --enable-inline-optimization --with-exec-dir=/usr/bin --with-layout=GNU --enable-magic-quotes --with-pear=/usr/share/pear --with-mysql=/usr/bin/mysql_config --with-mysqli=/usr/bin/mysqli_config --enable-versioning --with-apxs2=/usr/sbin/apxs --enable-sockets --with-zlib-dir=/usr/local --with-gd --with-ldap --without-sqlite

Expected result:
----------------
I expect PHP to compile with no errors, and to support both Mysql and Mysqli extensions.

Actual result:
--------------
I get several lines similar to the following:

: multiple definition of `net_realloc'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x100): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x180): In function `net_clear':
: multiple definition of `net_clear'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x180): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x1f0): In function `net_flush':
: multiple definition of `net_flush'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x1f0): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x580): In function `net_real_write':
: multiple definition of `net_real_write'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x580): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x240): In function `my_net_write':
: multiple definition of `my_net_write'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x240): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x320): In function `net_write_command':
: multiple definition of `net_write_command'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x320): first defined here
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9c0): In function `my_net_read':
: multiple definition of `my_net_read'
/usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9c0): first defined here
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-04 19:28 UTC] pbriggs at clinitech dot net
Same thing is happening to me using RedHat Enterprise 3.  Unless I can get both mysql and mysqli to live with each other, I can't port my apps over to mysqli.
 [2004-09-07 07:52 UTC] georg@php.net
When using the mysqli extension together with the mysql extension
you have to use the same libraries and include files. mysqli
extension requires the location of mysql_config file, mysql
extension requires the path of your mysql installation.

If you installed MySQL 4.1 for example with prefix /usr/local/mysql-4.1
your configure settings should be
--with-mysql=/usr/local/mysql-4.1
--with-mysqli=/usr/local/mysql-4.1/bin/mysql_config


 [2004-09-08 08:18 UTC] rjanson at msn dot com
I should have mentioned before that I have tried the configuration you suggest as well. In between each failed 'make' I have done a 'make clean' to be sure I am not using any leftover configuration options. No matter what path I use for mysql and mysqli, if the configuration passes, the make fails.

I've seen this issue mentioned in various places, but never a resolution.
 [2004-09-13 19:38 UTC] nathansquires at pacbell dot net
I had the same linking problem with php 5.0.1 and mysql 4.1.4a-gamma. I was able to compile with mysql and mysqli by rebuilding mysql with shared libraries (i.e. don't use --without-shared or --*flags=--all-static). If you only have static mysql libraries, trying to build php with mysql and mysqli will cause this error.
 [2004-09-13 20:44 UTC] rjanson at msn dot com
I installed mysql via the RPMs provided on the MySQL site.

I unsinstalled the MySQL-shared-compat-4.1.4-0 rpm and tried building agin with the same result.

These are the RPMs I have installed currently:

MySQL-devel-4.1.4-0
MySQL-client-4.1.4-0
MySQL-Max-4.1.4-0
MySQL-bench-4.1.3-1
MySQL-server-4.1.4-0
MySQL-shared-4.1.4-0

Is it possible something with the RPMs is causing the failure?
 [2004-09-21 01:12 UTC] rjanson at msn dot com
I tried backing up and completely uninstalling, then reinstalling Mysql-4.1.4-0 from RPM, and still get the same result.

Others out there are having this issue as well. Is there nothing to be done?

--Rich
 [2004-09-24 19:59 UTC] rjanson at msn dot com
I've tried the same steps with php-5.02 and still the same results.
 [2004-10-05 13:50 UTC] php at kilimajer dot net
This is caused by -lmysqlclient being supplied twice to the linker (at least it was my case).
 [2004-10-05 22:52 UTC] php at kilimajer dot net
Workaround is to execute the last failing command with one -lmysqlclient removed, then again make.

This should be fixed in ext/mysqli/config.m4.
 [2004-10-05 23:33 UTC] rjanson at msn dot com
OK, finally an answer!

I checked Makefile and found the following line:

EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lpng -lz -lz -lresolv -lm -ldl -lnsl -lxml2 -
lz -lm -lxml2 -lz -lm -lmysqlclient -lcrypt -lnsl -lm -lz -lnss_files -lnss_dns -lresolv -lnss_files
 -lnss_dns -lresolv -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt 

By removing one of the -lmysqlclient entries on this line I was able to successfully make and make install with both mysql and mysqli. As confirmed by phpInfo().

I'm not sure why the other libs have multiple entries and don't cause make to crash.
 [2004-10-06 08:52 UTC] derick@php.net
That doesn't make sense unless you only have a static version of the libmysqlclient... in which case I still think that the linker handles that correctly. Can you please try to use a shared library version of libmysqlclient though?
 [2004-10-06 13:28 UTC] php at kilimajer dot net
The errror occurs with these rpms installed:

MySQL-server-4.1.5-0
MySQL-client-4.1.5-0
MySQL-bench-4.1.5-0
MySQL-shared-4.1.5-0
MySQL-embedded-4.1.5-0
MySQL-devel-4.1.5-0

They are downloaded from mysql.com
 [2004-10-07 12:48 UTC] stormchaser1 at gmail dot com
Saame problem... cvs HEAD (php 5.1) from yesterday...
 [2004-10-07 12:52 UTC] stormchaser1 at gmail dot com
forgot to mention it's the MySQL 5.0.1-alpha installed from 
rpms from mysql.com
 [2004-10-14 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".
 [2004-10-28 21:49 UTC] kpederson at mail dot ewu dot edu
I can confirm a few things.  I have both the static and 
the shared libraries installed as they both come in the 
standard mysql-devel rpm: 
 
/usr/lib/libmysqlclient.so 
/usr/lib/libmysqlclient.so.14 
/usr/lib/mysql 
/usr/lib/mysql/libmysqlclient.a 
/usr/lib/mysql/libmysqlclient_r.la 
/usr/lib/mysql/libmysqld.a 
/usr/lib/mysql/libmysqlclient_r.a 
/usr/lib/mysql/mysqld.sym 
/usr/lib/mysql/libmysqlclient.la 
/usr/lib/libmysqlclient.so.14.0.0 
/usr/lib/libmysqlclient_r.so 
/usr/lib/libmysqlclient_r.so.14 
/usr/lib/libmysqlclient_r.so.14.0.0 
 
If the static libraries are found, then the make dies with 
linking problems.  I temporarily did a 'rename .a .a_old 
*.a' and 'rename .la .la_old *.la' in my /usr/lib/mysql 
directory, and then was able to make everything 
successfully. 
 
The output of ./configure ... | grep -i mysql gives: 
 
checking for MySQL support... yes 
checking for specified location of the MySQL UNIX 
socket... /var/run/mysql/mysql.sock 
checking for MySQL UNIX socket 
location... /var/run/mysql/mysql.sock 
checking for mysql_close in -lmysqlclient... (cached) yes 
checking for MySQLi support... yes 
checking whether to enable embedded MySQLi support... no 
checking for mysql_set_server_option in -lmysqlclient... 
(cached) yes 
checking for mysql_stmt_field_count in -lmysqlclient... 
(cached) yes 
 
BTW, I'm running Redhat Enterprise AS using PHP-5.0.2 and 
MySQL-4.1.7 (stable).
 [2005-02-19 19:32 UTC] chris at leftbrained dot org
I know this hasn't been looked at in some time, but I've spent that last few days working out this exact problem.

Apache 2.0.53 - Built by me into /usr/local/apache
MySQL 4.1.9 - Used the RPM download of of mysql.com
>MySQL-client-4.1.9-0
>MySQL-shared-compat-4.1.9-0
>MySQL-server-4.1.9-0
>MySQL-bench-4.1.9-0
>MySQL-devel-4.1.9-0

PHP 5.0.3 - ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config

I'm on some form of RedHat Enterprise, I'm not quite sure how I would check which one.

I was coming up witht he same exact errors, and the *only* way I was able to make it work was this:

cd /usr/lib/mysql
rename .a .a_old *.a
rename .la .la_old *.la

Then run configure/make/make install

Then rename these files back.

cd /usr/lib/mysql
rename .a_old .a *.a_old
rename .la_old .la *.la_old

I'm not sure what precisely these files are, and this was a last resort attempt for me, but it worked.

Chris
 [2005-05-09 18:48 UTC] jorge dot tiao dot pereira at gmail dot com
so do i.
i don?t connect mysql database to the pega in php.
how do it?
 [2005-06-09 19:12 UTC] michael at mompopmedia dot com
For what it is worth, I can confirm the same issue building php5.0.4 on RHE 3. MySQL packages as follows:

MySQL-client-4.1.11-0
MySQL-shared-compat-4.1.11-0
MySQL-embedded-4.1.11-0
MySQL-bench-4.1.11-0
MySQL-shared-4.1.11-0
perl-DBD-MySQL-2.1021-3
MySQL-devel-4.1.11-0
MySQL-server-4.1.11-0

I'm also running Apache/1.3.33 

chris at leftbrained dot org suggestion did the trick.
 [2005-09-27 23:44 UTC] keith at green-light dot ca
Same issue on Fedora Core 2, mysql 4.1.12, and php 5.0.4. Removed the duplicated -lmysqlclient and was able to compile.
 [2005-10-30 14:45 UTC] i-marcin at tlen dot pl
I have the same problem with php-5.0.5 and MySQL 4.1 rpm`s downloaded from mysql.com.

On another machine with the same OS and the same PHP version, but with MySQL 4.1 compiled from source, the problem does not exist.

So I suggest to compile MySQL from source if any other solutions fail.
 [2005-12-03 02:29 UTC] brian at cpanel dot net
I've looked at this a while and maybe my comments can help.  I was able to reproduce this problem most machines with mysql 4.1 and using only --with-mysql and --with-mysqli and --with-apxs. This particular machine is a normal centos machine.

As mentioned earlier, -lmysqlclient is listed twice in EXTRA_LIBS in the Makefile.  This normally doesnt make a difference.  However, in this case, removing the 2nd -lmysqlclient causes it to build properly.


This is the libtool command that fails:

/bin/sh /home/cpapachebuild/buildapache/php-5.0.5/libtool --silent --preserve-dup-deps --mode=link gcc -g -O2 -prefer-non-pic  -rpath /home/cpapachebuild/buildapache/php-5.0.5/libs -avoid-version -module -L/usr/lib/mysql  -R /usr/lib/mysql ext/libxml/libxml.lo ext/ctype/ctype.lo ext/dom/php_dom.lo ext/dom/attr.lo ext/dom/document.lo ext/dom/domerrorhandler.lo ext/dom/domstringlist.lo ext/dom/domexception.lo ext/dom/namelist.lo ext/dom/processinginstruction.lo ext/dom/cdatasection.lo ext/dom/documentfragment.lo ext/dom/domimplementation.lo ext/dom/element.lo ext/dom/node.lo ext/dom/string_extend.lo ext/dom/characterdata.lo ext/dom/documenttype.lo ext/dom/domimplementationlist.lo ext/dom/entity.lo ext/dom/nodelist.lo ext/dom/text.lo ext/dom/comment.lo ext/dom/domconfiguration.lo ext/dom/domimplementationsource.lo ext/dom/entityreference.lo ext/dom/notation.lo ext/dom/xpath.lo ext/dom/dom_iterators.lo ext/dom/typeinfo.lo ext/dom/domerror.lo ext/dom/domlocator.lo ext/dom/namednodemap.lo ext/dom/userdatahandler.lo ext/iconv/iconv.lo ext/mysql/php_mysql.lo ext/mysqli/mysqli.lo ext/mysqli/mysqli_api.lo ext/mysqli/mysqli_prop.lo ext/mysqli/mysqli_nonapi.lo ext/mysqli/mysqli_fe.lo ext/mysqli/mysqli_report.lo ext/mysqli/mysqli_repl.lo ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_dfa_exec.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_info.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_printint.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_try_flipped.lo ext/pcre/pcrelib/pcre_ucp_findchar.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/php_pcre.lo ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/simplexml/simplexml.lo ext/spl/php_spl.lo ext/spl/spl_functions.lo ext/spl/spl_engine.lo ext/spl/spl_iterators.lo ext/spl/spl_array.lo ext/spl/spl_directory.lo ext/spl/spl_sxe.lo ext/sqlite/sqlite.lo ext/sqlite/sess_sqlite.lo ext/sqlite/libsqlite/src/opcodes.lo ext/sqlite/libsqlite/src/parse.lo ext/sqlite/libsqlite/src/encode.lo ext/sqlite/libsqlite/src/auth.lo ext/sqlite/libsqlite/src/btree.lo ext/sqlite/libsqlite/src/build.lo ext/sqlite/libsqlite/src/delete.lo ext/sqlite/libsqlite/src/expr.lo ext/sqlite/libsqlite/src/func.lo ext/sqlite/libsqlite/src/hash.lo ext/sqlite/libsqlite/src/insert.lo ext/sqlite/libsqlite/src/main.lo ext/sqlite/libsqlite/src/os.lo ext/sqlite/libsqlite/src/pager.lo ext/sqlite/libsqlite/src/printf.lo ext/sqlite/libsqlite/src/random.lo ext/sqlite/libsqlite/src/select.lo ext/sqlite/libsqlite/src/table.lo ext/sqlite/libsqlite/src/tokenize.lo ext/sqlite/libsqlite/src/update.lo ext/sqlite/libsqlite/src/util.lo ext/sqlite/libsqlite/src/vdbe.lo ext/sqlite/libsqlite/src/attach.lo ext/sqlite/libsqlite/src/btree_rb.lo ext/sqlite/libsqlite/src/pragma.lo ext/sqlite/libsqlite/src/vacuum.lo ext/sqlite/libsqlite/src/copy.lo ext/sqlite/libsqlite/src/vdbeaux.lo ext/sqlite/libsqlite/src/date.lo ext/sqlite/libsqlite/src/where.lo ext/sqlite/libsqlite/src/trigger.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/sunfuncs.lo ext/standard/streamsfuncs.lo ext/standard/http.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo ext/xml/compat.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_mm.lo Zend/zend_default_classes.lo Zend/zend_reflection_api.lo Zend/zend_execute.lo sapi/apache/sapi_apache.lo sapi/apache/mod_php5.lo sapi/apache/php_apache.lo main/internal_functions.lo -lcrypt -lcrypt -lmysqlclient -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lmysqlclient -lz -lcrypt -lnsl -lm -lnss_files -lnss_dns -lresolv -lnss_files -lnss_dns -lresolv -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt  -o libphp5.la



libtool ends up executing the following gcc command:

gcc -shared ext/libxml/libxml.lo ext/ctype/ctype.lo ext/dom/php_dom.lo ext/dom/attr.lo ext/dom/document.lo ext/dom/domerrorhandler.lo ext/dom/domstringlist.lo ext/dom/domexception.lo ext/dom/namelist.lo ext/dom/processinginstruction.lo ext/dom/cdatasection.lo ext/dom/documentfragment.lo ext/dom/domimplementation.lo ext/dom/element.lo ext/dom/node.lo ext/dom/string_extend.lo ext/dom/characterdata.lo ext/dom/documenttype.lo ext/dom/domimplementationlist.lo ext/dom/entity.lo ext/dom/nodelist.lo ext/dom/text.lo ext/dom/comment.lo ext/dom/domconfiguration.lo ext/dom/domimplementationsource.lo ext/dom/entityreference.lo ext/dom/notation.lo ext/dom/xpath.lo ext/dom/dom_iterators.lo ext/dom/typeinfo.lo ext/dom/domerror.lo ext/dom/domlocator.lo ext/dom/namednodemap.lo ext/dom/userdatahandler.lo ext/iconv/iconv.lo ext/mysql/php_mysql.lo ext/mysqli/mysqli.lo ext/mysqli/mysqli_api.lo ext/mysqli/mysqli_prop.lo ext/mysqli/mysqli_nonapi.lo ext/mysqli/mysqli_fe.lo ext/mysqli/mysqli_report.lo ext/mysqli/mysqli_repl.lo ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_dfa_exec.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_info.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_printint.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_try_flipped.lo ext/pcre/pcrelib/pcre_ucp_findchar.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/php_pcre.lo ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/simplexml/simplexml.lo ext/spl/php_spl.lo ext/spl/spl_functions.lo ext/spl/spl_engine.lo ext/spl/spl_iterators.lo ext/spl/spl_array.lo ext/spl/spl_directory.lo ext/spl/spl_sxe.lo ext/sqlite/sqlite.lo ext/sqlite/sess_sqlite.lo ext/sqlite/libsqlite/src/opcodes.lo ext/sqlite/libsqlite/src/parse.lo ext/sqlite/libsqlite/src/encode.lo ext/sqlite/libsqlite/src/auth.lo ext/sqlite/libsqlite/src/btree.lo ext/sqlite/libsqlite/src/build.lo ext/sqlite/libsqlite/src/delete.lo ext/sqlite/libsqlite/src/expr.lo ext/sqlite/libsqlite/src/func.lo ext/sqlite/libsqlite/src/hash.lo ext/sqlite/libsqlite/src/insert.lo ext/sqlite/libsqlite/src/main.lo ext/sqlite/libsqlite/src/os.lo ext/sqlite/libsqlite/src/pager.lo ext/sqlite/libsqlite/src/printf.lo ext/sqlite/libsqlite/src/random.lo ext/sqlite/libsqlite/src/select.lo ext/sqlite/libsqlite/src/table.lo ext/sqlite/libsqlite/src/tokenize.lo ext/sqlite/libsqlite/src/update.lo ext/sqlite/libsqlite/src/util.lo ext/sqlite/libsqlite/src/vdbe.lo ext/sqlite/libsqlite/src/attach.lo ext/sqlite/libsqlite/src/btree_rb.lo ext/sqlite/libsqlite/src/pragma.lo ext/sqlite/libsqlite/src/vacuum.lo ext/sqlite/libsqlite/src/copy.lo ext/sqlite/libsqlite/src/vdbeaux.lo ext/sqlite/libsqlite/src/date.lo ext/sqlite/libsqlite/src/where.lo ext/sqlite/libsqlite/src/trigger.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/sunfuncs.lo ext/standard/streamsfuncs.lo ext/standard/http.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo ext/xml/compat.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_mm.lo Zend/zend_default_classes.lo Zend/zend_reflection_api.lo Zend/zend_execute.lo sapi/apache/sapi_apache.lo sapi/apache/mod_php5.lo sapi/apache/php_apache.lo main/internal_functions.lo -Wl,--whole-archive /usr/lib/mysql/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a -Wl,--no-whole-archive -Wl,--rpath -Wl,/usr/lib/mysql -L/usr/lib/mysql -lcrypt -lcrypt -lresolv -lm -ldl -lnsl -lz -lm -lz -lm -lz -lcrypt -lnsl -lm -lnss_files -lnss_dns -lresolv -lnss_files -lnss_dns -lresolv -lz -lm -lcrypt /usr/lib/libxml2.so -lz -lm -lcrypt -Wl,-soname -Wl,libphp5.so -o .libs/libphp5.so


I believe the problem is in the following part of the gcc command:  '-Wl,--whole-archive /usr/lib/mysql/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a -Wl,--no-whole-archive'

Each time libtool sees -lmysqlclient its finding /usr/lib/mysql/libmysqlclient.la which has old_library=libmysqlclient.a, which points to the file /usr/lib/mysql/libmysqlclient.a.

libtool then assigns it to the variable $convenience, referring to it as a libtool convenience library:

            convenience="$convenience $dir/$old_library"
            old_convenience="$old_convenience $dir/$old_library"
            deplibs="$dir/$old_library $deplibs"
            link_static=yes

Eventually, a bash trace shows $convenience getting to set to:

+ convenience=' /usr/lib/mysql/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a'


Also, at the top of libool, you'll see:

# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"


This is how its getting passed along to gcc as:

'-Wl,--whole-archive /usr/lib/mysql/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a -Wl,--no-whole-archive'

Does it not make sense that passing this file twice will cause duplicate symbol errors?  Removing one of them from the command causes it to build correctly.

Unless we can stop libtool from listing the same file twice as convenience libraries, I think the simplest solution would be to prevent listing of -lmysqlclient in EXTRA_LIBS in the Makefile.
 [2006-06-02 16:22 UTC] francis at web-resources dot org
I had the same problem, but I solve it with this options:

./configure \
--with-mysql=shared,/path/to/mysql_config \
--with-mysqli=shared,/path/to/mysql_config

specifying "shared" tag, make and make install finish good. You must take care, you get 2 modules mysql.so and mysqli.so that you must include in your php.ini with extension=mysql.so and extension=mysqli.so
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC