Error building Firefox on M1 machine with Rosetta 2 and python3.6.8
Categories
(Firefox Build System :: Bootstrap Configuration, defect)
Tracking
(firefox98 fixed)
| Tracking | Status | |
|---|---|---|
| firefox98 | --- | fixed |
People
(Reporter: gupta.r1901, Assigned: mhentges)
Details
Attachments
(1 external file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
Steps to reproduce:
I am trying to build firefox for Desktop on MacOS 11.6.2 with python 3.6.8 (which runs with Rosetta 2). I have set MACH_I_DO_WANT_TO_USE_ROSETTA=1 and ran ./mach bootstrap. This appears on the screen:
Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode [default]
2. Firefox for Desktop
3. GeckoView/Firefox for Android Artifact Mode
4. GeckoView/Firefox for Android
5. SpiderMonkey JavaScript engine
and selected 2.
I have Homebrew installed in /usr/local for X86_64 but I am still getting this error.
Actual results:
We are now installing all required packages via Homebrew. You will see a lot of
output as packages are built.
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.
not trusting file /Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/.hg/hgrc from untrusted user root, group staff
not trusting file /Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/.hg/hgrc from untrusted user root, group staff
Error running mach:
['bootstrap']
The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file bootstrap| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
subprocess.CalledProcessError: Command '['/opt/homebrew/bin/brew', 'install', '--formula', 'git', 'terminal-notifier', 'gnu-tar', 'watchman']' returned non-zero exit status 1.
File "/Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/python/mozboot/mozboot/mach_commands.py", line 43, in bootstrap
bootstrapper.bootstrap(command_context.settings)
File "/Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/python/mozboot/mozboot/bootstrap.py", line 336, in bootstrap
self.instance.install_system_packages()
File "/Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/python/mozboot/mozboot/osx.py", line 224, in install_system_packages
self._ensure_homebrew_packages(packages)
File "/Users/bit9qa/Desktop/reno/test_python3.6/mozilla-unified/python/mozboot/mozboot/osx.py", line 263, in _ensure_homebrew_packages
subprocess.check_call(create_homebrew_cmd("install") + list(to_install))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
Sentry event ID: 6af50321bc81424f9668c4f1cb2a30c7
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Bootstrap Configuration' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
| Assignee | ||
Comment 2•4 years ago
|
||
Hmm, is it possible to use native ARM python instead of emulating x86_64 Python 3.6.8 through Rosetta?
Also, I'm surprised that it's trying to install packages via brew - it's probably because it's using the x86_64 bootstrapper instead of the Arm one.
Ideally, I'd like to drop Python + Rosetta support, depending on your use case here and potentially :glandium's thoughts.
| Reporter | ||
Comment 3•4 years ago
|
||
(In reply to Mitchell Hentges [:mhentges] 🦀 from comment #2)
Hmm, is it possible to use native ARM python instead of emulating x86_64 Python 3.6.8 through Rosetta?
Also, I'm surprised that it's trying to install packages viabrew- it's probably because it's using thex86_64bootstrapper instead of the Arm one.
Ideally, I'd like to drop Python + Rosetta support, depending on your use case here and potentially :glandium's thoughts.
Hey @Mitchell, Thanks for replying. I can build firefox with Python3.9.1 which runs natively on M1 but my project actually requires python 3.6.8 and to make it run on M1 I had run it with Rosetta (can't change it)
Is there anything that can be done to fix it?
| Assignee | ||
Comment 4•4 years ago
|
||
The main difference between OSXBootstrapperLight and OSXBootstrapper
is that the "light" one doesn't install utilities via brew.
However, these utilities are all optional for builds (watchman,
terminal-notifier, etc).
Since arm macOS + Rosetta + brew installs are failing (because brew is
complaining that the "ARM prefix" is being used in a Rosetta context),
the solution provided by this patch is to avoid using brew in this
case.
| Assignee | ||
Comment 5•4 years ago
|
||
Hmm, I'm not sure that brew needs to be run here - it adds some helpers (terminal-notifier, watchman), but they aren't necessary for a build.
Since the main difference between the arm and x86_64 macOS bootstrappers is that the x86_64 one does brew installs, I think we can safely redirect arm machines to always do "light" bootstrapping, even if running x86_64 Python through Rosetta.
I've got an exploratory patch up, but I'm interested in what :glandium thinks before landing.
:gupta.r1901, can you apply this patch (hg pull && moz-phab patch D137661), then try bootstrapping again and let me know if it works?
| Assignee | ||
Updated•4 years ago
|
| Reporter | ||
Comment 6•4 years ago
|
||
Actually I rebooted the machine and fresh installed everything following each step again. It just complained about the default stable version on rust compiler -- It was basically trying to use aarch64-apple-darwin (arm rust compiler host) instead of using x86_64-apple-darwin. I set the default rust compiler host to x86_64-apple-darwin and was able to build it.
Thank you so much for your help :)
| Reporter | ||
Comment 7•4 years ago
|
||
(In reply to gupta.r1901 from comment #6)
Actually I rebooted the machine and fresh installed everything following each step again. It just complained about the default stable version on rust compiler -- It was basically trying to use aarch64-apple-darwin (arm rust compiler host) instead of using x86_64-apple-darwin. I set the default rust compiler host to x86_64-apple-darwin and was able to build it.
Thank you so much for your help :) and I did not use the patch. It just worked
| Assignee | ||
Comment 8•4 years ago
•
|
||
That makes sense, as even after encountering the exception, everything necessary for the build was "available", so ./mach build would behave.
However, I'd still like ./mach bootstrap to behave even in your circumstance: can you confirm that the patch works for your circumstance?
I'm glad that the build in general is working for you :) 👍
Comment 9•4 years ago
|
||
| bugherder | ||
Description
•