Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to MozillaBuild 4.0 #326

Closed
wants to merge 17 commits into from

Conversation

Redfire75369
Copy link
Contributor

@Redfire75369 Redfire75369 commented Nov 25, 2022

Added Support for MozillaBuild 4.0 to build SpiderMonkey on Windows

@Redfire75369
Copy link
Contributor Author

The makefile seems to require being called from the mozilla-build terminal though (start-shell.bat), so I'm not sure how to fix this error.

   Compiling mozjs_sys v0.68.2 (C:\Users\Redfire\software\github\mozjs\mozjs)
error: failed to run custom build command for `mozjs_sys v0.68.2 (C:\Users\Redfire\software\github\mozjs\mozjs)`

Caused by:
  process didn't exit successfully: `C:\Users\Redfire\software\github\mozjs\target\debug\build\mozjs_sys-7183b162fa1fdf26\build-script-build` (exit code: 101)
  --- stdout
  cargo:outdir=C:\Users\Redfire\software\github\mozjs\target\debug\build\mozjs_sys-004ea0ad6a849248\out\build
  [[ 'C:\Users\Redfire\software\github\mozjs\mozjs\mozjs'/js/src/configure -ot 'C:\Users\Redfire\software\github\mozjs\mozjs\mozjs'/js/src/configure.in ]] && touch 'C:\Users\Redfire\software\github\mozjs\mozjs\mozjs'/js/src/configure || true

  --- stderr
  "C:\\mozilla-build\\bin\\mozmake\\mozmake.exe"
  '[[' is not recognized as an internal or external command,
  operable program or batch file.
  'true' is not recognized as an internal or external command,
  operable program or batch file.
  mozmake: *** [C:\Users\Redfire\software\github\mozjs\mozjs\makefile.cargo:191: maybe-configure] Error 1
  thread 'main' panicked at 'assertion failed: result.success()', mozjs\build.rs:232:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@Redfire75369
Copy link
Contributor Author

That's weird, it's a different error in CI than what I'm getting locally.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Nov 29, 2022

It seems to work if you start the mozbuild shell before running cargo build.
That CI isn't... correct....

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Nov 29, 2022

  Reticulating splines...
  Finished reading 62 moz.build files in 0.14s
  Read 0 gyp files in parallel contributing 0.00s to total wall time
  Processed into 249 build config descriptors in 0.18s
  RecursiveMake backend executed in 0.28s
    173 total backend files; 173 created; 0 updated; 0 unchanged; 0 deleted; 6 -> 39 Makefile
  Total wall time: 0.68s; CPU time: 0.58s; Efficiency: 86%; Untracked: 0.07s
  config/autoconf.mk:117: *** missing separator.  Stop.
  mozmake: *** [D:\a\mozjs\mozjs\mozjs\makefile.cargo:184: all] Error 2
  thread 'main' panicked at 'assertion failed: result.success()', mozjs\build.rs:225:5

Something's wrong with autoconf/make somewhere and I have no idea where.

@Redfire75369
Copy link
Contributor Author

It seems that this is being generated in autoconf.mk, with two separate lines, which is what breaks it.

PATH = C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\bin;D:\a\mozjs\mozjs\target\debug\deps;D:\a\mozjs\mozjs\target\debug;C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib;C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin;C:\Program
Files\Git\usr\bin;C:\mozilla-build\bin;C:\mozilla-build\kdiff3;C:\mozilla-build\python3;C:\mozilla-build\python3\Scripts;C:\mozilla-build\msys2\usr\local\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\usr\bin;C:\mozilla-build\msys2\opt\bin;C:\ProgramData\scoop\shims;C:\Users\runneradmin\scoop\shims;C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS;C:\tools\zstd;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\2.9.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\tools\ghc-9.4.2\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.2.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.17.13\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.4\x64\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.352-8\x64\bin;C:\Program Files\ImageMagick-7.1.0-Q16-HDRI;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\ProgramData\Chocolatey\bin;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\OpenSSL\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.6\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\SeleniumWebDrivers\ChromeDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps;C:\mozilla-build\msys2\usr\bin\site_perl;C:\mozilla-build\msys2\usr\bin\vendor_perl;C:\mozilla-build\msys2\usr\bin\core_perl;C:\mozilla-build\bin\mozmake;C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.34.31933/bin/HostX64/x64

@Redfire75369
Copy link
Contributor Author

In the end, it was caused by the most mundane thing.
This line in start-shell.bat found an ssh binary in C:\Program Files\Git\usr\bin.

FOR /F "tokens=* USEBACKQ" %%F IN (`where ssh 2^>NUL`) DO (
    SET EXTERNAL_TO_MOZILLABUILD_SSH_DIR=%%~dpF
)

Then in https://searchfox.org/mozilla-build/source/msys-config/profile-mozilla.sh#70, cygpath would return a multiline string.

$ cygpath -u C:\\Program Files\\Git\\usr\\bin\\
/c/Program
Files/Git/usr/bin/

@Redfire75369
Copy link
Contributor Author

This requires a fix on the mozilla-build side so I've filed a bug. (https://bugzilla.mozilla.org/show_bug.cgi?id=1803269)

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Dec 2, 2022

Update: The bug has now been addressed and a fix has been merged. Once a new update is released, this can probably be merged.

My only worry is the fact that I'm using latest to download mozmake from taskcluster, which might not be the smartest idea.

@jdm
Copy link
Member

jdm commented Dec 2, 2022

Great work on finding that issue and getting it fixed!

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Dec 2, 2022

Thanks! Requiring the build to be run in the MozillaBuild shell isn't ideal, but this works for now at least.
This is important though, since building with MozillaBuild 3.0 isn't explicitly supported. Who knows how long it'll last for.

Do you have any suggestions regarding the Taskcluster issue?

@Redfire75369
Copy link
Contributor Author

I guess we could pin it to the latest one at the time of the commit, which is d1109e59eddb6045f048bd31110ea80da4679f5a6637b44165e9c2523b58d28d

@jdm
Copy link
Member

jdm commented Dec 2, 2022

Hmm, help me understand what's required here: is mozmake not part of mozbuild? Why do we need to install it separately?

@Redfire75369
Copy link
Contributor Author

As of MozillaBuild 4.0, mozmake isn't automatically installed. It's bootstrapped by bootstrap.py.

Automatically-bootstrapped tools have been removed (NSIS, mozmake, yasm).

@jdm
Copy link
Member

jdm commented Dec 2, 2022

Will it build successfully without mozmake?

@Redfire75369
Copy link
Contributor Author

Given we use a makefile.cargo, probably not 🙃.

In all seriousness, it doesn't work without some form of make, either make, gmake or mozmake.

@jdm
Copy link
Member

jdm commented Dec 2, 2022

Oh, if there's no make included in MozillaBuild at all then that makes sense. I didn't think that was the case.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Dec 3, 2022

After asking the devs a bit, it seems the next release will be in around a month or two, so this will remain a draft until then.
I'll probably spend the time so it creates a script with a single command and automatically starts the MozillaBuild shell with running that script.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Dec 4, 2022

I'm not sure about where this UWP error is coming from, anyone have any ideas?

error: failed to add native library D:\a\mozjs\mozjs\target\aarch64-uwp-windows-msvc\debug\build\mozjs_sys-f75d1830bda12164\out\build/js/src/build\js_static.lib: Unsupported archive identifier

@Redfire75369
Copy link
Contributor Author

@jdm
Copy link
Member

jdm commented Dec 5, 2022

I've opened #327 about that.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Jan 6, 2023

Should the tar and ruzstd build dependencies only be required on windows? I think that's probably a smart idea.
mozmake and MozillaBuild should only be needed on windows.

@jdm
Copy link
Member

jdm commented Jan 6, 2023

Yep, that sounds reasonable.

@Redfire75369
Copy link
Contributor Author

Redfire75369 commented Jan 6, 2023

If you don't mind, I'd like to change find_make too since it actually doesn't work currently. It needs to run make --version. It'll also let me prevent installing mozmake if you already have make, gmake or mozmake installed.

(It doesn't work because it returns an exit code of 2 if there's no Makefile)

Changed mozmake Installation to occur only on Windows
Changed MozillaBuild detection and integration to occur only on Windows
Added Checking for make and gmake on All Platforms
Added Checking for mozmake on Windows
@Redfire75369 Redfire75369 force-pushed the mozbuild-4.0 branch 2 times, most recently from 8b72081 to 43708c4 Compare January 6, 2023 13:06
@Redfire75369 Redfire75369 mentioned this pull request Jan 25, 2023
@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #342) made this pull request unmergeable. Please resolve the merge conflicts.

README.md Outdated Show resolved Hide resolved
@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #350) made this pull request unmergeable. Please resolve the merge conflicts.

@sagudev
Copy link
Member

sagudev commented Sep 11, 2023

This was resolved with #392.

@sagudev sagudev closed this Sep 11, 2023
@Redfire75369 Redfire75369 deleted the mozbuild-4.0 branch December 8, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants