[poky] gcc cross-compiler hangs with musl libc
Richard Purdie
richard.purdie at linuxfoundation.org
Sat May 7 01:40:54 PDT 2016
On Fri, 2016-05-06 at 15:19 -0700, Ruslan Babayev wrote:
> 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
> ^C
>
> 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.
>
> I have seen this with musl and x86_64 with -m64 but I am guessing the
> issue might also affect other architechtures and tunes as well x86(
> -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
More information about the poky
mailing list