Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 132023 - epiphany-2.14.{0,1} fail to compile with --as-needed
Summary: epiphany-2.14.{0,1} fail to compile with --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2006-05-02 07:23 UTC by Mike Auty (RETIRED)
Modified: 2006-05-03 14:46 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
epiphany-as-needed-fix.patch (epiphany-as-needed-fix.patch,616 bytes, patch)
2006-05-02 11:44 UTC, Gergan Penkov
Details | Diff
epiphany-2.14.1.ebuild.patch (epiphany-2.14.1.ebuild.patch,859 bytes, patch)
2006-05-02 11:46 UTC, Gergan Penkov
Details | Diff
files/epiphany-2.14.1-as-needed.patch (alternative patch) (epiphany-2.14.1-as-needed.patch,883 bytes, patch)
2006-05-02 12:28 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Auty (RETIRED) gentoo-dev 2006-05-02 07:23:44 UTC
Hi, when attempting to compile epiphany-2.14.1 (and also previously with 2.14.0) with LDFLAGS set to "-Wl,--as-needed", epiphany fails during the configure stage stating that XPCOM programs either can't be compiled or run (interestingly both mozilla-firefox and mozilla-thunderbird compile and build fine, so perhaps they hold the solution).   Below is the error message:

checking whether we have a gecko debug build... no
checking for gecko version... 1.8
checking for GECKO... yes
checking whether we can compile and run XPCOM programs... no
configure: error: Cannot compile and run XPCOM programs
See `config.log' for more details.

And here's the relevant snippet from the config.log file:

configure:23400: checking whether we can compile and run XPCOM programs
configure:23508: i686-pc-linux-gnu-g++ -o conftest -mtune=pentium4 -march=pentium4 -O2 -fomit-frame-pointer -fno-rtti -fshort-wchar     -I/usr/lib/mozilla-firefox/include -I/usr/lib/mozilla-firefox/include -I/usr/lib/mozilla-firefox/include/xpcom -I/usr/lib/mozilla-firefox/include/string -I/usr/include/nspr   -I/usr/lib/mozilla-firefox/include/dom -I/usr/lib/mozilla-firefox/include/necko -I/usr/lib/mozilla-firefox/include/pref -Wl,--as-needed  -Wl,-R/usr/lib/mozilla-firefox -Wl,-R/usr/lib/nspr -L/usr/lib/mozilla-firefox -L/usr/lib/nspr -lxpcom -lplds4 -lplc4 -lnspr4 -lpthread -ldl   -Wl,--rpath=/usr/lib/mozilla-firefox conftest.cc  >&5
/var/tmp/portage/epiphany-2.14.1/temp/ccjIHx8O.o: In function `main':
conftest.cc:(.text+0x5a): undefined reference to `nsCOMPtr_base::begin_assignment()'
conftest.cc:(.text+0x80): undefined reference to `NS_CStringContainerInit2'
conftest.cc:(.text+0x94): undefined reference to `NS_NewNativeLocalFile'
conftest.cc:(.text+0x9e): undefined reference to `NS_CStringContainerFinish'
conftest.cc:(.text+0xc2): undefined reference to `NS_InitXPCOM2'
conftest.cc:(.text+0xd2): undefined reference to `NS_ShutdownXPCOM'
conftest.cc:(.text+0xf3): undefined reference to `nsCOMPtr_base::~nsCOMPtr_base()'
conftest.cc:(.text+0x107): undefined reference to `NS_CStringContainerFinish'
collect2: ld returned 1 exit status

If anyone needs the full thing I'll be happy to provide it.  As mentioned mozilla-firefox-1.5.0.2 doesn't seem to fail with this problem, but the only patch I could find that appeared relevant to as-needed was the following:

--- mozilla/embedding/browser/gtk/tests/Makefile.in.orig        2005-02-04 00:01:41.000000000 +0100
+++ mozilla/embedding/browser/gtk/tests/Makefile.in     2006-04-28 05:21:10.000000000 +0200
@@ -75,6 +75,8 @@
 endif
 endif

+OS_LDFLAGS += -Wl,-rpath-link,'$(DEPTH)/dist/bin'
+
 ifdef MOZ_ENABLE_GTK
 LIBS           += \
                -lgtkembedmoz \

And I don't know whether or how that would help here.  I'm afraid I don't really know where to start with this once since I don't know how configure scripts are generated or how the test command lines are built up, so any help would be appreciated.  Thanks!  5:)
Comment 1 Patrizio Bassi 2006-05-02 09:31:49 UTC
same here too.
Comment 2 Gergan Penkov 2006-05-02 11:44:35 UTC
Created attachment 86007 [details, diff]
epiphany-as-needed-fix.patch

patch also the diff to the ebuild coming soon
Comment 3 Gergan Penkov 2006-05-02 11:46:46 UTC
Created attachment 86008 [details, diff]
epiphany-2.14.1.ebuild.patch

the diff
Comment 4 Gergan Penkov 2006-05-02 11:48:56 UTC
As I already said, there is a bug in this version of binutils, if you look at the patch you will clearly see where is the problem, so instead of patching all the world, it is simply better to upstream the issue as this effort goes invain.
I've removed the -Wl,rpath... and so on as we already supply this through the pkg-config files.
Comment 5 TGL 2006-05-02 12:27:30 UTC
I disagree with your understanding of the issue, and patch.  What you do is just cancelling --as-needed effects by putting it after the various -llib arguments (you could as well have used -Wl,--no-as-needed).

The real problem is imo that overloading LDFLAGS the way this m4/gecko.m4 macros do  is wrong. Listing the libs in the LIBS variable instead makes AC_RUN_IFELSE do the right thing with linker arguments ordering, and gives a successfull test while preserving the --as-needed option.

I will attach a patch which does that.
Comment 6 TGL 2006-05-02 12:28:19 UTC
Created attachment 86013 [details, diff]
files/epiphany-2.14.1-as-needed.patch (alternative patch)
Comment 7 Gergan Penkov 2006-05-02 12:46:17 UTC
(In reply to comment #5)
> I disagree with your understanding of the issue, and patch.  What you do is
> just cancelling --as-needed effects by putting it after the various -llib
> arguments (you could as well have used -Wl,--no-as-needed).
> 
> The real problem is imo that overloading LDFLAGS the way this m4/gecko.m4
> macros do  is wrong. Listing the libs in the LIBS variable instead makes
> AC_RUN_IFELSE do the right thing with linker arguments ordering, and gives a
> successfull test while preserving the --as-needed option.
> 
> I will attach a patch which does that.
> 
Are you sure? I'm really not an expert, but there was a difference in the linked libraries in the produced conftest, you could try it yourself. And the other thing is that all this is used only in the tests and not in the compilation of epiphany.
Comment 8 TGL 2006-05-02 12:58:27 UTC
(In reply to comment #7)
> Are you sure? I'm really not an expert, but there was a difference in the
> linked libraries in the produced conftest, you could try it yourself.

A difference beetween what and what? All i say is that linking with "-lfoo -lbar -Wl,--asneeded" (what your patch does) is basically the same as linking with "-Wl,--as-needed -Wl,--no-as-needed -lfoo -lbar", or even just "-lfoo -lbar". In short, it doesn't test whether linking libxpcom with --as-needed is working.

> And the other thing is that all this is used only in the tests and not 
> in the compilation of epiphany.

Hiding issues where ./configure is trying to detect them is not a good idea in general.  For instance, you could get a linking error later in the build process if libxpcom has some unresolved symbols which are provided by one of the other linked libs (because without --as-needed, the libs are linked anyway, thus it works, but with --as-needed they may not be, thus it may fail).
Comment 9 Gergan Penkov 2006-05-02 13:09:56 UTC
Comment on attachment 86007 [details, diff]
epiphany-as-needed-fix.patch

you are right :)
Comment 10 Gergan Penkov 2006-05-02 13:17:03 UTC
but than I still don't understand why I have differences, so could someone explain ?
with your patch 5 libs (working):
 0x00000001 (NEEDED)                     Shared library: [libxpcom.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libxpcom_core.so]
with my patch 10 libs (not working):
 0x00000001 (NEEDED)                     Shared library: [libxpcom.so]
 0x00000001 (NEEDED)                     Shared library: [libplds4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libplc4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libnspr4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libxpcom_core.so]
and with original line only --as-needed removed 11 libs (even more not working):
 0x00000001 (NEEDED)                     Shared library: [libxpcom.so]
 0x00000001 (NEEDED)                     Shared library: [libplds4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libplc4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libnspr4.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libxpcom_core.so]

The original line links to libm.so.6, I could provide the tests and commands used, it is only the place of the directives (and of course the last one doesn't have --as-needed at all)
Comment 11 Gergan Penkov 2006-05-02 13:39:33 UTC
nevermind I have read the TFM :)
Comment 12 Mike Auty (RETIRED) gentoo-dev 2006-05-03 02:16:57 UTC
Thanks TGL the second patch worked a charm...
Comment 13 TGL 2006-05-03 13:06:49 UTC
FYI, i've sent this upstream:
http://bugzilla.gnome.org/show_bug.cgi?id=340560
Comment 14 Daniel Gryniewicz (RETIRED) gentoo-dev 2006-05-03 14:46:19 UTC
Fixed in 2.14.1, with no bump.