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

Error building Zig source: selected processor does not support system register name 'id_aa64mmfr2_el1' #21435

Open
saltzm opened this issue Sep 17, 2024 · 6 comments

Comments

@saltzm
Copy link

saltzm commented Sep 17, 2024

I am attempting to build zig from source in an Ubuntu VM on a Macbook Pro with an M1 chip.

I used the clang+llvm binaries from here, choosing this one clang+llvm-18.1.8-aarch64-linux-gnu.tar.xz.

Used

mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=<decompressed clang+llvm directory>

And then I'm getting the following error:

~/code/zig/build$ make install
[ 36%] Built target zigcpp
[ 47%] Built target zig-wasm2c
[ 52%] Building C object CMakeFiles/zig1.dir/zig1.c.o
[ 57%] Building C object CMakeFiles/zig1.dir/stage1/wasi.c.o
[ 63%] Linking C executable zig1
[ 68%] Built target zig1
[ 73%] Running zig1.wasm to produce /home/parallels/code/zig/build/compiler_rt.c
[ 78%] Running zig1.wasm to produce /home/parallels/code/zig/build/zig2.c
Scanning dependencies of target zig2
[ 84%] Building C object CMakeFiles/zig2.dir/zig2.c.o
/tmp/cc8a8trg.s: Assembler messages:
/tmp/cc8a8trg.s:3602308: Error: selected processor does not support system register name 'id_aa64mmfr2_el1'
make[2]: *** [CMakeFiles/zig2.dir/build.make:1049: CMakeFiles/zig2.dir/zig2.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/zig2.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
@alexrp
Copy link
Contributor

alexrp commented Sep 17, 2024

gcc --version && as --version?

@saltzm
Copy link
Author

saltzm commented Sep 17, 2024

$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
...
$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.34
...
$ cmake --version
cmake version 3.16.3

@saltzm
Copy link
Author

saltzm commented Sep 17, 2024

Ah, I just noticed this note from the build from source instructions:

LLVM, Clang, LLD development libraries == 18.x, compiled with the same gcc or clang version above

I just downloaded the binary directly from the llvm site rather than compiling from source locally, in case that makes a difference

@alexrp
Copy link
Contributor

alexrp commented Sep 17, 2024

compiled with the same gcc or clang version above

This is not likely to be the issue, I think. The problem here is more likely that your gcc/as versions are too old. Ubuntu should have newer versions in its repos with an explicit version suffix; I suggest trying with these first of all. So e.g. cmake .. -DCMAKE_PREFIX_PATH=<clang+llvm> -DCMAKE_C_COMPILER=gcc-12.

@alexrp
Copy link
Contributor

alexrp commented Sep 17, 2024

For what it's worth, on my RPi5 running Debian Bookworm, gcc is 12.2.0.

@saltzm
Copy link
Author

saltzm commented Sep 17, 2024

Interesting - the instructions say that only gcc >= 7.0.0 is required so I was going off of that. I'll try with an upgraded gcc and see what happens

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

2 participants