gcc cross-compiler hangs with musl libc
Quoted 34 lines · Ruslan Babayev
Hi Richard,
I recently noticed GCC in meta-toolchain misteriously hangs when trying to build
anything. This is my config (with meta-intel layers added):MACHINE = "crystalforest"
TCLIBC = "musl"I narrowed it down to gcc not liking '-m64' flag followed by ' -mmusl'.
$ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -m64 #works $ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -mmusl #works$ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -mmusl -m64 #works $ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -m64 -mmusl #hangs ^CSo it seems passing -mmusl is not required. Just to try this out I commented out TARGET_CC_ARCH_append_libc-musl line in meta/classes/toolchain-scripts.bbclass and rebuilt my meta-toolchain to
make GCC happy.I have seen this with musl and
x86_64with -m64 but I am guessing the issue might also affect other architechtures and tunes as well x86((quoted diff) +0
-2-m64, -m32, -mx32), powerpc (-m64, -m32) etc.
Quoted 2 lines
While this looks like a bug in GCC, is there a reason we need to pass -mmusl flag?
I'd imagine its telling gcc to link against the musl libc rather than the glibc one. Certainly, the order of the options shouldn't hang gcc, in fact gcc shouldn't ever hang due to the options passed so this sounds like a gcc bug.
I've cc'd Khem who knows more about the musl patches.
Cheers,
Richard
Quoted 18 lines · Richard Purdie
Quoted 17 lines · Ruslan Babayev
Hi Richard,
I recently noticed GCC in meta-toolchain misteriously hangs when trying to build
anything. This is my config (with meta-intel layers added):MACHINE = "crystalforest"
TCLIBC = "musl"I narrowed it down to gcc not liking '-m64' flag followed by ' -mmusl'.
$ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -m64 #works $ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -mmusl #works
Quoted 5 lines
Quoted 5 lines
$ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -mmusl -m64 #works $ x86_64-poky-linux-musl-gcc --sysroot=/opt/poky/2.1/sysroots/corei7 -64-poky-linux-musl hello.c -o hello -m64 -mmusl #hangs ^C
Can you pass -v option and see where it hangs ?, secondly whats your SDK_HOST
Quoted 6 lines
Quoted 6 lines
So it seems passing -mmusl is not required. Just to try this out I commented out TARGET_CC_ARCH_append_libc-musl line in meta/classes/toolchain-scripts.bbclass and rebuilt my meta-toolchain to
make GCC happy.
OK thats a good datapoint, I can try to reproduce it.
Quoted 21 lines
Quoted 8 lines
I have seen this with musl and
x86_64with -m64 but I am guessing the issue might also affect other architechtures and tunes as well x86((quoted diff) +0
-2-m64, -m32, -mx32), powerpc (-m64, -m32) etc.While this looks like a bug in GCC, is there a reason we need to pass -mmusl flag?
I'd imagine its telling gcc to link against the musl libc rather than the glibc one. Certainly, the order of the options shouldn't hang gcc, in fact gcc shouldn't ever hang due to the options passed so this sounds like a gcc bug.
I've cc'd Khem who knows more about the musl patches.
Cheers,
Richard