bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

mozgtk stub libraries lose their necessary dependency on gtk when building with -Wl,--as-needed

RESOLVED FIXED in Firefox 32

Status

Firefox Build System
General
RESOLVED FIXED
4 years ago
5 months ago

People

(Reporter: glandium, Assigned: glandium)

Tracking

unspecified
mozilla33
x86_64
Linux

Firefox Tracking Flags

(firefox32 fixed, firefox33 fixed)

Details

(Whiteboard: [npotb])

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
While -Wl,--as-needed is not our default, I've been using it in Debian packages for a while, and it works well. I plan to make that the default on our builds too, but I need to ensure this works on android and b2g before that, and I want this fix in the tree independently.
(Assignee)

Comment 1

4 years ago
Created attachment 8436579 [details] [diff] [review]
Force mozgtk stubs dependency on gtk libraries when -Wl,--as-needed is used
Attachment #8436579 - Flags: review?(mshal)

Updated

4 years ago
Attachment #8436579 - Flags: review?(mshal) → review+
(Assignee)

Updated

4 years ago
Whiteboard: [checkin-needed-aurora] [npotb]

Comment 3

4 years ago
https://hg.mozilla.org/mozilla-central/rev/de5c523c5ed4
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
https://hg.mozilla.org/releases/mozilla-aurora/rev/730801cf5af4
status-firefox32: --- → fixed
status-firefox33: --- → fixed
Whiteboard: [checkin-needed-aurora] [npotb] → [npotb]
Comment on attachment 8436579 [details] [diff] [review]
Force mozgtk stubs dependency on gtk libraries when -Wl,--as-needed is used

Review of attachment 8436579 [details] [diff] [review]:
-----------------------------------------------------------------

::: widget/gtk/mozgtk/gtk2/Makefile.in
@@ +9,5 @@
> +# If LDFLAGS contains -Wl,--as-needed, we need to add -Wl,--no-as-needed
> +# before the gtk libraries, otherwise the linker will drop those dependencies
> +# because no symbols are used from them. But those dependencies need to be
> +# kept for things to work properly.
> +ifeq (,$(filter -Wl,--as-needed),$(LDFLAGS))

Um, how does this (and its gtk3 counterpart) work?  Notice that the parenthesization of the |filter| call is wrong, and therefore I think we always take the true branch here...
Attachment #8436579 - Flags: feedback?(mh+mozilla)
(Assignee)

Comment 6

4 years ago
(In reply to Nathan Froyd (:froydnj) from comment #5)
> Um, how does this (and its gtk3 counterpart) work?  Notice that the
> parenthesization of the |filter| call is wrong, and therefore I think we
> always take the true branch here...

In fact, we always take the false branch[1]. Which is why I didn't notice it didn't work as expected. Please feel free to fixup.

(1) it ultimately expands to ifeq (,,$(LDFLAGS)), which, even if LDFLAGS is empty, is ifeq (,,), which a) make is happy not to consider a syntax error, and b) apparently means "if '' equals ','.
Comment on attachment 8436579 [details] [diff] [review]
Force mozgtk stubs dependency on gtk libraries when -Wl,--as-needed is used

(In reply to Mike Hommey [:glandium] from comment #6)
> (In reply to Nathan Froyd (:froydnj) from comment #5)
> > Um, how does this (and its gtk3 counterpart) work?  Notice that the
> > parenthesization of the |filter| call is wrong, and therefore I think we
> > always take the true branch here...
> 
> In fact, we always take the false branch[1]. Which is why I didn't notice it
> didn't work as expected. Please feel free to fixup.
> 
> (1) it ultimately expands to ifeq (,,$(LDFLAGS)), which, even if LDFLAGS is
> empty, is ifeq (,,), which a) make is happy not to consider a syntax error,
> and b) apparently means "if '' equals ','.

I can just imagine the fun of trying to ensure the comma in -Wl,--as-needed is parsed as part of the argument and not as part of the make syntax.  One more thing that would be easier in moz.build.
Attachment #8436579 - Flags: feedback?(mh+mozilla)
(Assignee)

Comment 8

4 years ago
(In reply to Nathan Froyd (:froydnj) from comment #7)
> Comment on attachment 8436579 [details] [diff] [review]
> Force mozgtk stubs dependency on gtk libraries when -Wl,--as-needed is used
> 
> (In reply to Mike Hommey [:glandium] from comment #6)
> > (In reply to Nathan Froyd (:froydnj) from comment #5)
> > > Um, how does this (and its gtk3 counterpart) work?  Notice that the
> > > parenthesization of the |filter| call is wrong, and therefore I think we
> > > always take the true branch here...
> > 
> > In fact, we always take the false branch[1]. Which is why I didn't notice it
> > didn't work as expected. Please feel free to fixup.
> > 
> > (1) it ultimately expands to ifeq (,,$(LDFLAGS)), which, even if LDFLAGS is
> > empty, is ifeq (,,), which a) make is happy not to consider a syntax error,
> > and b) apparently means "if '' equals ','.
> 
> I can just imagine the fun of trying to ensure the comma in -Wl,--as-needed
> is parsed as part of the argument and not as part of the make syntax.

$(COMMA)

Updated

5 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.