php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13902 ld: "cannot find -lmysqlclient" (-L flag missing)
Submitted: 2001-11-01 16:44 UTC Modified: 2001-11-22 05:50 UTC
From: jasonw at rpdesign dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.0.6 OS: RedHat Linux 2.4.7-10 #1 i686
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: jasonw at rpdesign dot com
New email:
PHP Version: OS:

 

 [2001-11-01 16:44 UTC] jasonw at rpdesign dot com
Short version:

I ran ./configure with --with-mysql=/usr (among other things... see below)

I got a compiler error (output below) that said "cannot find -lmysqlclient".

I believe this is because the compile command (below) should contain "-L/usr/lib/mysql". this flag is in config_vars.mk as follows:
MYSQL_LIBS = -L/usr/lib/mysql -lmysqlclient -L/usr -z

I also found this line in config_vars.mk:
PHP_RPATHS = /usr/lib/mysql

I wonder if that should have a -L in it...


------------
  Solution   (ok hack...)
------------
I got php to compile by adding -L/usr/lib/mysql to the following line in config_vars.mk starting with "EXTRA_LIBS = "

---------------
  References
---------------
Firstly, all the options I passed to ./configure:

./configure 'i386-redhat-linux' '--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' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-bz2' '--with-curl' '--with-db3' '--with-dom' '--with-exec-dir=/usr/bin' '--with-gd' '--with-gdbm' '--with-gettext' '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-regex=system' '--with-ttf' '--with-zlib' '--with-layout=GNU' '--enable-debugger' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-wddx' '--with-mysql=/usr' '--without-unixODBC' '--without-oracle' '--without-oci8' '--with-xml'




Seccondly, the relivant bit of the output from make:

Making all in .
make[1]: Entering directory `/home/jason/software/php-4.0.6'
/bin/sh /home/jason/software/php-4.0.6/libtool --silent --mode=link gcc  -I. -I/home/jason/software/php-4.0.6/ -I/home/jason/software/php-4.0.6/main/home/jason/software/php-4.0.6 -I/usr/include/apache -I/home/jason/software/php-4.0.6/Zend -I/include -I/usr/include/mysql -I/home/jason/software/php.0.6/ext/xml/expat/xmltok -I/home/jason/software/php-4.0.6/ext/xml/expat/xmlparse -I/home/jason/software/php-4.0.6/TSRM  -DLINUX=22 -DEAPI -DEAPI_MMUSE_EXPAT -DEAPI_MM_CORE_PATH=/var/run/httpd.mm -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2   -o libphp4.la -rpath /home/jason/software/php-4.0.6/libsvoid-version  /usr/lib/mysql stub.lo  Zend/libZend.la sapi/apache/libsapi.la main/libmain.la  ext/zlib/libzlib.la ext/bz2/libbz2.la ext/curl/libcurl. ext/dba/libdba.la ext/domxml/libdomxml.la ext/ftp/libftp.la ext/gd/libgd.la ext/gettext/libgettext.la ext/mysql/libmysql.la ext/openssl/libopenssl.lext/pcre/libpcre.la ext/posix/libposix.la ext/session/libsession.la ext/sockets/libsockets.la ext/standard/libstandard.la ext/sysvsem/libsysvsem.la e/sysvshm/libsysvshm.la ext/wddx/libwddx.la ext/xml/libxml.la ext/yp/libyp.la TSRM/libtsrm.la -lpam -ldl -lmm -lmysqlclient -lz -lgd -ljpeg -lz -lxml2ldb -lgdbm -lcurl -ldl -lcrypto -lssl -lbz2 -lz -lcrypt -lssl -lcrypto -lresolv -lm -ldl -lnsl -lresolv
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make[1]: *** [libphp4.la] Error 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-01 22:26 UTC] sniper@php.net
Could you please try latest CVS? I fixed one thing
which might have caused this.

--Jani

 [2001-11-22 05:50 UTC] sander@php.net
No feedback. Closing.
 [2002-10-16 10:03 UTC] yves_boisjoly at sympatico dot ca
I was using RedHat 7.3 and I did compile with success all of these packages previously :

   MySQL 3.23.52
   Apache 1.23.26
   Mod_Php 4.2.2

All package are compiled with --prefix=/soft/<Package_name>

Now, after having installed RedHat 8.0, I can't compile MySQL myself anymore since GCC 3.2 is now used with RedHat 8.0 and MySQL doesn't suggest compile itself with another version of gcc than the 2.95 version!

So I decided to use the MySQL version included with RedHat 8.0. I compiled with success the latest Apache version "2.0.43".

When I am trying to compile Mod_Php 4.2.3 with these parameters :

CC="gcc" OPTIM="-O3" ./configure --prefix=/soft/Mod_Php \
--disable-debug \
--disable-rpath \
--enable-debugger \
--enable-ftp \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-pic \
--disable-safe-mode \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \ 
--enable-track-vars \
--enable-wddx \
--enable-yp \
--with-apxs2=/soft/Apache/bin/apxs \
--with-bz2 \
--with-curl \
--with-db3 \
--without-dom \
--with-exec-dir=/soft/Mod_Php/bin \
--with-gd \
--with-gdbm \
--with-gettext \
--with-jpeg-dir=/usr \
--with-layout=GNU \
--without-mm \
--with-openssl \
--with-mysql="/usr" \
--without-oci8 \
--without-oracle \
--without-unixODBC \
--with-png \
--with-pspell \
--with-regex=system \
--with-ttf \
--with-xml \
--with-zlib

I have exactly the same error message as you said!

But, comparing my old MySQL structure and the new one from RedHat 8.0, I noticed that there is a file named "/soft/MySQL/lib/mysql/libmysqlclient.la" that is missing under "/usr/lib/mysql". Here is the content of this file :

========================================================
# libmysqlclient.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=''

# Names of this library.
library_names=''

# The name of the static archive.
old_library='libmysqlclient.a'

# Libraries that this one depends upon.
dependency_libs=' -lz -lcrypt -lnsl -lm'

# Version information for libmysqlclient.
current=11
age=0
revision=0

# Is this an already installed library?
installed=yes

# Directory that this library needs to be installed in:
libdir='/soft/MySQL/lib/mysql'
========================================================

I copied this file under "/usr/lib/mysql" and I changed the last line for this :

  libdir='/usr/lib/mysql'

And the "make" has pass since!!!

Yves
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 07:01:28 2024 UTC