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

apple-aarch llvm-project failure: inking to LLVM is not currently supported on aarch64-apple-darwin' #27

Closed
anandijain opened this issue May 4, 2023 · 9 comments

Comments

@anandijain
Copy link

thanks for enzyme + rust! i was just trying it out but running ../x.py build --stage 1 library/std led to:

Updating submodule src/llvm-project
Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project'
Cloning into '/Users/anand/.cargo/dev/rust/src/llvm-project'...
remote: Enumerating objects: 3, done.        
remote: Counting objects: 100% (3/3), done.        
remote: Compressing objects: 100% (2/2), done.        
remote: Total 3 (delta 0), reused 2 (delta 0), pack-reused 0        
Receiving objects: 100% (3/3), done.
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Enumerating objects: 118284, done.
remote: Counting objects: 100% (118284/118284), done.
remote: Compressing objects: 100% (107763/107763), done.
remote: Total 118282 (delta 19733), reused 43593 (delta 6703), pack-reused 0
Receiving objects: 100% (118282/118282), 166.91 MiB | 6.11 MiB/s, done.
Resolving deltas: 100% (19733/19733), done.
From https://github.com/rust-lang/llvm-project
 * branch                9168e236c548d1d0e9938ee6dd4cdbd308fdfd72 -> FETCH_HEAD
Submodule path 'src/llvm-project': checked out '9168e236c548d1d0e9938ee6dd4cdbd308fdfd72'
thread 'main' panicked at 'shared linking to LLVM is not currently supported on aarch64-apple-darwin', src/bootstrap/native.rs:159:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:02:23

i know that it's probably too early to really get rust + enzyme working but im really interested in trying it out at some point

@ZuseZ4
Copy link
Member

ZuseZ4 commented May 12, 2023

@anandijain Thanks for the report. Quite a few Enzyme devs work on M1/M2 Mac's, but neither Lorenz nor I do have one.
I do assume that I just fine-tuned the build settings a bit too much towards x86_64 (sry for that), but we are currently rebasing our work on the latest rustc in order to merge it into nightly. If you have the time please feel free to check if you can work around the shared-link build. Otherwise, once Lorenz fixed the merge conflicts I will re-run it on the M2 of a friend to make sure that it also works for apple as expected. Once we are merged the rustc CI should also hopefully prevent this to happen again.

@samestep
Copy link

Excited to try this project! I attempted to build commit 5c141f5 on my M1 Mac just now, and got what looks like a different error:

[85/86] Install the project...
-- Install configuration: "Release"
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/cmake/Enzyme/EnzymeConfig.cmake
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/cmake/Enzyme/EnzymeConfigVersion.cmake
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/cmake/Enzyme/EnzymeTargets.cmake
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/cmake/Enzyme/EnzymeTargets-release.cmake
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/LLVMEnzyme-16.dylib
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/ClangEnzyme-16.dylib
-- Installing: /Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme/lib/LLDEnzyme-16.dylib
cargo:root=/Users/samueles/github/EnzymeAD/rust/build/build/aarch64-apple-darwin/enzyme
        finished in 85.032 seconds
thread 'main' panicked at 'src.symlink_metadata() failed with No such file or directory (os error 2)', lib.rs:1512:24
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:25:38

@ZuseZ4
Copy link
Member

ZuseZ4 commented Aug 4, 2024

@samestep We have a few new fixes for MacOS, do you want to try if it works for you by now?
@anandijain Similar for you. We still do dynamic linking (though it would be nice to have a flag for static linking), does it by coincidence work for you now? I know a few people compiling this on Apple M CPUs successfully.

@samestep
Copy link

samestep commented Aug 5, 2024

@ZuseZ4 thanks, yes it seems like it works better now! Everything up until the cargo +enzyme command seems to work great, modulo a small typo I address in #155.

However, when I run that last command:

cargo +enzyme run --release

I get a bunch of errors like these:

error[E0405]: cannot find trait `PartialEq` in this scope
error[E0405]: cannot find trait `Eq` in this scope
error[E0152]: duplicate lang item in crate `core`: `sized`.
error[E0152]: duplicate lang item in crate `core`: `unsize`.

Etc.

@ZuseZ4
Copy link
Member

ZuseZ4 commented Aug 5, 2024

@samestep Glad we're making progress. Just making sure, you're not running cargo +enzyme run --release in the rust compiler folder, but inside of a test project, right?

@samestep
Copy link

samestep commented Aug 5, 2024

@ZuseZ4 if an additional cd command is required, can you add that to the README.md instructions? Currently it is not clear where cargo +enzyme run --release is supposed to be run.

@ZuseZ4
Copy link
Member

ZuseZ4 commented Aug 5, 2024

I can't give a specific command, but it's supposed to be used to build your own projects, not the rust compiler.
So just run cargo init outside of the rust folder, copy one of the testcases into src/main.rs and use cargo +enzyme to build that project. Don't try to run cargo inside of the rust folder, since cargo isn't able to compile the rust compiler, that's why the first command to build rustc is using x.py.
If that works for you, do you want to update the README.md again to make clear that the cargo command shall be used for your own projects (since clearly it wasn't clear enough yet)?

@samestep
Copy link

samestep commented Aug 5, 2024

@ZuseZ4 yeah could you edit the README to add specific instructions on how to test it by copy-pasting one of those test cases into a new Rust project? Ideally you'd pick one specific test case as a concrete example and provide a specific sequence of commands that can be run without the reader having to figure out additional context. Let me know once you've done that and I'll be happy to try running it!

@ZuseZ4
Copy link
Member

ZuseZ4 commented Aug 5, 2024

@samestep added #156

@ZuseZ4 ZuseZ4 closed this as completed Aug 5, 2024
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

No branches or pull requests

3 participants