| Summary: |
Add multilib support to nativesdk-gcc in x86-64 buildtools-extended-tarball |
| Product: |
[Build System, Metadata & Runtime] OE-Core
|
Reporter: |
Hongxu Jia <hongxu.jia> |
| Component: |
devtools / tool chain | Assignee: |
Hongxu Jia <hongxu.jia> |
| Status: |
IN PROGRESS IMPLEMENTATION
---
|
QA Contact: |
|
| Severity: |
normal
|
|
|
| Priority: |
Medium
|
CC: |
hongxu.jia, meta.mr.watcher, meta.watcher, randy.macleod, ross.burton
|
| Version: |
5.3 | |
|
| Target Milestone: |
5.99 | |
|
| Hardware: |
x86 | |
|
| OS: |
Multiple | |
|
| Whiteboard: |
|
|
OS type for building Yocto:
|
---
|
Type of Regression:
|
New (Never tested)
|
|
Verified:
|
|
Documentation change:
|
No (bug/feature does not impact docs)
|
The background is we used extended buildtools SDK to provide gcc and other build tools on host for a Yocto build, but recipes that uses gcc-multilib and glibc-multilib on host will fail with extended buildtools. For example, lib32-luajit fails with extended buildtools. With a simple search, we have enabled multilib bbclass extension for target gcc [1][2] {noformat} $ cat << ENDOF > main.c #include <stdio.h> int main() { printf("Hello world"); return 0; } ENDOF $ gcc main.c -o main-64 $ gcc -m32 main.c -o main-32 $ file main-64 main-32 main-64: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6d51010a38e03f84ea07897cd4ba6fd97ef9c74b, for GNU/Linux 3.2.0, not stripped main-32: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=fc8c3058b07d98d2fd19d91a0bf9e35c715c7014, for GNU/Linux 3.2.0, not stripped {noformat} [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=1369 [2] https://git.openembedded.org/openembedded-core/commit/?id=b26819c85881e82ee1b5c68840011e78c321f18e Add this story is enable multilib for nativesdk gcc, similar like: ''' root@qemux86-64:~# ./x86_64-buildtools-extended-nativesdk-standalone-5.1.sh -d sdk root@qemux86-64:~# source sdk/environment-setup-x86_64-pokysdk-linux root@qemux86-64:~# which gcc /home/root/sdk/sysroots/x86_64-sdk-linux/usr/bin/gcc root@qemux86-64:~# gcc main.c -o main-64 root@qemux86-64:~# gcc -m32 main.c -o main-32 root@qemux86-64:~# file main-64 main-32 main-64: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter //home/root/sdk/sysroots/x86_64-sdk-linux/lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=3c912c568c7fce674deb3de2978abad0cfe41743, not stripped main-32: ELF 32-bit LSB pie executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter //home/root/sdk/sysroots/x86_64-sdk-linux/lib/ld-linux.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=49394a5afa840379278cf9e30ed6c7f8a251e850, not stripped ''' Yocto rejected to add multilib bbclass extension support for nativesdk recipe, but figure out the root cause: ''' the issue is that buildtools-extended-tarball doesn't contain 32 bit libgcc/glibc on 64 bit platforms and therefore can't build 32 bit binaries. ''' With a simple search, we could refer the multiconfig selftest case [3], add a nativesdk recipe nativesdk-multiconfig-multlib-toolchain-packager to fetch 32 bit libgcc/glibc from 32bit multiconfig build, package it and install to 64 bit buildtools-extended-tarball. Also reverse to fetch 64 bit libgcc/glibc from 64bit multiconfig build and instll to 32 bit buildtools-extended-tarball. [3] https://github.com/openembedded/openembedded-core/blob/master/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb Due to the supported SDKMACHINE is: ''' aarch64, i586, i686, loongarch64, ppc64, ppc64le, riscv64, x86_64 ''' Only i586 and x86_64, i686 and x86_64 have multilib relationship, I will choose i686 and x86_64 as the example, mainly includes - Enhance GCC to enable multilib for i686/x86_64/i586 nativesdk gcc - Enhance SDK to support multilib dynamic loaders relocation - Add a nativesdk recipe fetch and install missing libgcc/glibc - Add a template multlib-nativesdk-gcc to enable the feature for buildtools-extended-tarball build