Closed Bug 653178 Opened 13 years ago Closed 13 years ago

bogus -L/lib and -Wl,-rpath-link,${OBJDIR}/dist/bin ld(1) options appended to libxul link command

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jason.vas.dias, Unassigned)

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b13pre) Gecko/20110415 Firefox/4.0b13pre Build Identifier: Trying to build xulrunner 2.0b13pre on a Linux x86_64 platform in 32-bit mode currently fails - see other bugzilla #652807 about other problems I found that needed to be fixed in order for this bug to be exposed but finally, when the build gets to the libxul.so link command line generated by "make", it fails because of bad -L/usr/lib and -Wl,-rpath_link,${MOZ_OBJDIR}/dist/lib options inserted on the command line. My pkg-config in this environment for all the advertised mozilla dependencies is: $ pkg-config --libs gtk+-2.0 x11 cairo libevent libIDL-2.0 pixman-1 -pthread -L/usr/lib32 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lX11 -lcairo -levent -lIDL-2 -lglib-2.0 -lpixman-1 I have checked and triple-checked that ALL dependencies for these libraries are installed in /usr/lib32 - -L/usr/lib32 is the ONLY -L option needed to link against ALL the above packages . So why does the mozilla build insert this into the libxul link line: " -Wl,-rpath-link,/home/firefox/x86/dist/bin -Wl,-rpath-link,/usr/lib -Wl,-rpath-link,/home/firefox/x86/dist/bin -Wl,-rpath-link,/usr/lib -Wl,-rpath-link,/home/firefox/x86/dist/bin -Wl,-rpath-link,/usr/lib -Wl,-rpath-link,/home/firefox/x86/dist/bin -Wl,-rpath-link,/usr/lib " wow, the mozilla build system really wants this string included in the link line so it repeats it four times !! But it breaks the link because the 64-bit versions of the libraries are picked up by -L/usr/lib and because specifying any -rpath or -rpath-link into directories in the $OBJDIR is broken and dangerous - the libxul.so will have a DT_RUNPATH of /home/firefox/x86_64/dist/bin , so anyone can break my xulrunner installation by copying bad versions of the firefox shared libraries into that directory. I'll attach two files : the broken libxul.so link line copied from the make log : the fixed libxul.so link line . Reproducible: Always Steps to Reproduce: try to build libxul.so for i686 on x86_64 Actual Results: fails because of bogus link options Expected Results: a 32-bit libxul.so ready to link to libraries in $LIBDIR = /usr/lib32
> So why does the mozilla build insert this into the libxul link line: > " > -Wl,-rpath-link,/home/firefox/x86/dist/bin -Wl,-rpath-link,/usr/lib Including dist/bin is necessary in some cases to pick up libraries which are referenced indirectly from the Mozilla build. It is not possibly harmful. I don't know where /usr/lib came from (you should check autoconf.mk to figure out what variable contains which should probably instead contain /usr/lib32 or nothing. > -rpath-link into directories in the $OBJDIR is broken and dangerous - > the libxul.so will have a DT_RUNPATH of /home/firefox/x86_64/dist/bin , Note that this is -rpath-link, *not* -rpath. It only affects searching at link time, and does not embed DT_RUNPATH.
not only -rpath-link, but lots of later -L/usr/lib later on had to be edited out - the original libxul link line contained : -L/usr/lib -lz -L/usr/lib -levent -lasound -lrt -L../../dist/bin -L../../dist/lib -L/home/firefox/x86/dist/lib -lplds4 -lplc4 -lnspr4 -lpthread -ldl -L../../dist/lib -lmozalloc -L/usr/lib32 -ldbus-1 -lpthread -lrt -pthread -L/usr/lib32 -L/usr/lib -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 -L/usr/lib64 -lX11 -lXext -pthread -L/usr/lib32 -lpangoft2-1.0 -lfreetype -lfontconfig -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 where is this crazy ' -L/usr/lib ' ... ' -L/usr/lib32 ' ... ' -L/usr/lib64 ' stuff coming from ? My $LDFLAGS are just: $ echo $LDFLAGS -m32 -Wl,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/lib32,-L/usr/lib32,-L/lib32,-R/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32:/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/lib32:/usr/lib32:/lib32,--dynamic-linker,/lib32/ld-linux.so.2 $ echo $PKG_CONFIG_PATH /usr/lib32/pkgconfig $ pkg-config zlib --libs -L/usr/lib32 -lz
Hmm ... maybe because $PKG_CONFIG_PATH is not exported via client.mk as for bug #652807 ?
It's coming from some pkgconfig check, yes. I don't know which one, but you can figure out by tracing the data back from autoconf.mk or perhaps the configure logs themself. Anyway, this is not a bug in the libxul link itself.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
RE: Comment #2 - OK, yes, sorry about -rpath-link $OBJDIR/dist/bin - but -rpath-link /lib is still a problem , and thank you for the info about autoconf.mk, which, as you say, does show where all these link args come from: $ grep usr/lib ~/x86/config/autoconf.mk ... # let's take the problems one by one : MOZ_LIBEVENT_LIBS = -L/usr/lib -levent but I've exported $PKG_CONFIG_PATH : $ export -p | grep PKG_CONFIG_PATH declare -x PKG_CONFIG_PATH="/usr/lib32/pkgconfig/" $ pkg-config libevent --libs -L/usr/lib32 -levent so that shows that my exported $PKG_CONFIG_PATH setting when I ran 'client.mk' does NOT take effect in the sub-make or rule command that creates "autoconf.mk" from autoconf.mk.in . And ditto for the remaining autoconf.mk link flags : XLDFLAGS = -L/usr/lib64 HOST_LIBIDL_CFLAGS = -pthread -I/usr/include/libIDL-2.0 -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include HOST_LIBIDL_LIBS = -pthread -L/usr/lib32 -lIDL-2 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 JPEG_LIBS = -L/usr/lib -ljpeg ZLIB_LIBS = -L/usr/lib -lz BZ2_LIBS = -L/usr/lib -lbz2 MOZ_GTK2_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/lib32/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm -I/usr/include/gtk-unix-print-2.0 MOZ_GTK2_LIBS = -pthread -L/usr/lib32 -lgtk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lfreetype -lfontconfig -lgdk-x11-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lpango-1.0 -lcairo -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 MOZ_DBUS_CFLAGS = -I/usr/include/dbus-1.0 -I/usr/lib32/dbus-1.0/include MOZ_DBUS_LIBS = -L/usr/lib32 -ldbus-1 -lpthread -lrt MOZ_DBUS_GLIB_CFLAGS = -pthread -I/usr/include/dbus-1.0 -I/usr/lib32/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include MOZ_DBUS_GLIB_LIBS = -pthread -L/usr/lib32 -L/usr/lib -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 MOZ_GTHREAD_CFLAGS = -pthread -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include MOZ_GTHREAD_LIBS = -pthread -L/usr/lib32 -lgthread-2.0 -lrt -lglib-2.0 MOZ_PANGO_CFLAGS = -pthread -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng15 -I/usr/include/libdrm MOZ_PANGO_LIBS = -pthread -L/usr/lib32 -lpangoft2-1.0 -lfreetype -lfontconfig -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 MOZ_LIBNOTIFY_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib32/dbus-1.0/include -I/usr/lib32/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm MOZ_LIBNOTIFY_LIBS = -pthread -L/usr/lib32 -L/usr/lib -lnotify -lgtk-x11-2.0 -ldbus-glib-1 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgmodule-2.0 -ldbus-1 -lpthread -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 GLIB_CFLAGS = -pthread -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include GLIB_LIBS = -pthread -L/usr/lib32 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 LIBIDL_CFLAGS = -pthread -I/usr/include/libIDL-2.0 -I/usr/include/glib-2.0 -I/usr/lib32/glib-2.0/include LIBIDL_LIBS = -pthread -L/usr/lib32 -lIDL-2 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 'pkg-config --libs' prefixes ALL of these package's flags with '-L/usr/lib32' IFF PKG_CONFIG_PATH=/usr/lib32/pkgconfig - I've double-checked .
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: