-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
aarch64-darwin: Improve error message when trying to do a x86_64-darwin build and Rosetta is not installed #12323
Comments
I presume this is coming from Would something like /* Right platform? */
if (!parsedDrv->canBuildLocally(worker.store)) {
// since aarch64-darwin has Rosetta 2, this user can actually run x86_64-darwin on their hardware - we should tell them to run the command to install Darwin 2
if (drv->platform == "x86_64-darwin" && setttings.thisSystem == "aarch64-darwin") {
throw Error("run `/usr/sbin/softwareupdate --install-rosetta --agree-to-license` to enable your %s to run programs for %s", settings.thisSystem, drv->platform);
} else {
throw Error("a '%s' with features {%s} is required to build '%s', but I am a '%s' with features {%s}",
drv->platform,
concatStringsSep(", ", parsedDrv->getRequiredSystemFeatures()),
worker.store.printStorePath(drvPath),
settings.thisSystem,
concatStringsSep<StringSet>(", ", worker.store.systemFeatures));
}
} be what you're looking for? |
It's on the right track. There might be a function to check if Rosetta is enabled in settings::getDefaultExtraPlatforms. |
Sounds good! I'll poke around and modify my solution. |
Hmm, so checking whether Rosetta is enabled should be done within That way, if it returns false (and we have the condition I wrote earlier as being on a compatible platform) we can instead prompt the user to run the appropriate command. Does that seem reasonable? |
Oh okay, I see that's already a thing - awesome |
Yeah it seems like if (std::string{SYSTEM} == "aarch64-darwin" &&
runProgram(RunOptions {.program = "arch", .args = {"-arch", "x86_64", "/usr/bin/true"}, .mergeStderrToStdout = true}).first == 0)
extraPlatforms.insert("x86_64-darwin"); This is then called in Setting<StringSet> extraPlatforms{
this,
getDefaultExtraPlatforms(), When bool ParsedDerivation::canBuildLocally(Store & localStore) const
{
if (drv.platform != settings.thisSystem.get()
&& !settings.extraPlatforms.get().count(drv.platform)
&& !drv.isBuiltin())
return false;
if (settings.maxBuildJobs.get() == 0
&& !drv.isBuiltin())
return false;
for (auto & feature : getRequiredSystemFeatures())
if (!localStore.systemFeatures.get().count(feature)) return false;
return true;
} my suspicion is that Thus, I think it's enough to assume Rosetta 2 isn't enabled by the time that we get into the if statement. I feel like from there we can just compare the That's just my thoughts though - is there something I'm missing here? |
Is your feature request related to a problem?
Currently you just get
Proposed solution
Ideally it would tell you to run
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
to enablex86_64-darwin
support.Alternative solutions
Additional context
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: