* Simbasaurus wrote on Fri, Feb 01, 2008 at 11:04:39AM CET:
> 
> libmylib2.so depends on libmylib1.so, and main depends on libmylib2.so
> 
> The Makefile.am in myproject/src/lib2 is :
> 
> bin_PROGRAMS = libmylib2.so
> libmylib2_so_SOURCES = s2.cpp
> 
> libmylib2_so_CXXFLAGS = -shared -fPIC -Wall -O0 -I../lib1
> libmylib2_so_DEPENDENCIES = ../lib1/libmylib1.so
> libmylib2_so_LDFLAGS = -L../lib1 -lmylib1 -Wl,-rpath-link,../lib1
> 
> BUT i always get this warning when i compile:
> 
> /usr/bin/ld: warning: libmylib1.so, needed by
> myproject/src/lib2/libmiha2.so, not found (try using -rpath or -rpath-link)

What command outputs this?  Does the library libmylib1.so exist at this
time?

> And also the symbols from libmylib1.so are undefined when i try to build
> main.
> 
> Does anyone have an insight regarding this situation?

Why are you not using Libtool?  Put AC_PROG_LIBTOOL in configure.ac, run
libtoolize, and use this in Makefile.am:
  lib_LTLIBRARIES = libmylib2.la
  libmylib2_la_SOURCES = s2.cpp
  libmylib2_la_CPPFLAGS = -I../lib1
  libmylib2_la_CXXFLAGS = -Wall -O0
  libmylib2_so_LIBADD = ../lib1/libmylib1.la

You can then drop the libmylib2_so_DEPENDENCIES setting, too.

Cheers,
Ralf


Reply via email to