Jump to content

Failure to compile spidermonkey part of build process.


Recommended Posts

I am trying to build 0ad on Slackware-current using sbopkg (which runs this build script) but compilation stops trying to build spidermonkey. I get the error:


--> /tmp/SBo/0ad-0.0.26-alpha/libraries/source/spidermonkey/mozjs-78.6.0/third_party/rust/encoding_rs/src/handles.rs:113:30
113 |             let mut u: u16 = ::std::mem::uninitialized();
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                              |
    |                              this code causes undefined behavior when executed
    |                              help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done

I attach the build log.


Link to comment
Share on other sites

From what I've seen of Slackware, it's almost like Linux from Scratch, meaning that package maintenance duties fall on the users.

The issue here is that mozjs-78.6.0 is old, and the build environment you're using is new. By the way, please post the versions of gcc, g++, clang++ and llvm that you have.

You can mimic how other distributions of Linux package 0ad, such as Debian, Arch and Gentoo. They have patches that fix building mozjs and build dependencies that control the versions of packages in the build environment. Debian's packaging is not always tested with the newest versions of build packages, but Arch and Gentoo are more likely to support the latest versions of build packages.

Debian's packaging is proof that 0ad alpha 26 builds with rustc version 1.63 and lower, clang version 14.0 and lower, and gcc version 12.2.0 and lower. There might be code constructs in mozjs-78.6.0 that are deprecated by newer versions of rustc, clang and gcc. You might try using older versions of build packages.

I also noticed that there are other errors logged before the error that you posted.

At first, there's a warning about deprecated function.

warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead

Then there's an error from clang++.

cargo:warning=clang-16: error: unknown argument: '-fexperimental-new-pass-manager'

which is apparently classed as a warning by the calling process. But, maybe if you fix that error (probably by using an older version of clang or adjusting the code to use mem::MaybeUninit) then build will be able to proceed ... until it encounters the next error. Fix the next error, and you'll find another error... Heh, hopefully not, but that's often what happens when one is trail blazing.

Later, the use of ::std::mem::uninitialized is considered an error by your version of clang. I don't see that in my build log. I only see the earlier warnings about std::mem::uninitialized being deprecated.

Alternatively, you could try using the AppImage, Flatpak or Snap of 0ad to run it from a sandbox.

Or, you could try dual booting to a different distribution of Linux in order to build 0ad alpha 26 with known working build environment package versions.

Edited by Norse_Harold
Link to comment
Share on other sites

34 minutes ago, gnw said:

I have mozjs version 102.10.0 installed, but 0ad is building with mozjs-78.6.0 because that is the version that comes packaged in the official release: http://releases.wildfiregames.com/0ad-0.0.26-alpha-unix-build.tar.xz, and the build scrip uses it.

Yes, and you can't use any version other than mozjs-78.6.0 with 0ad alpha 26 because 0ad assumes that every player is using the same version of mozjs in order to keep the game in sync.

Is alpha 26 the only version of 0ad you're interested in currently? You could look at 0ad SVN master, which uses mozjs-91.13.1, and might in the future use an even newer version of mozjs prior to stable release.

Edited by Norse_Harold
Link to comment
Share on other sites

7 minutes ago, hyperion said:

Checking spidermonky sources "build/moz.configure/flags.configure" it looks like it possibly doesn't recognize clang-16 as clang, maybe try

CXX=clang++ ./update-workspaces.sh -j8


I did that, but I got the same error.

Link to comment
Share on other sites

After applying the patch update-workspaces.sh works fine, but after

cd gcc
make -j8

I get this error:

/usr/include/fmt/core.h:1691:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.de\
 1691 |       formattable,
      |       ^~~~~~~~~~~

I attach the log.


Link to comment
Share on other sites

19 minutes ago, hyperion said:

Version 10.0.0 is apparently hard masked on my system, reason being it breaks lots of packages. Do you have an older version available?

I have 9.0.0 and 9.1.0 versions available but they might break things. I will see what I can do. Thanks.

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.

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.


  • Create New...