Jump to content

Can't compile on Fedora 36 because of mozjs: either ICE due to ElemSize, or with system mozjs a JS convert error


Recommended Posts

Hi, since I can't wait for the next release I decided to give it a try to compile it myself. I keep running into bugs:

  • Either during the first step, where something is off with the mozjs part.
  • Or if I use system mozjs, I run into some JS converting error.

If you have an idea, I would appreciate it. Don't sweat it though - I am also doing this since I am not patient enough to wait for the release. I will survive it if I have to wait until then :)

 

My machine is running Fedora 36, here are the steps I did (dependencies installed as far as I can tell):

> git clone https://gitlab.com/0ad/0ad.git --depth=50
> cd 0ad/build/workspaces
> ./update-workspaces.sh -j3

The error I run into is:

/home/liquidat/gits/gitlab/0ad/libraries/source/spidermonkey/mozjs-78.6.0/js/src/util/TrailingArray.h:73:41: internal compiler error: unexpected expression ‘ElemSize’ of kind template_parm_index
   73 |     MOZ_ASSERT((end - start) % ElemSize == 0);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~

So I decided to premake with system version of mozjs (78.15.0):

> ./update-workspaces.sh -j3 --with-system-mozjs

That went through :banana: . But compile failed:

> cd gcc
> make -j3
==== Building mocks_real (release) ====
Creating obj/mocks_real_Release
mocks_real.cpp
Linking mocks_real
==== Building network (release) ====
Creating obj/network_Release
precompiled.h
In file included from ../../../source/network/NetMessages.h:27,
                 from ../../../source/network/NetMessage.h:26,
                 from ../../../source/pch/network/precompiled.h:26:
../../../source/scriptinterface/ScriptTypes.h:85:2: error: #error Your compiler is trying to use an untested minor version of the SpiderMonkey library. If you are a package maintainer, please make sure to check very carefully that this version does not change the behaviour of the code executed by SpiderMonkey. Different parts of the game (e.g. the multiplayer mode) rely on deterministic behaviour of the JavaScript engine. A simple way for testing this would be playing a network game with one player using the old version and one player using the new version. Another way for testing is running replays and comparing the final hash (check trac.wildfiregames.com/wiki/Debugging#Replaymode). For more information check this link: trac.wildfiregames.com/wiki/Debugging#Outofsync
   85 | #error Your compiler is trying to use an untested minor version of the \
      |  ^~~~~
make[1]: *** [network.make:138: obj/network_Release/precompiled.h.gch] Error 1
make: *** [Makefile:79: network] Error 2

So in ../../../source/scriptinterface/ScriptTypes.h I removed the warning for the sub-version and tried again, but run into another error:

ScriptConversions.cpp
../../../source/scriptinterface/ScriptContext.cpp: In member function ‘void ScriptContext::UnRegisterRealm(JS::Realm*)’:
../../../source/scriptinterface/ScriptContext.cpp:146:46: error: cannot convert ‘JS::Zone*’ to ‘JSContext*’
  146 |         JS::PrepareZoneForGC(js::GetRealmZone(realm));
In file included from /usr/include/mozjs-78/js/Value.h:25,
                 from /usr/include/mozjs-78/js/CallArgs.h:74,
                 from /usr/include/mozjs-78/jsapi.h:31,

I found an existing thread discussing a similar error. But according to that, their error was fixed in SpiderMonkey 78.7, and my version is much newer.

Edited by liquidat
Found a thread discussing the same error.
Link to comment
Share on other sites

If you don't need anything fancy an alias would do fine as well.

alias use_clang='CC=clang CXX=clang++'

The commands can be prefixed with use_clang which would save a little time, although, you would need to clean your workspace when switching with clean-workspace.sh.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...