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

Cannot build on Mac (aarch64) #1577

Open
MarcoBonino opened this issue Oct 10, 2024 · 7 comments
Open

Cannot build on Mac (aarch64) #1577

MarcoBonino opened this issue Oct 10, 2024 · 7 comments

Comments

@MarcoBonino
Copy link

Hello!
I'm trying to build on MacOS aarch64 (M3 chip).
However some tools like riscv64-unknown-elf-gcc and riscv64-unknown-elf-g++ are missing.

I'm from a case sensitive filesystem. And I installed the required tools:

brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat texinfo flock libslirp

This is my configure:

# get gmp, mpfr and libmpc available during ./configure script execution 
export CPPFLAGS="-I/opt/homebrew/include"
export LDFLAGS="-L/opt/homebrew/lib"
./configure --prefix=/Volumes/linux/bin-riscv-gnu-toolchain

And I get:

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for fgrep... /usr/bin/grep -F
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for bash... /bin/sh
checking for __gmpz_init in -lgmp... yes
checking for mpfr_init in -lmpfr... yes
checking for mpc_init2 in -lmpc... yes
checking for curl... /usr/bin/curl
checking for wget... /opt/homebrew/bin/wget
checking for ftp... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating scripts/wrapper/awk/awk
config.status: creating scripts/wrapper/sed/sed

Then I simply run make.

Could you provide support on this ?
If possible would be also nice to have the MacOS toolchain already built as it was done for the Ubuntu builds.

Thanks!

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Oct 10, 2024

Do you actually need to build the toolchain yourself or could you use an existing binary distribution like @ilg-ul's xPack version perhaps?

If you do really need to build your own toolchain and are having problems then the first step is to provide the complete steps that you are taking (from a clean git clone through configure and make) and also capture and upload a build log for analysis (e.g. make 2>&1 | tee build.log).

However, bear in mind that most active participants on this repo do not have access to the necessary hardware in order to reproduce/investigate macOS build problems and unfortunately no macOS users have stepped up to help here in this regard to date.

@TommyMurphyTM1234
Copy link
Collaborator

Also, if you search all open and closed issues here using appropriate terms like "macOS", "Brew", "XCode" etc. you may find some useful information about issues and workarounds when building on Apple hardware.

@TommyMurphyTM1234
Copy link
Collaborator

@MarcoBonino
Copy link
Author

@TommyMurphyTM1234 thanks for sharing useful information.
Right now it is ok to use a prebuilt toolchain, in case the build is really need I will come back in case I cannot build.

I'm using the toolchain you liked, but I'm getting a linker error: xpack-dev-tools/riscv-none-elf-gcc-xpack#37

Do you think is something about the toolchain itself or a gcc problem or something else ?

@TommyMurphyTM1234
Copy link
Collaborator

@wossoneri
Copy link

@TommyMurphyTM1234
Copy link
Collaborator

try this https://github.com/riscv-software-src/homebrew-riscv

Did this help at all @MarcoBonino?

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