I hope I'm posting to the right group with this question. I appoligize
for the length, please let me know if you need more info. :)
My problem is that when I try to build (of my custom app), the linker
looks for the a lib (popt) in the wrong place. I have rpm 4.0.4 insalled
(and thus popt 1.6.4), redhat 7.2.
I have two subdirs of my application that both make use of the popt lib.
One works fine (if I specify the exact path to the library in my
Makefile.am), the other fails with a link error (below).
The "working" Makefile.am has:
LIBS = -L/usr/lib -lCryptoki2 /usr/lib/libpopt.so -ldl
The other one has (it uses a few more dynamic libs):
LIBS = -L/usr/lib /usr/lib/libpopt.so -lCryptoki2 -lssl -lcrypto
-lrpm -lrpmbuild -lrpmdb -lrpmio -ldl
First, you may ask why I am using the full path of hte popt lib in my
file. I ask this too --- but it works... in the first case. (Without the
full path it went looking in /usr/lib/./libs for libpopt.so).
When I do a make in the 'bad' dir, I get the following error:
-L/usr/lib -lCryptoki2 -lssl -lcrypto /usr/lib/librpmbuild.so
/usr/lib/librpm.so /usr/lib/librpmdb.so /usr/lib/librpmio.so
/usr/lib/.libs/libpopt.so -L/usr/local/lib -lz -lbz2 -lrt -lpthread -ldl
-Wl,--rpath -Wl,/usr/local/lib
c++: /usr/lib/.libs/libpopt.so: No such file or directory
I've searched (grep) through all my files in the tree to references to
.lib to see where it could be getting this, but I couldn't find
anything. I've done several rounds of make clean, make distclean, then
redoing the autoconf/configure stuff. I'm not an automake/autoconf guru
my any means, but I am very frustrated that I haven't been able to
figure this out.
The only other clue that I have is that I have made a special popt
package that replaces the libpopt.so and popt.h files. When popt builds
(from the popt-1.6.4.tar.gz file), it puts its binaries in .libs. I copy
them from there during my make rpm with the following (sorry for the
ugliness, I'm unsure of a better way to do this). Is there something in
my RPM construction that is causing this? (You can see below that I have
also tried copying the files from the .libs dir before grabbing them for
packaging.)
Makefile.am excerpt
==============
RPM_PATH=/tmp/CITS-rpm
ROOT_PATH=$(RPM_PATH)/temp
LUNA_PATH=$(ROOT_PATH)
rpm:
rm -rf $(RPM_PATH)
mkdir -p $(LUNA_PATH)/lib
mkdir -p $(LUNA_PATH)/include
mkdir -p $(LUNA_PATH)/local/include
#cp libs/libpopt.so.0.0.0 .
#mv libpopt.so.0.0.0 $(LUNA_PATH)/lib
cp .libs/libpopt.so.0.0.0 $(LUNA_PATH)/lib
cp ./libs/libpopt.a .
cp .libs/libpopt.la $(LUNA_PATH)/lib
cp popt.h $(LUNA_PATH)/include
cp popt.h $(LUNA_PATH)/local/include
VER=1.6.4; \
mv $(RPM_PATH)/temp "$(RPM_PATH)/popt-$$VER/" ; \
cd $(RPM_PATH) ; \
tar -czvf "./popt-$$VER.tar.gz" ./popt-"$$VER"/* ; \
cp "./popt-$$VER.tar.gz" /usr/src/redhat/SOURCES/
rpm -bb ./popt-rpm.spec
spec file excerpt:
===========
%prep
%setup
%build
%install
mkdir -p $RPM_BUILD_ROOT/%{_prefix}
mkdir -p $RPM_BUILD_ROOT/%{_prefix_h}
mkdir -p $RPM_BUILD_ROOT/%{_prefix_h2}
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/lib/libpopt.so.0.0.0
$RPM_BUILD_ROOT/%{_prefix}/libpopt.so.0.0.0
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/lib/libpopt.a
$RPM_BUILD_ROOT/%{_prefix}/libpopt.a
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/lib/libpopt.la
$RPM_BUILD_ROOT/%{_prefix}/libpopt.la
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/include/popt.h
$RPM_BUILD_ROOT/%{_prefix_h}/popt.h
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/include/popt.h
$RPM_BUILD_ROOT/%{_prefix_h2}/popt.h
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%post
%files
/usr/lib/libpopt.so.0.0.0
/usr/lib/libpopt.a
/usr/lib/libpopt.la
/usr/include/popt.h
/usr/local/include/popt.h
%postun
Any advice is appreciated.
- Brigitte