iains / gcc-darwin-arm64

GCC master branch for Darwin with experimental support for Arm64. Currently GCC-15.0.0 [July 2024]
GNU General Public License v2.0
265 stars 32 forks source link

Unable to cross compile for iOS #42

Closed demhademha closed 3 years ago

demhademha commented 3 years ago

So I have built a cross-tool chain for iOS from here: https://github.com/tpoechtrager/cctools-port I have then built gmp, mpfr, and Mac for iOS successfully. I then pass the following rags to gcc's configure: --host=aarch64-apple-darwin \ --target=aarch64-pale-darwin \ --prefix=/usr \ --with-local-prefix=/usr/include \ --with-gmp=$(BUILD_STAGE)/gmp/usr \ --with-mpfr=$(BUILD_STAGE)/mpfr/usr \ --with-mpc=$(BUILD_STAGE)/mpc/usr Configure then completes successfully however, upon running make, I get the following error: checking if mkdir takes one argument... no *** Configuration aarch64-apple-darwin not supported

I am unsure how to proceed. Any support would be appreciated. Regards.

demhademha commented 3 years ago

Update: i was able to fix that issue, however I now get the following error: mkdir -p -- .deps make[2]: Entering directory '/home/ahmed/Procursus/build_work/iphoneos-arm64/1600/gcc/gcc-0~20210702./build-x86_64-pc-linux-gnu/libcpp' g++ -I../../../libcpp -I. -I../../../libcpp/../include -I../../../libcpp/include -O2 -arch arm64 -isysroot /home/ahmed/iPhoneOS14.3.sdk -miphoneo s-version-min=13.0 -isystem /home/ahmed/Procursus/build_base/iphoneos-arm64/1600/usr/include -isystem /home/ahmed/Procursus/build_base/iphoneos-arm 64/1600/usr/local/include -F/home/ahmed/Procursus/build_base/iphoneos-arm64/1600/System/Library/Frameworks -F/home/ahmed/Procursus/build_base/iphon eos-arm64/1600/Library/Frameworks -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long -fno-exceptions -fno -rtti -I../../../libcpp -I. -I../../../libcpp/../include -I../../../libcpp/include -c -o charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo ../../../libcpp/charset.c g++: error: arm64: No such file or directory g++: error: unrecognized command-line option ‘-arch’ g++: error: unrecognized command-line option ‘-miphoneos-version-min=13.0’ make[2]: [Makefile:226: charset.o] Error 1 make[2]: Leaving directory '/home/ahmed/Procursus/build_work/iphoneos-arm64/1600/gcc/gcc-0~20210702./build-x86_64-pc-linux-gnu/libcpp' make[1]: [Makefile:2919: all-build-libcpp] Error 2 make[1]: Leaving directory '/home/ahmed/Procursus/build_work/iphoneos-arm64/1600/gcc/gcc-0~20210702.' make: *** [Makefile:970: all] Error 2 Unfortunately, when specifying CXX=aarch64-apple-darwin-clang++ ./configure, the compiler choice is not being respected

iains commented 3 years ago

1) in-source configuration is not supported by GCC.

2) Is "aarch64-pale-darwin " recognised by upstream config.sub/guess?

3) what you are trying to do is not supported at all by the current (prototype) branch - see

Setting up an iOS cross-compiler #34

(this is a duplicate, I think, of that)

First we need to sort out the issues with building a reliable native compiler - and then we can see about cross-compilers for iOS (I am not even sure how that can be tested without a jailbroken iOS device?)

demhademha commented 3 years ago

Hi, as you said, a jailbroken device would be required to run gcc - which you are correct. we have been able to successfully port llvm/clang and binutils to iOS successfully - showing that there is hope for this port. Another issue that I am facing is the following After running ./configure (which is successful) and then make again, I get the followingg error: configure: creating ./config.status config.status: creating Makefile config.status: creating testsuite/Makefile config.status: creating config.h config.status: executing default commands

What is bizarre is if I type make manually, the compilation continues - I'd just expect make to keep going. Regards :

iains commented 3 years ago

Hi, as you said, a jailbroken device would be required to run gcc - which you are correct.

OK, not something I have access to...

After running ./configure (which is successful) and then make again, I get the followingg error:

As noted above 1) GCC does not support in-source builds - see https://gcc.gnu.org/install/ 2) see the comments in Setting up an iOS cross-compiler #34, they are relevant

3) I have no problem building cross-compiler to arm64 from x86_64 (or, indeed, building native crosses on x86_64 darwin20 - that's how I built the original bootstrap compiler for the arm64 port) .. so (once the issues with supporting iphoneos/iOS as a target are dealt with) then I would expect this to work as well.

We have to fix the higher priority things first tho :)

demhademha commented 3 years ago

Closing in favour of #34