Folks,

Anybody else have a failed configure with the error:

cannot find -lmysqlclient??

Situation --

configure for mySQL & apache apxs, give accurate paths to both

CONFIGURE: \'./configure\' \'--with-mysql=/usr/local/mysql\' \'--with-apxs=/usr/local/apache/bin/apxs\'

running configure reports the following error:

gcc -o conftest -g -O2 -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib conftest.c -lmysqlclient
-lgd -lresolv -lm -ldl -lcrypt -lnsl -lresolv 1>&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status

Any insight?

    Hi,

    look at the directory /usr/local/mysql/lib:
    Is there a file called libmysqlclient.so or
    libmysqlclient.a ? . If you configured mysql to use another library path you might have to add -L<path to library> to your CFLAGS environment variable before compiling php.
    Additionally you can add a symlink

    /usr/local/mysql/lib/mysql -> <path_to_mysql_libs>

    By the way:
    Why did you put those \' around the parts of you configure call ?

    T.

      16 days later

      I'm having the same problem with the compile ending with:

      cannot find -lmysqlclient

      I found libmysqlclient.a in the /usr/local/mysql/lib directory.

      Can you clarify this a little for me? I've looked everywhere for a way to fix this.

        I can't clarify becuase I've kept myself on 4.0.1pl2, it was just too much of a time sink to get 4.0.2 to work.

          2 months later

          I have the same problem on my RH 6.2, but not Mandrake 7.0. I don't know why. Have you fixed it yet?

            Yes -- I did manage to fix it (translation: I pulled a fast one that has not yet caught up to me after a few weeks of successfully running).

            I went into
            /usr/local/mysql/lib

            where I found a file
            libmysqlclient.so.9

            which I renamed to:
            libmysqlclient.so

            made fine after that, and I've seen no bad repercussions in any of our other code.

              Thanks! It turns out there are many reasons that cause "cannot find -lmysqlclient". I saw another 2 threads on Internet. One says that it works after copying those *mysqlclient files to /usr/lib/mysql directory. The other solution is to modify the '-L/<path-to-the-libmysqlclient>', if have this set to -L/usr/local/lib/mysql in Setup.in.

              I have never tried these 2 ways, but I will try your way first. Thanks again!

              Billy

                I finally have my PHP4 compiled. I also talked to some PHP users regarding tje various compiling error in the thread.

                Like you case, there should be a libmysqlclient.so in the directory and link to the libmysqlclient.so.9. It will still work if you rename the ext fro so.9 to so, but you lose track on the version.

                For the other user, copying the so or a files from the /usr/local/mysql/lib to /usr/lib may solve the problem, but this will mix up with system library files. I will suggest to add </usr/local/mysql/lib/> to the LD_LIBRARY_PATH in your .cshrc file so that the Makefile will find the lib files depend on the search path.

                Anyway, I feel good that I finally make PHP4 working and I learned so many from making mistakes in the installation.

                Billy

                  3 months later

                  I ran into this problem today trying to get PHP running on a new RH 6.2... First, I had to edit to config_vars.mk and add the full path to the mysqlclient.so to the EXTRA_LDFLAGS variable before running make. Then, because apache couldn't find the lib when I tried to start up, I had to add that path to ld.so.conf and run ldconfig.

                  I hope this helps some of you other folks out.

                  -F

                    a year later

                    I tried the same and it worked. Thanks to this forum 🙂

                    radio:~# cd /usr/lib/
                    radio:/usr/lib# ln -s libmysqlclient.so.10 libmysqlclient.so

                    Thomas 
                      a month later

                      Oh noooooooooooo!!!

                      I am facing the same problem. I have tried all solution sujested in this forum but still unable to configure php4.1.2.

                      I am useing Apache 1.3.12 ,RedHat Linux 7.2,mysql.

                      ./configure is fine but when i try make it it will disaply an error messages:-

                      /usr/bin/ld: cannot find -lmysqlclient
                      collect2: ld returned 1 exit status
                      make[1]: [libphp4.la] Error 1
                      make[1]: Leaving directory `/usr/local/src/php-4.1.2'
                      make:
                      [all-recursive] Error 1

                      i have tried to find out libmysqlclient.so or libmysqlclient.so.9 or libmysqlclient.so.10 but these files are not available on the server i got only one file named libmysqlclient.a in /usr/lib/mysql folder .
                      I tried to rename libmysqlclient.a to libmysqlclient.so but still get the same problem. i also reset the EXTRA_LDFLAGS=/usr/lib/mysql in config_vars.mk and try make but still not successfull.

                      I am really very thankful to the person who help to overcome from this crucial problem.

                      Waiting for ur response

                      Dhirendra

                        Write a Reply...