Subject: bug#52913: closed (Re: 0ad only builds fine with a specific version of mozjs)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 02 Jan 2022 13:04:02 +0000

Your bug report

#52913: 0ad only builds fine with a specific version of mozjs

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
52913: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=52913
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: 0ad only builds fine with a specific version of mozjs
From: Guillaume Le Vaillant <[email-masked]>
To: Liliana Marie Prikler <[email-masked]>
Cc: Jesse Gibbons <[email-masked]>, [email-masked]
Date: Sun, 02 Jan 2022 12:56:25 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Liliana Marie Prikler <[email-masked]> skribis:

> @Guillaume: From what I can gather from the build error, it appears as
> though the calling convention changed to require an additional
> parameter.  I've tracked down the relevant commit [1] and bug [2].
>
> Now obviously doing such a thing violates SemVer, so if rewriting 0ad
> with this and other changes in mind is not an option, I think having a
> hidden package for 0ad might be the lesser evil.
>
> Cheers
>
> [1]
> https://searchfox.org/mozilla-central/commit/a3c605929b16303e8a52ae9d99d5fe6769e8bf09
> [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1681268

Thanks for the pointers.
I added a phase to fix the compatibility issue with mozjs-78.15, and
pushed as fea60a2fff443b9c172ed28bd37361e34e064f13.

Subject: 0ad only builds fine with a specific version of mozjs
From: Guillaume Le Vaillant <[email-masked]>
To: [email-masked]
Date: Fri, 31 Dec 2021 09:17:25 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The 0ad package checks the version of mozjs and throws an error if it is
not exactly the version it expects. This check is done in
"source/scriptinterface/ScriptTypes.h" and it currently requires version
78.6 of mozjs. As Guix has mozjs 78.15 instead, 0ad fails to build.

Patching "ScriptTypes.h" to remove the check and compile with mozjs 78.15
doesn't work, the build phase fails with:

--8<---------------cut here---------------start------------->8---
../../../source/scriptinterface/ScriptContext.cpp: In member function ‘void ScriptContext::UnRegisterRealm(JS::Realm*)’:
../../../source/scriptinterface/ScriptContext.cpp:146:39: error: cannot convert ‘JS::Zone*’ to ‘JSContext*’
  146 |  JS::PrepareZoneForGC(js::GetRealmZone(realm));
      |                       ~~~~~~~~~~~~~~~~^~~~~~~
      |                                       |
      |                                       JS::Zone*
In file included from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/Value.h:25,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/CallArgs.h:74,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/jsapi.h:31,
                 from ../../../source/scriptinterface/ScriptTypes.h:63,
                 from ../../../source/scriptinterface/ScriptContext.h:21,
                 from ../../../source/scriptinterface/ScriptContext.cpp:20:
/gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/GCAPI.h:539:55: note:   initializing argument 1 of ‘void JS::PrepareZoneForGC(JSContext*, JS::Zone*)’
  539 | extern JS_PUBLIC_API void PrepareZoneForGC(JSContext* cx, Zone* zone);
      |                                            ~~~~~~~~~~~^~
In file included from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/TraceKind.h:12,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/jspubtd.h:18,
                 from ../../../source/scriptinterface/ScriptTypes.h:62,
                 from ../../../source/scriptinterface/ScriptContext.h:21,
                 from ../../../source/scriptinterface/ScriptContext.cpp:20:
/gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/TypeDecls.h:55:21: note: class type ‘JS::Zone’ is incomplete
   55 | class JS_PUBLIC_API Zone;
      |                     ^~~~
../../../source/scriptinterface/ScriptContext.cpp: In member function ‘void ScriptContext::PrepareZonesForIncrementalGC() const’:
../../../source/scriptinterface/ScriptContext.cpp:264:40: error: cannot convert ‘JS::Zone*’ to ‘JSContext*’
  264 |   JS::PrepareZoneForGC(js::GetRealmZone(realm));
      |                        ~~~~~~~~~~~~~~~~^~~~~~~
      |                                        |
      |                                        JS::Zone*
In file included from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/Value.h:25,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/CallArgs.h:74,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/jsapi.h:31,
                 from ../../../source/scriptinterface/ScriptTypes.h:63,
                 from ../../../source/scriptinterface/ScriptContext.h:21,
                 from ../../../source/scriptinterface/ScriptContext.cpp:20:
/gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/GCAPI.h:539:55: note:   initializing argument 1 of ‘void JS::PrepareZoneForGC(JSContext*, JS::Zone*)’
  539 | extern JS_PUBLIC_API void PrepareZoneForGC(JSContext* cx, Zone* zone);
      |                                            ~~~~~~~~~~~^~
In file included from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/TraceKind.h:12,
                 from /gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/jspubtd.h:18,
                 from ../../../source/scriptinterface/ScriptTypes.h:62,
                 from ../../../source/scriptinterface/ScriptContext.h:21,
                 from ../../../source/scriptinterface/ScriptContext.cpp:20:
/gnu/store/gzsa3jrlhgcr3mr6i170lhgfsxsmpcps-mozjs-78.15.0/include/mozjs-78/js/TypeDecls.h:55:21: note: class type ‘JS::Zone’ is incomplete
   55 | class JS_PUBLIC_API Zone;
      |                     ^~~~
make[1]: *** [scriptinterface.make:146: obj/scriptinterface_Release/ScriptContext.o] Error 1
--8<---------------cut here---------------end--------------->8---

What would be the best way to fix this?
 - keep a mozjs-78.6 package around just for 0ad
 - patch 0ad to fix the compatibility issues with mozjs 78.15
 - use the mozjs version bundled in the 0ad sources

WDYT?