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

Support universal binaries on macOS #932

Closed
AlexDenisov opened this issue Dec 19, 2021 · 7 comments · Fixed by #1038
Closed

Support universal binaries on macOS #932

AlexDenisov opened this issue Dec 19, 2021 · 7 comments · Fixed by #1038

Comments

@AlexDenisov
Copy link
Member

Currently, mull-cxx will extract doubled bitcode (e.g. for x96 and arm64) and mull-runner fails to read mutants from universal binary.

Steps to reproduce:

$ echo "int main(int argc) { return argc + argc; }" > test.c
$ clang -arch arm64 -arch x86_64 -g -fembed-bitcode test.c
$ mull-runner-12 a.out
[error] Cannot create SymbolicFile from: /private/tmp/sc-V1LsVrXo3/a.out
[error] Error messages are treated as fatal errors. Exiting now.
$ mull-cxx-12 a.out
[info] Link mutated program (threads: 1)
[error] Cannot link program
status: Failed
time: 100ms
exit: 70
command: clang /var/folders/1s/hps840w156xfn_m__h2m17880000gp/T/mull-d7e587.bc /var/folders/1s/hps840w156xfn_m__h2m17880000gp/T/mull-fdb944.bc -o /var/folders/1s/hps840w156xfn_m__h2m17880000gp/T/mull-168cac.exe
stdout:
stderr: warning: overriding the module target triple with x86_64-apple-macosx11.0.0 [-Woverride-module]
'apple-m1' is not a recognized processor for this target (ignoring processor)
'+crc' is not a recognized feature for this target (ignoring feature)
<truncated>
@benthevining
Copy link

Is there any news on this?

If not universal binaries, does/will mull ship binaries for Mac arm64? The current release is only x86_64, so trying to pass the plugin to clang on my M1 Mac fails because clang apparently can't open the plugin.

Do I need to build mull from source myself?

@AlexDenisov
Copy link
Member Author

Hi @benthevining, thank you for bringing this up.

If not universal binaries, does/will mull ship binaries for Mac arm64?

We don't ship universal binaries yet, but there is no technical limitation in doing so. I'll see if I can cut a new release soon.

Do I need to build mull from source myself?

I think it is the best option to build mull on your own on the new Apple Silicon. Currently, we do no sign binaries on macOS, so even if we ship a universal binary, you'd then have to codesign it locally (perhaps with an ad-hoc certificate).

@AlexDenisov
Copy link
Member Author

@benthevining I realized in the end why we don't do universal binaries: we are relying on LLVM from homebrew which is not universal itself, so we can't easily make mull a universal binary as well.

Until #957 is not resolved, I'll update the docs suggesting/warning about precompiled macOS binaries on Apple Silicon hardware.

@benthevining
Copy link

ohhh I see. That's a shame.

I would really appreciate some docs on building mull for M1, since I haven't been able to get it working (maybe because of the Homebrew LLVM issue?)

@AlexDenisov
Copy link
Member Author

@benthevining, what doesn't work for you on M1? I'm using M1 as my main development machine, so I can certainly say that building Mull works there. But perhaps the instructions are missing something important.

@AlexDenisov
Copy link
Member Author

I ended up adding support for universal binaries by teaching mull to only consider one slice from the universal binary. The slice is chosen on which version of mull-runner is running (e.g. arm64 or x86_64).
The changes are here.

@benthevining it doesn't address your use case as it's slightly different from the topic of this issue. If you still have issues with Mull on Apple Silicon - please, consider opening a separate issue.

@benthevining
Copy link

Thanks! I'll try again on my M1 machine and let you know if I have any issues.

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 a pull request may close this issue.

2 participants