Closed
Bug 1176787
Opened 9 years ago
Closed 6 years ago
MOZ_GLUE_IN_PROGRAM breaks static linking of SM into executables
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(firefox60 fixed)
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: mwu, Assigned: ptomato)
References
(Blocks 2 open bugs)
Details
Attachments
(5 files)
1.63 KB,
patch
|
glandium
:
review-
mwu
:
feedback+
|
Details | Diff | Splinter Review |
2.11 KB,
patch
|
ptomato
:
review-
|
Details | Diff | Splinter Review |
2.14 KB,
patch
|
Details | Diff | Splinter Review | |
1.10 KB,
patch
|
glandium
:
review-
|
Details | Diff | Splinter Review |
1.13 KB,
patch
|
glandium
:
review+
|
Details | Diff | Splinter Review |
Servo normally statically links SM into the servo executable, but MOZ_GLUE_IN_PROGRAM breaks this. We have a hack that disables MOZ_GLUE_IN_PROGRAM, but it might make sense to disable it when building SM standalone or add some sort of option for disabling it.
Comment 2•9 years ago
|
||
AFAICT, this should fix the breakage. I don't have a Linux build environment set up right now, though, so I can't test.
Attachment #8668374 -
Flags: review?(mh+mozilla)
Attachment #8668374 -
Flags: feedback?(mwu)
Updated•9 years ago
|
Assignee: nobody → till
Status: NEW → ASSIGNED
Reporter | ||
Comment 3•9 years ago
|
||
Comment on attachment 8668374 [details] [diff] [review] Disable MOZ_GLUE_IN_PROGRAM in stand-alone builds on all platforms Review of attachment 8668374 [details] [diff] [review]: ----------------------------------------------------------------- This assumes that there are no embedders who want to stick mozglue in their executable and have SM in a separate DSO. Seems reasonable enough.
Attachment #8668374 -
Flags: feedback?(mwu) → feedback+
Comment 4•9 years ago
|
||
> Servo normally statically links SM into the servo executable, but MOZ_GLUE_IN_PROGRAM breaks this
Can you elaborate?
Comment 5•9 years ago
|
||
Comment on attachment 8668374 [details] [diff] [review] Disable MOZ_GLUE_IN_PROGRAM in stand-alone builds on all platforms Review of attachment 8668374 [details] [diff] [review]: ----------------------------------------------------------------- All this patch will manage to do is to remove jemalloc from linux builds and possibly break linking the js shell if it ever uses functions from the MFBT .cpp files.
Attachment #8668374 -
Flags: review?(mh+mozilla) → review-
Reporter | ||
Comment 6•9 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #4) > > Servo normally statically links SM into the servo executable, but MOZ_GLUE_IN_PROGRAM breaks this > > Can you elaborate? HashBytes from HashFunctions.cpp is marked as weak. When servo runs, it can't find HashBytes and crashes. This doesn't happen when HashBytes isn't marked as weak.
Updated•9 years ago
|
Blocks: sm-embedding
Comment 7•9 years ago
|
||
Unassigning myself: my linker-foo is way too weak.
Assignee: till → nobody
Status: ASSIGNED → NEW
Comment 8•8 years ago
|
||
I confirm that this is still a problem for my Rust bindings.
Comment 9•8 years ago
|
||
Brad, this bug fixes the crash on Spidernode that you had seen. Can you please see if you can pull the necessary managerial strings for a build system peer to drive this to the finish line? Thanks!
Flags: needinfo?(blassey.bugs)
Comment 10•8 years ago
|
||
(In reply to :Ehsan Akhgari (busy, don't ask for review please) from comment #9) > Brad, this bug fixes the crash on Spidernode that you had seen. Can you > please see if you can pull the necessary managerial strings for a build > system peer to drive this to the finish line? Thanks! Looks like Blassey is on PTO for two weeks. Andrew, any chance you can help with this, please?
Flags: needinfo?(blassey.bugs) → needinfo?(overholt)
Comment 11•8 years ago
|
||
Jonathan told me he'd be able to find someone on his team.
Flags: needinfo?(overholt) → needinfo?(jgriffin)
Updated•8 years ago
|
Assignee: nobody → mh+mozilla
Flags: needinfo?(jgriffin)
Comment 12•8 years ago
|
||
Okay, so I have an angle to attack the whole problem from, but I need some clarifications as to which embedder needs what. - Servo wants static mfbt/mozglue. What does it want for nspr? - I presume Spidernode wants static mfbt/mozglue. What does it want for nspr?
Flags: needinfo?(nox)
Flags: needinfo?(ehsan)
Comment 13•8 years ago
|
||
SpiderNode currently uses static mozglue on Linux but dynamic mozglue on OSX. It would be nice if we could link to the same version on both platforms, but it's not the end of the world if that's not easy to do. (I haven't tested the port to Windows at all yet.) As far as NSPR goes, it seems like the parts of it that SpiderMonkey uses end up in libjs_static.a and we just link against that (we don't link against NSPR specifically.)
Flags: needinfo?(ehsan)
Comment 14•8 years ago
|
||
(In reply to :Ehsan Akhgari (busy, don't ask for review please) from comment #13) > SpiderNode currently uses static mozglue on Linux but dynamic mozglue on > OSX. It would be nice if we could link to the same version on both > platforms, but it's not the end of the world if that's not easy to do. (I > haven't tested the port to Windows at all yet.) > > As far as NSPR goes, it seems like the parts of it that SpiderMonkey uses > end up in libjs_static.a and we just link against that (we don't link > against NSPR specifically.) How do you link against libjs_static.a? So you use the Mozilla build system to link a program against it, or are you linking, like Servo, from an external build system?
Comment 15•8 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #14) > (In reply to :Ehsan Akhgari (busy, don't ask for review please) from comment > #13) > > SpiderNode currently uses static mozglue on Linux but dynamic mozglue on > > OSX. It would be nice if we could link to the same version on both > > platforms, but it's not the end of the world if that's not easy to do. (I > > haven't tested the port to Windows at all yet.) > > > > As far as NSPR goes, it seems like the parts of it that SpiderMonkey uses > > end up in libjs_static.a and we just link against that (we don't link > > against NSPR specifically.) > > How do you link against libjs_static.a? So you use the Mozilla build system > to link a program against it, or are you linking, like Servo, from an > external build system? From an external build system. See <https://github.com/mozilla/spidernode/blob/75558b4b1852a4a80d2fd0b894e911874493c687/deps/spidershim/spidershim.gyp#L50> and <https://github.com/mozilla/spidernode/blob/75558b4b1852a4a80d2fd0b894e911874493c687/deps/spidershim/spidermonkey.gyp#L24>.
Comment 16•8 years ago
|
||
nox mentioned on IRC that servo can get away with only linking against libjs_static.a and not against mozglue at all because of https://github.com/servo/mozjs/commit/e4385a1570884b8b7f71561428ef3bba7f1f90d8. If this were possible in spidernode, I'd switch to using it too! Mike, is this something that we can do here?
Flags: needinfo?(mh+mozilla)
Comment 19•8 years ago
|
||
Oops, cleared NI. I don't understand what you mean by "- Servo wants static mfbt/mozglue. What does it want for nspr?". I don't want any of this, I just want libjs_static and to link against that and for it to work.
Comment 20•8 years ago
|
||
(In reply to nox from comment #19) > Oops, cleared NI. I don't understand what you mean by "- Servo wants static > mfbt/mozglue. What does it want for nspr?". I don't want any of this, I just > want libjs_static and to link against that and for it to work. For that to work, you need nspr, at least on Windows (the default on Linux and OSX is to use the posix nspr emulation, which doesn't require nspr). So the question remains: do you want nspr as a shared library in that case? Presumably, you do, if you are using NSS for SSL in servo (or maybe are you still on openssl? If you are, maybe you'd use nss at some point in the future? or maybe you use something else that requires nspr? if you do, you surely don't want two copies of nspr in the same address space).
Flags: needinfo?(mh+mozilla)
Updated•8 years ago
|
Flags: needinfo?(nox)
Comment 21•8 years ago
|
||
I just want a static library to link against to use SpiderMonkey in Servo. Why can't nspr be in libjs_static exactly? I just want to land my SpiderMonkey update now, not worry about NSS or whatever for "some point in the future". :'(
Flags: needinfo?(nox)
Comment 22•8 years ago
|
||
Feel free to assume we're not going to ever get another dependency on nspr.
Flags: needinfo?(mh+mozilla)
Comment 23•8 years ago
|
||
Servo probably doesn't care, but at the moment nspr is still necessary even on Linux if --enable-ctypes is used, and I believe we do have embedders using that. (Heck, I use it, but my embedding is the standard test JS shell binary compiled with --enable-ctypes, and perhaps that's easier to accommodate for some reason?) I suspect we'll want to remove that source of nspr dependency at some point, but we haven't done the work yet.
Comment 24•8 years ago
|
||
If it's possible at all for embedders to *always* have to link against libjs_static.a and just pull in everything that SpiderMonkey needs in that static library, I think that will save embedders a lot of effort in terms of figuring out when they should use what library on what platform, etc. With my m-c hat off for a sec, I wouldn't even know what NSPR is, so how am I supposed to know that I should link to it on some platforms and/or with some options passed to configure?!
Comment 25•8 years ago
|
||
Status update: this is taking time because I'm in that unstable state where I can have things working for servo and spidernode, or I can have things working for gecko, or I can have things working for normal standalone js builds but not all at the same time. I'll get to the bottom of it, but building spidermonkey these days takes some time, and this also needs to work on all platforms... so, please be patient.
Flags: needinfo?(mh+mozilla)
Comment 26•8 years ago
|
||
No problem, thanks for your help here! Much appreciated. :-)
Comment 27•8 years ago
|
||
Mike, is there any recent progress on this? We're going to be blocked on this bug fairly soon.
Flags: needinfo?(mh+mozilla)
Assignee | ||
Comment 29•7 years ago
|
||
I ported the existing patch forward to ESR52. This definitely works for my embedding use case (using --enable-posix-nspr-emulation), but I assume it's still r- because of not working on other platforms?
Attachment #8884708 -
Flags: review-
Attachment #8884708 -
Flags: feedback?(mh+mozilla)
Comment 30•7 years ago
|
||
Here I'd like to propose an alternative approach - adding appropriate linker flags to js.pc as described in https://bugzilla.mozilla.org/show_bug.cgi?id=1236085#c4. This patch is tested with gjs, which requires changes in its build scripts. [1] Note that this is only a proof-of-concept. First, it may not work outside Linux as it hard-codes libmozglue.a. Second, this patch targets esr52 branch instead of hg-default. I'll update it if this sounds a good way on fixing crashes. [1] https://github.com/yan12125/gjs/commit/d2b083cf3ee74952802f3d8457ee7e24173ba303
Attachment #8900283 -
Flags: feedback?(mh+mozilla)
Assignee | ||
Comment 31•7 years ago
|
||
That patch makes things that don't use JSAPI directly have to link against SpiderMonkey, I don't think it's the way to go.
Comment 32•7 years ago
|
||
Bug 1277338 kinda sorta solved the problem... if you build with --disable-jemalloc.
Flags: needinfo?(mh+mozilla)
Updated•7 years ago
|
Attachment #8884708 -
Flags: feedback?(mh+mozilla)
Updated•7 years ago
|
Attachment #8900283 -
Flags: feedback?(mh+mozilla)
Assignee | ||
Comment 34•6 years ago
|
||
Regardless of which platform we are building on.
Assignee | ||
Updated•6 years ago
|
Assignee: mh+mozilla → philip.chimento
Status: NEW → ASSIGNED
Assignee | ||
Comment 35•6 years ago
|
||
This patch fixes things for me on mozjs-59a1, with --disable-jemalloc. A different fix would still be needed for ESR52.
Assignee | ||
Updated•6 years ago
|
Attachment #8942756 -
Flags: review?(mh+mozilla)
Comment 36•6 years ago
|
||
Comment on attachment 8942756 [details] [diff] [review] Always link mozglue into the shared library when building standalone This might work with --disable-jemalloc, but it also explicitly breaks Windows without it.
Attachment #8942756 -
Flags: review?(mh+mozilla) → review-
Assignee | ||
Comment 37•6 years ago
|
||
So my assumption that JS_STANDALONE is not used within Firefox is incorrect? What would be the correct assumption? The combination of JS_STANDALONE plus --disable-jemalloc is not used within Firefox? I had hoped to write a patch that would only affect builds for SpiderMonkey embedders.
Comment 38•6 years ago
|
||
JS_STANDALONE is used without --disable-jemalloc.
Assignee | ||
Comment 39•6 years ago
|
||
Regardless of which platform we are building on.
Assignee | ||
Comment 40•6 years ago
|
||
This one seems to build OK on Windows: https://treeherder.mozilla.org/#/jobs?repo=try&revision=ac5bac1e046a7cc58ce60a686e730acf74a7f978
Assignee | ||
Updated•6 years ago
|
Attachment #8943678 -
Flags: review?(mh+mozilla)
Updated•6 years ago
|
Attachment #8943678 -
Flags: review?(mh+mozilla) → review+
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Comment 41•6 years ago
|
||
Pushed by ebalazs@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/b58c4adf52cf Always link mozglue into the shared library when building standalone. r=glandium
Keywords: checkin-needed
Comment 42•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b58c4adf52cf
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Updated•6 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•