Skip to content

sdk-files: use patchelf "--no-sort" option on Debian 13#622

Open
Seongook-CHOI-ML wants to merge 1 commit intomiraclelinux:emlinux3from
Seongook-CHOI-ML:emlinux3-fix-sdk-installed-long-dir-on-trixie
Open

sdk-files: use patchelf "--no-sort" option on Debian 13#622
Seongook-CHOI-ML wants to merge 1 commit intomiraclelinux:emlinux3from
Seongook-CHOI-ML:emlinux3-fix-sdk-installed-long-dir-on-trixie

Conversation

@Seongook-CHOI-ML
Copy link
Copy Markdown
Contributor

Purpose

Fixes SDK binaries segfault problem when installed into long directory name on Debian 13.

How to test

  1. Modify docker/Dockerfile as the following for preparing Debian 13 docker build environment
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:bookworm
+FROM debian:trixie
 ENV DEBIAN_FRONTEND noninteractive
 ENV DEBCONF_NOWARNINGS yes

@@ -32,7 +32,7 @@ RUN apt-get install --fix-missing -y \
   sbuild \
   schroot \
   zstd \
-  python3-distutils \
+  python3-setuptools \
   python3-yaml \
   python3-html5lib \
   python3-pip \
  1. Rebuild docker image
$ ./docker/run.sh clean
$ ./docker/run.sh build
  1. Run docker
$ ./docker/run.sh
  1. Build SDK
$ source setup-emlinux
$ cat << EOF >> conf/local.conf
MACHINE = "qemu-arm64"
DISTRO = "emlinux-trixie"
$ bitbake emlinux-image-base -c populate_sdk
  1. Install SDK
$ ./tmp/deploy/images/qemu-arm64/emlinux-image-base-sdk-emlinux-trixie-qemu-arm64-sdk-installer.sh -d ./longdir/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Will you continue to install EMLinux SDK? [y/N]
y
Installing EMLinux SDK to /home/build/work/build/longdir/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 .
Adjusting path of SDK to '/home/build/work/build/longdir/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/emlinux-image-base-sdk-emlinux-trixie-qemu-arm64'... done
When you use the SDK in a new shell session, you need to run following command.
  $ source /home/build/work/build/longdir/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/emlinux-image-base-sdk-emlinux-trixie-qemu-arm64/environment-setup-qemu-arm64-emlinux-trixie
  1. Using SDK
$ source /home/build/work/build/longdir/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/emlinux-image-base-sdk-emlinux-trixie-qemu-arm64/environment-setup-qemu-arm64-emlinux-trixie
$ echo -e '#include<stdio.h>\nint main(void){printf("Hello world\\n");return 0;}' | ${CC} -Wall -x c - && /usr/bin/file a.out

Result

  1. Before this fix
$ echo -e '#include<stdio.h>\nint main(void){printf("Hello world\\n");return 0;}' | ${CC} -Wall -x c - && /usr/bin/file a.out
Segmentation fault (core dumped)
  1. After this fix
$ echo -e '#include<stdio.h>\nint main(void){printf("Hello world\\n");return 0;}' | ${CC} -Wall -x c - && /usr/bin/file a.out
a.out: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=3569a0a26cc99ab19dac1b990be371ed6a67dc84, for GNU/Linux 3.7.0, not stripped

Patchelf version 0.18.0 of Debian 13 causes segfault of SDK binaries
which are installed into long directory name.
As a workaround, "--no-sort" option is used for the patchelf command.

Signed-off-by: SeongOok CHOI <seongook.choi@miraclelinux.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant