Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 469942 - =net-libs/webkit-gtk-2.2.4-r200 w/ GNU gold ld: -Wl,--reduce-memory-overheads: unknown option
Summary: =net-libs/webkit-gtk-2.2.4-r200 w/ GNU gold ld: -Wl,--reduce-memory-overheads...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
: 500206 500958 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-05-15 10:48 UTC by Pacho Ramos
Modified: 2014-02-11 20:34 UTC (History)
5 users (show)

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


Attachments
Check for ld.gold before passing --reduce-... (webkit-gtk-2.2.4-r200.ebuild.patch,383 bytes, patch)
2014-02-11 09:13 UTC, Samuli Suominen (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2013-05-15 10:48:31 UTC
Even having 6 GB of RAM, a lot of swap is needed during webkit-gtk building, making my system nearly unusable during building. I think we should consider appending "--no-keep-memory" to LDFLAGS :/

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2013-05-15 10:59:45 UTC
I discovered it in:
https://git.gnome.org/browse/gnome-ostree/commit/?id=18e3f786497957cd761a5382d5f60556465de4af

Will CC toolchain to verify using this flag doesn't break something
Comment 2 SpanKY gentoo-dev 2013-05-16 02:58:38 UTC
(In reply to comment #1)

as i understand it, there shouldn't be any difference to the output
Comment 3 Gilles Dartiguelongue (RETIRED) gentoo-dev 2013-05-16 16:33:08 UTC
For ignorants like me:

       --no-keep-memory
           ld normally optimizes for speed over memory usage by caching the symbol tables of input files in memory.  This option tells ld to
           instead optimize for memory usage, by rereading the symbol tables as necessary.  This may be required if ld runs out of memory
           space while linking a large executable.


This looks appropriate here. Maybe we can have a check-reqs handle that though, I have 16G of RAM and I certainly don't want ld to start crunching my drives for no reason.
Comment 4 Pacho Ramos gentoo-dev 2013-05-16 18:28:27 UTC
I will try it next time I need to rebuild webkit-gtk (probably in next bump) ;)
Comment 5 Pacho Ramos gentoo-dev 2013-07-23 21:08:42 UTC
this is done already
Comment 6 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-02-03 04:48:16 UTC
This breaks building with gold at least when using binutils-2.24-r1 :

>>> Configuring source in /var/tmp/portage/net-libs/webkit-gtk-2.2.4/work/webkitgtk-2.2.4 ...
 * econf: updating webkitgtk-2.2.4/Source/autotools/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating webkitgtk-2.2.4/Source/autotools/config.guess with /usr/share/gnuconfig/config.guess
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-silent-rules --disable-dependency-tracking --disable-coverage --disable-debug --enable-egl --enable-geolocation --disable-gles2 --enable-video --enable-introspection --enable-jit --enable-credential_storage --enable-glx --enable-spellcheck --enable-webgl --enable-accelerated-compositing --with-gtk=3.0 --enable-dependency-tracking --disable-gtk-doc
configure: loading site script /usr/share/config.site
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for perl... /usr/bin/perl
checking for python... /usr/bin/python2.7
checking for ruby... /usr/bin/ruby
checking for bison... /usr/bin/bison
checking for mv... /bin/mv
checking for gperf... /usr/bin/gperf
checking for flex... /usr/bin/flex
checking for gawk... gawk
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/net-libs/webkit-gtk-2.2.4/work/webkitgtk-2.2.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

from config.log :
configure:3722: checking whether the C compiler works
configure:3744: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe  -Wl,--as-needed -Wl,-O1 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads conftest.c  >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ld: --reduce-memory-overheads: unknown option
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status


You *cannot* ever append random linker or compiler flags without checking that they are valid for the current linker or compiler!
Comment 7 Pacho Ramos gentoo-dev 2014-02-03 07:09:18 UTC
Is there any other ebuild explaining me what is the proper way to check for flags being supported by the linker?
Comment 8 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-02-03 07:30:19 UTC
(In reply to Pacho Ramos from comment #7)

Hm, that's a very good question :)

There is test-flag-PROG, test-flag-CC and test-flag-CXX in flag-o-matic.eclass, but it seems that they can only test compiler flags, not linker flags because they always pass the "-c" flag. Unfortunately, there is no "test-flag-LD" at the moment - so probably the best we can do right now is "$(tc-getLD) --help | grep -- --reduce-memory-overheads"
Comment 9 Pacho Ramos gentoo-dev 2014-02-03 07:48:26 UTC
Maybe flag-o-matic.eclass maintainers would be willing to implement something for testing available ldflags... or, at least, I would CC them to let them know the problem (as maybe other packages could need it in the future)
Comment 10 Alex Xu (Hello71) 2014-02-03 18:45:44 UTC
*** Bug 500206 has been marked as a duplicate of this bug. ***
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2014-02-11 08:56:50 UTC
*** Bug 500958 has been marked as a duplicate of this bug. ***
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2014-02-11 09:00:15 UTC
$summary is bogus, so I couldn't find this bug and filed a duplicate:
-Wl,--no-keep-memory is not the problem, -Wl,--reduce-memory-overheads is
Comment 13 Samuli Suominen (RETIRED) gentoo-dev 2014-02-11 09:01:25 UTC
(In reply to Pacho Ramos from comment #9)
> Maybe flag-o-matic.eclass maintainers would be willing to implement
> something for testing available ldflags... or, at least, I would CC them to
> let them know the problem (as maybe other packages could need it in the
> future)

What do you mean? -Wl,- is a CFLAGS since it's passed through gcc to ld
What the .ebuild is doing is append-flags passing CFLAGS, not LDFLAGS
So no new test is required far as I can tell
Comment 14 Samuli Suominen (RETIRED) gentoo-dev 2014-02-11 09:04:35 UTC
So changing...

append-ldflags -Wl,--reduce-memory-overheads

to...

append-ldflags $(test-flags-CC -Wl,--reduce-memory-overheads)

should do the trick. testing in a minute to be 100% sure.
Comment 15 Samuli Suominen (RETIRED) gentoo-dev 2014-02-11 09:13:34 UTC
Created attachment 370136 [details, diff]
Check for ld.gold before passing --reduce-...

this works for me. similar code is already used in ntfs-3g's ebuild to check ld.gold
Comment 16 Pacho Ramos gentoo-dev 2014-02-11 20:34:35 UTC
+  11 Feb 2014; Pacho Ramos <pacho@gentoo.org> webkit-gtk-2.2.4-r200.ebuild,
+  webkit-gtk-2.2.4.ebuild:
+  reduce-memory-overheads options is not recognized by ld.gold (#469942 by
+  Samuli Suominen)
+