gcc-darwin-arm64 icon indicating copy to clipboard operation
gcc-darwin-arm64 copied to clipboard

Link tests are not allowed after GCC_NO_EXECUTABLES

Open omus opened this issue 3 years ago • 15 comments

When using the branch master-wip-apple-si-on-2f7f0d32e740 I'm seeing the following failure:

configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES

I was not seeing this issue when building on master-wip-apple-si-on-1352bc88a05. I've since rebased the changes from master-wip-apple-si-on-1352bc88a05 using the same base commit used by master-wip-apple-si-on-2f7f0d32e740 (2f7f0d32e740) and also managed to build successfully.

I've managed to isolate the issue to the commit "Darwin, configury : Allow for specification and detection of dsymutil." (https://github.com/iains/gcc-darwin-arm64/commit/2e743ec2d1569bb589e49dd5d969970fae406fe6).

omus avatar Jan 27 '21 17:01 omus

I'll need some more info to narrow this down:

how are you configuring this? and with what build-time toolchain (e.g. Xcode version)

thanks

iains avatar Jan 27 '21 17:01 iains

I'm configuring via:

CC=/usr/bin/gcc CC_FOR_BUILD=/usr/bin/gcc CC_FOR_TARGET=/workspace/destdir/bin/aarch64-apple-darwin20-gcc /workspace/srcdir/gcc-darwin-arm64/configure --prefix=/workspace/destdir --target=aarch64-apple-darwin20 --host=x86_64-linux-musl --build=x86_64-linux-musl --disable-multilib --disable-werror --enable-shared --enable-host-shared --enable-threads=posix --with-sysroot=/workspace/destdir/aarch64-apple-darwin20/sys-root --program-prefix=aarch64-apple-darwin20- --disable-bootstrap

Using MacSDK 11.1 (Xcode 12.3 or 12.4)

Thanks for the quick response

omus avatar Jan 27 '21 18:01 omus

so you are building on x86_64-linux-musl intending to host on x86_64-linux-musl

recommendation A : drop every configure switch you don't need for some well-explained reason (e.g. --disable-multilib --disable-werror --enable-shared --enable-host-shared --enable-threads=posix)

====

I am not sure how to support this (I cannot replicate that environment for various reasons, some are non-technical), but I can tell you that cross and native cross compilers work fine from x86_64-apple-darwin19 / 20 => aarch64-apple-darwin20; Building a cross compiler should not really be an issue....

I do this:

  1. Bootstrap the compiler on $build (I am usually building Ada, so that doesn't support cross-compiles from different versions).

  2. build the cross on $build: /src-local/gcc-master-apple-si/configure --prefix=/opt/iains/x86_64-apple-darwin20/gcc-11-0-0-asi --target=aarch64-apple-darwin20 --host=x86_64-apple-darwin20 --build=x86_64-apple-darwin20 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk --enable-languages=all CC=x86_64-apple-darwin20-gcc CXX=x86_64-apple-darwin20-g++ >conf.txt

there are cross 'binutils' installed in /opt/iains/x86_64-apple-darwin20/gcc-11-0-0-asi/aarch64-apple-darwin20/bin

Where / how are you getting the assembler / linker / dsymutil for the cross compiler (perhaps from an LLVM build?)

(I then go on to build a native cross [target == host != build] for aarch64-apple-darwin20) - but you are not trying to do that.

iains avatar Jan 27 '21 20:01 iains

recommendation A : drop every configure switch you don't need for some well-explained reason

I'll give that a shot.

Where / how are you getting the assembler / linker / dsymutil for the cross compiler (perhaps from an LLVM build?)

We're using LLVM and cctools (instead of binutils). The automated script to perform the full build can be found at: https://github.com/JuliaPackaging/Yggdrasil/blob/be480a552d3a767f2323895b0f8adbbe7dd6e500/0_RootFS/gcc_common.jl#L259.

I'm still getting familiarized with GCCs build options so I'll look into why we do [target != host == build]

omus avatar Jan 27 '21 20:01 omus

We're using LLVM and cctools (instead of binutils).

in my text 'binutils' is in quotes for the same reason - it's Xcode / LLVM based; (but I am using Xcode 12.3 for which the sources are not yet released). I haven't actually tried to build a toolchain using older ld64 / llvm - there might be issues because of security procedure changes.

I'm still getting familiarized with GCCs build options so I'll look into why we do [target != host == build]

^^ this is correct for a cross-compiler (an aarch64 compiler to run on x86_64, built on x86_64).

FAOD: my third step produces a native compiler - i.e. building an aarch64 compiler to run on aarch64 but built on x86_64 (something one needs to do when bringing up a toolchain from scratch). You don't need to do this to make a "regular" cross-compiler.

iains avatar Jan 27 '21 21:01 iains

FWIW, given that building cross-compilers works for me, my guess is that the reported error is a symptom of something going wrong earlier in the configuration.

Make sure that your 'binutils' tools (as, ld, dsymutil, ar, nm, lipo, strip, ranlib) are properly installed (and actually work) .. a failure in finding something there could trigger an attempt to do something unexpected.

iains avatar Jan 27 '21 21:01 iains

Make sure that your 'binutils' tools (as, ld, dsymutil, ar, nm, lipo, strip, ranlib) are properly installed (and actually work) .. a failure in finding something there could trigger an attempt to do something unexpected.

I've been using the same 'bintools' with your earlier branches and and everything worked fine.

I'll be getting back to this soon. I'm working through an unrelated issue which should allow me iterate faster here.

omus avatar Jan 28 '21 16:01 omus

Any thoughts on why the commit "Darwin, configury : Allow for specification and detection of dsymutil." (2e743ec) seems to trigger the issue?

omus avatar Jan 28 '21 16:01 omus

Any thoughts on why the commit "Darwin, configury : Allow for specification and detection of dsymutil." (2e743ec) seems to trigger the issue?

Not specifically - I think you will need to look through the config.log(s) and see what fails first.

how/where are your 'binutils' installed?

I don't see any specific mention in your original config line - so I presume one of:

/workspace/destdir/aarch64-apple-darwin20/bin (without prefixes)

or as aarch64-apple-darwin20-xxxxx in some dir reachable in your PATH?

or...

iains avatar Jan 28 '21 16:01 iains

any more input on this, I have not been able to reproduce it with crosses from x86_64-apple-darwin20 => aarch64-apple-darwin20.

iains avatar Feb 07 '21 19:02 iains

Not yet unfortunately. Have had other work come up. This is still on my radar though.

omus avatar Feb 08 '21 15:02 omus

please try with the current master, the dsymutil patch has been applied upstream for some time now without reported issues.

iains avatar Dec 22 '21 20:12 iains

As of https://github.com/iains/gcc-darwin-arm64/commit/1af291c359b1dbfc3df80c31bc704871c8bb39f8

I have cleared a definite bug affecting cross-compiler builds, so now might be a good time to re-try.

iains avatar Jan 08 '22 17:01 iains

I'm also running into this problem when creating an iOS cross compiler from macOS Monterey x86_6.

  • Instructions from here (see my comment for command used)
  • branch master-wip-apple-si, head
The error.
checking for aarch64-apple-darwin20-ar... /usr/bin/ar                                                                                                                                                                
checking for aarch64-apple-darwin20-strip... (cached) aarch64-apple-darwin20-strip                                                                                                                                   
checking for aarch64-apple-darwin20-ranlib... /usr/bin/ranlib                                                                                                                                                        
checking command to parse /Users/tuco/Projects/gcc-darwin-arm64-build/./gcc/nm output from /Users/tuco/Projects/gcc-darwin-arm64-build/./gcc/xgcc -B/Users/tuco/Projects/gcc-darwin-arm64-build/./gcc/ -B/usr/local/s
tow/gfortran/aarch64-apple-darwin20/bin/ -B/usr/local/stow/gfortran/aarch64-apple-darwin20/lib/ -isystem /usr/local/stow/gfortran/aarch64-apple-darwin20/include -isystem /usr/local/stow/gfortran/aarch64-apple-darw
in20/sys-include    object... failed                                                                                                                                                                                 
checking for aarch64-apple-darwin20-dsymutil... aarch64-apple-darwin20-dsymutil                                                                                                                                      
checking for aarch64-apple-darwin20-nmedit... no                                                                                                                                                                     
checking for nmedit... nmedit                                                                                                                                                                                        
configure: WARNING: using cross tools not prefixed with host triplet                                                                                                                                                 
checking for aarch64-apple-darwin20-lipo... /usr/bin/lipo                                                                                                                                                            
checking for aarch64-apple-darwin20-otool... aarch64-apple-darwin20-otool
checking for aarch64-apple-darwin20-otool64... no                                                                                                                                                                    
checking for otool64... no                                                                                                                                                                                           
checking for -single_module linker flag... no                                                                                                                                                                        
checking for -exported_symbols_list linker flag... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.                                                                                            
make[1]: *** [configure-target-libssp] Error 1                                                                                                                                                                       
make: *** [all] Error 2  

meow464 avatar May 28 '22 02:05 meow464

is anyone still seeing this (if no reply in the next week I will close, AFAIK cross-compilers are working fine).

iains avatar Oct 15 '23 13:10 iains