c-sky/toolchain-build

How to compile on macOS M1?

KenjutsuGH opened this issue · 5 comments

Is it possible to build this toolchain under macOS on a M1?

I ran the script as:

./build-csky-gcc.py csky-gcc --src ./ --triple csky-unknown-elf

but it eventually gives the error:

configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.

I have GMP, MPFR and MPC installed via brew:

brew list gmp
/opt/homebrew/Cellar/gmp/6.2.1_1/include/ (2 files)
/opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib
/opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmpxx.4.dylib
/opt/homebrew/Cellar/gmp/6.2.1_1/lib/pkgconfig/ (2 files)
/opt/homebrew/Cellar/gmp/6.2.1_1/lib/ (4 other files)
/opt/homebrew/Cellar/gmp/6.2.1_1/share/info/ (3 files)
brew list mpfr
/opt/homebrew/Cellar/mpfr/4.2.0/include/ (2 files)
/opt/homebrew/Cellar/mpfr/4.2.0/lib/libmpfr.6.dylib
/opt/homebrew/Cellar/mpfr/4.2.0/lib/pkgconfig/mpfr.pc
/opt/homebrew/Cellar/mpfr/4.2.0/lib/ (2 other files)
/opt/homebrew/Cellar/mpfr/4.2.0/share/doc/ (14 files)
/opt/homebrew/Cellar/mpfr/4.2.0/share/info/mpfr.info
brew list mpc
/opt/homebrew/Cellar/mpc/0.34/bin/mpc
/opt/homebrew/Cellar/mpc/0.34/etc/bash_completion.d/mpc
/opt/homebrew/Cellar/mpc/0.34/share/doc/ (6 files)

Thank you for the feedback.

brew install libmpc gives:

Warning: libmpc 1.3.1 is already installed and up-to-date.
To reinstall 1.3.1, run:
  brew reinstall libmpc

And /build-csky-gcc.py csky-gcc --src ./ --triple csky-unknown-elf --disable-gdb also gives

configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

But if I understand correctly, there will be a macOS version soon?

configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

you can use
brew list --version show lib's version,

ex my info:
gmp 6.2.1_1
libmpc 1.3.1
mpfr 4.2.0

so I think your libs version < GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+,
upgrade it.

Thank you for the reply.

brew list --version gmp libmpc mpfr
gmp 6.2.1_1
libmpc 1.3.1
mpfr 4.2.0

Still the same compile error.

You have to specify --with-gmp=$GMP_PATH --with-mpfr=$MPFR_PATH --with-mpc=$LIBMPC_PATH just like my build.sh with the output of build-csky-gcc.py following with --fake parameter.

You could find these path with brew info <gmp|mpfr|libmpc> and I have a prebuilt binary release here.

Thank you! Much easier to download your prebuilt toolchain than to wait hours for it to build