Re: /usr/bin/ld cannot locate libmysqlclient, when it is there



saurabh wrote:
Hi all,

I am working on a c++ application, porting it from solaris 8 to linux
9, using gcc version 3.4.3 20050227.

I am getting error of;
---------------------------------
c++ -g ----followed by other .o files ----- -lmysqlclient -o
../../myapp
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [../../myapp] Error 1
--------------------------------

I am using a makefile to compile and build the application... some of
the makefile details (relevant) are as below;
----------------------------------
SRCPATH = ..
FORMATSRCPATH = ../../../myapp1/src
MYSQLPATH = ../../../../thirdparty/mysql
MYSQLLIBS = $(MYSQLPATH)/lib/mysql

VPATH = $(SRCPATH):$(FORMATSRCPATH):$(MYSQLLIBS)

CC = c++
CFLAGS = -g
CPPFLAGS = $(DEFS) $(PATHS)

PATHS = \
-I$(SRCPATH) \
-I$(FORMATSRCPATH) \
-I$(MYSQLPATH)/include/mysql

$(TARGETNAME): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -lmysqlclient -o $(TARGETNAME)

-------------------------------------------
If i append the "-lmysqlclient" with "-L$(MYSQLLIBS)" it builds fine,
but i am not getting why it is not being picked up from the VPATH.

All other directory paths are being picked up from VPATH(i've verified
that), as commenting VPATH or changing it gives complication error.

The compiler does not know about VPATH. It needs to be told,
via -L flags, where to look for libraries not in the standard
library search path.

VPATH is for instructing 'make' where to search for dependencies.
.



Relevant Pages

  • Re: /usr/bin/ld cannot locate libmysqlclient, when it is there
    ... but i am not getting why it is not being picked up from the VPATH. ... library search path. ... Note that GNU make does special processing for -lNAME prerequisites. ... See the GNU make info under: ...
    (comp.os.linux.development.apps)
  • Re: VPATH and -lNAME dependency in Makefile
    ... make to invoke gcc, which is pretty standard. ... yourapplication: a.c libmylib ... in directories specified by matching `vpath' search paths ...
    (comp.os.linux.development.apps)
  • Re: GNU make Error1
    ... #vpath %.c src ... #vpath %.h include ... gcc -c mymod.o mymath.c ... .PHONY: clean ...
    (comp.unix.shell)
  • GNU make Error1
    ... I am having a project folder in which contains ... #vpath %.c src ... #vpath %.h include ... gcc -c mymod.o mymath.c ...
    (comp.unix.shell)
  • /usr/bin/ld cannot locate libmysqlclient, when it is there
    ... collect2: ... the makefile details are as below; ... but i am not getting why it is not being picked up from the VPATH. ... All other directory paths are being picked up from VPATH(i've verified ...
    (comp.os.linux.development.apps)