Skip to contentSkip to conversation

-mmusl missing in SDK / CMake MUSL toolchain

OE-core Leon Woestenberg 2 participants 3 messages Aug 19, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

RFC:

During the creation of the environment script for the canadian cross SDK in toolchain-script.bbclass,
for a MUSL C library target, the OVERRIDES contains libc-glibc instead of libc-musl.

OVERRIDES=task-generate-content:linux-musl:x86-64:pn-meta-environment-qemux86-64:qemuall:qemux86-64:nodistro:class-cross-canadian:libc-glibc:forcevariable

This can be easily inspected by adding these lines to the script creation (Thanks to Richard for the suggestion on IRC).

        echo 'export TARGET_CC_ARCH=${TARGET_CC_ARCH}' >> $script
        echo 'export OVERRIDES=${OVERRIDES}' >> $script

This append at the top of toolchain-script.bbclass is thus without effect:
TARGET_CC_ARCH_append_libc-musl = " -mmusl"

This works:

TARGET_CC_ARCH_append_linux-musl = " -mmusl"

(notice linux instead of libc, as linux-musl stays present in OVERRIDES.)

I have a (minimal) test case here. Run make in the cloned repo.
https://github.com/likewise/oe-musl-sdk-cmake

Regards,

Signature · 18 lines
Leon

p.s. sorry for the HTML sig earlier.

-- 
Leon Woestenberg
[email protected]
T: +31 40 711 42 76
M: +31 6 472 30 372

Sidebranch Embedded Systems
Eindhoven, The Netherlands
http://www.sidebranch.com



On Mon, Aug 17, 2020 at 5:28 PM Leon Woestenberg via
lists.openembedded.org <[email protected]>
Quoted 27 lines · wrote:

Hello all,

Compared with a BitBake/CMake built of a C application, the SDK/CMake approach lacks the "-mmusl" flag. The resulting binaries of the SDK do not load on the target (wrong runtime linker/loader).

Minimal test case here (dunfell), just run make will show PASS / FAIL for BitBake and SDK approach:

https://github.com/likewise/oe-musl-sdk-cmake

Has something to do with TARGET_CC_ARCH not propagating, investigation further...

Regards,

Leon.
--
--
Leon Woestenberg
[email protected]
T: +31 40 711 42 76
M: +31 6 472 30 372

Sidebranch Embedded Systems
Eindhoven, The Netherlands
http://www.sidebranch.com

#2 lore raw
Quoted 18 lines · Leon Woestenberg

RFC:

During the creation of the environment script for the canadian cross SDK in toolchain-script.bbclass,
for a MUSL C library target, the OVERRIDES contains libc-glibc instead of libc-musl.

OVERRIDES=task-generate-content:linux-musl:x86-64:pn-meta-environment-qemux86-64:qemuall:qemux86-64:nodistro:class-cross-canadian:libc-glibc:forcevariable

This can be easily inspected by adding these lines to the script creation (Thanks to Richard for the suggestion on IRC).

        echo 'export TARGET_CC_ARCH=${TARGET_CC_ARCH}' >> $script
        echo 'export OVERRIDES=${OVERRIDES}' >> $script

This append at the top of toolchain-script.bbclass is thus without effect:
TARGET_CC_ARCH_append_libc-musl = " -mmusl"

Quoted 9 lines

This works:

TARGET_CC_ARCH_append_linux-musl = " -mmusl"

(notice linux instead of libc, as linux-musl stays present in OVERRIDES.)

I have a (minimal) test case here. Run make in the cloned repo.
https://github.com/likewise/oe-musl-sdk-cmake

FYI,

Sounds like you ran into the SDK / musl problem

sdk: compiler targets glibc, even though rootfs uses musl-libc
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13459

Using TCLIB=musl results in SDKs producing incompatible binaries
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13766

#3 lore raw

Hello Fred,

Quoted 10 lines

This append at the top of toolchain-script.bbclass is thus without effect:
TARGET_CC_ARCH_append_libc-musl = " -mmusl"

This works:

TARGET_CC_ARCH_append_linux-musl = " -mmusl"

FYI,
Sounds like you ran into the SDK / musl problem

Thanks, I have updated
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13459 with my findings so far.

Regards,

Leon.