Bug 16381

Summary: Makefile for RPM impossible to adjust
Product: [Retired] Red Hat Linux Reporter: kestes
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-07 19:11:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description kestes 2000-08-16 17:22:43 UTC
The makefiles for rpm are just too hard to adjust.

They are generated with both '-R' options to pass to the linker and -rpath
options to pass to libtool.  This is very confusing and difficult to
understand.

Also the -rpath options are hardcoded to be $libdir  this is hard for
me to change, could you please add a $rpath variable to the makefile
(which defaults to libdir)so that I can easily adjust the rpath 
without mucking with my libdir.

librpm_la_LDFLAGS does not inherit my LDFLAGS.  If I put additional
flags on the command line for configure they do not make it to all
the libraries I compile.

Comment 1 kestes 2000-08-16 19:21:11 UTC
there is no way to pass options directly to libtool!
I want to  pass options to configure and have libtool get them.
Here I tried '-all-static' as a LDFLAGS and  configure tries to run GCC with 
that option.  The result is failure early in the code.  Let me 
have some LIBTOOL_LINK LIBTOOL_COMPILE options to configure.

checking whether the C compiler (gcc -O2 -all-static) works... no
configure: error: installation or configuration problem: C compiler cannot
create executables.
Bad exit status from /data1/builds/1/BUILD/rpm-tmp.14121 (%build)


Comment 2 kestes 2000-08-16 22:33:12 UTC
It is very difficutl to remove the zlib and db lib shared library dependencies
on solaris. 

1) Just compiling using the defaults leaves me with dependenciecs on
these libraries.

2) I can not put them on the libtool link line, because that is an error


res03$ /bin/sh ./libtool --mode=link gcc  -Wall -O2  -o libpopt.la -rpath
/usr/local/lib  popt.lo findme.lo poptparse.lo poptconfig.lo popthelp.lo 
-L/usr/ucblib -R /usr/ucblib /usr/lib/libz.a /usr/local/lib/libdb-3.1.a  
libtool: link: cannot build libtool library `libpopt.la' from non-libtool
objects: /usr/lib/libz.a /usr/local/lib/libdb-3.1.a


3) If I add '-all-static' to LDFLAGS I get an error:

make LDFLAGS="-all-static"

/bin/sh ../libtool --mode=link gcc  -O2 -D_GNU_SOURCE -Wall -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -all-static -o
dump  dump.o ../build/librpmbuild.la   ../lib/librpm.la       
../rpmio/librpmio.la    ../popt/libpopt.la       
mkdir .libs
gcc -O2 -D_GNU_SOURCE -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wno-char-subscripts -static -o dump dump.o
../build/.libs/librpmbuild.a ../lib/.libs/librpm.a -ldb-3.1
../rpmio/.libs/librpmio.a -L/usr/local/lib -L/usr/ucblib -lnsl -lsocket -lz
../popt/.libs/libpopt.a -R/usr/local/lib -R/usr/ucblib -R/usr/local/lib
-R/usr/ucblib
Undefined                       first referenced
 symbol                             in file
dlclose                             /usr/lib/libnsl.a(netdir.o)
stpcpy                              ../rpmio/.libs/librpmio.a(rpmio.o)
dlsym                               /usr/lib/libnsl.a(netdir.o)
dlopen                              /usr/lib/libnsl.a(netdir.o)
dlerror  stpcpy                              ../rpmio/.libs/librpmio.a(rpmio.o)
dlsym                               /usr/lib/libnsl.a(netdir.o)
dlopen                              /usr/lib/libnsl.a(netdir.o)
dlerror                             /usr/lib/libnsl.a(netdir.o)
ld: fatal: Symbol referencing errors. No output written to dump
make[2]: *** [dump] Error 1
                           /usr/lib/libnsl.a(netdir.o)

3) If I add '-static' to LDFLAGS I get an error:

make LDFLAGS="-static"

/bin/sh ../libtool --mode=link gcc  -O2 -D_GNU_SOURCE -Wall -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -static -o dump 
dump.o ../build/librpmbuild.la       ../lib/librpm.la       
../rpmio/librpmio.la    ../popt/libpopt.la       
mkdir .libs
gcc -O2 -D_GNU_SOURCE -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wno-char-subscripts -o dump dump.o
../build/.libs/librpmbuild.a ../lib/.libs/librpm.a -ldb-3.1
../rpmio/.libs/librpmio.a -L/usr/local/lib -L/usr/ucblib -lnsl -lsocket -lz
../popt/.libs/libpopt.a -R/usr/local/lib -R/usr/ucblib -R/usr/local/lib
-R/usr/ucblib
Undefined                       first referenced
 symbol                             in file
stpcpy                              ../rpmio/.libs/librpmio.a(rpmio.o)
ld: fatal: Symbol referencing errors. No output written to dump


4) If I use 

make LDFLAGS="'-Wl,-Bstatic'"


/bin/sh ../libtool --mode=link gcc  -O2 -D_GNU_SOURCE -Wall -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts '-Wl,-Bstatic' -o
dump  dump.o ../build/librpmbuild.la        ../lib/librpm.la       
../rpmio/librpmio.la    ../popt/libpopt.la       
mkdir .libs
gcc -O2 -D_GNU_SOURCE -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wno-char-subscripts -Wl,-Bstatic -o .libs/dump dump.o
../build/.libs/librpmbuild.so ../lib/.libs/librpm.so -ldb-3.1
../rpmio/.libs/librpmio.so -L/usr/local/lib -L/usr/ucblib -lnsl -lsocket -lz
../popt/.libs/libpopt.so -R/usr/local/lib -R/usr/ucblib
ld: fatal: input of shared object `../build/.libs/librpmbuild.so' in static mode
ld: fatal: input of shared object `../lib/.libs/librpm.so' in static mode
ld: fatal: input of shared object `../rpmio/.libs/librpmio.so' in static mode
ld: fatal: input of shared object `../popt/.libs/libpopt.so' in static mode
ld: fatal: File processing errors. No output written to .libs/dump
make[2]: *** [dump] Error 1


Comment 3 kestes 2000-08-17 16:17:02 UTC
If I try to put the shared libraries within a -B block like this 

CFLAGS="$RPM_OPT_FLAGS" \
	./configure --prefix=%{__prefix}

make lib_LTLIBRARIES="-Wl,-Bstatic -librpm.la -Wl,-Bdynamic"  mylibs="-lrpm
-lrpmio -lpopt  -L/usr/local/lib -R/usr/local/lib  -L/usr/ucblib -R/usr/ucblib 
-lnsl -lsocket -Wl,-Bstatic -lz -Wl,-Bdynamic  $(top_builddir)/misc/libmisc.a"



I get these errors from make:

/opt/gnu/bin/msgfmt -o zh.mo zh.po
/opt/gnu/bin/msgfmt -o zh_CN.GB2312.mo zh_CN.GB2312.po
make[4]: Leaving directory `/data1/builds/1/BUILD/rpm-4.0/popt/po'
make[4]: Entering directory `/data1/builds/1/BUILD/rpm-4.0/popt'
make[4]: *** No rule to make target `-Wl,-Bstatic', needed by `all-am'.  Stop.
make[4]: Leaving directory `/data1/builds/1/BUILD/rpm-4.0/popt'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/data1/builds/1/BUILD/rpm-4.0/popt'
make[2]: *** [all-recursive-am] Error 2
make[2]: Leaving directory `/data1/builds/1/BUILD/rpm-4.0/popt'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data1/builds/1/BUILD/rpm-4.0'
make: *** [all-recursive-am] Error 2
Bad exit status from /data1/builds/1/BUILD/rpm-tmp.13848 (%build)



Comment 4 kestes 2000-08-17 18:01:54 UTC
OK I see that my earlier comment about -rpath for libtool was wrong. 

 HOWEVER there really is a problem here that I can not choose to link against
the static versions of the db or z library.  I want rpm not to load those.
Currently I have gone for an RPATH solution but I believe that rpm MUST 
allow me to link against the .a files of my chose.  This may be a bug in
libtool or in the automake makefiles or in configure.  You figure out
how you will allow me to do this, I just want a documented and supported
solution.  This bug ticket shows all my failures,  I tried all the obvious
things.





Comment 5 Paul Nasrat 2005-06-07 19:11:21 UTC
This bug is very old and deals with RPM build stuff - if you are still having an
issue please consider discussion on rpm-devel list and at your option reopen
against a more recent version of RPM


https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel