Closed Bug 1022425 Opened 10 years ago Closed 10 years ago

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

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(firefox32 fixed, firefox33 fixed)

RESOLVED FIXED
mozilla33
Tracking Status
firefox32 --- fixed
firefox33 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

(Whiteboard: [npotb])

Attachments

(1 file)

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.
Attachment #8436579 - Flags: review?(mshal) → review+
Whiteboard: [checkin-needed-aurora] [npotb]
https://hg.mozilla.org/mozilla-central/rev/de5c523c5ed4
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
https://hg.mozilla.org/releases/mozilla-aurora/rev/730801cf5af4
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)
(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)
(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)
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: