NixOS / patchelf

A small utility to modify the dynamic linker and RPATH of ELF executables
GNU General Public License v3.0
3.57k stars 487 forks source link

`make check` fails on AlmaLinux 8 on arm8 CPU #429

Closed bigcat88 closed 1 year ago

bigcat88 commented 2 years ago

On arm8 two tests fails.

FAIL: replace-add-needed.sh FAIL: set-interpreter-long.sh

Steps To Reproduce

FROM almalinux:8.6

RUN \
  dnf update -y && \
  dnf install -y \
    git \
    cmake \
    autoconf \
    automake \
    gcc \
    gcc-c++ && \
  echo "**** Installing Patchelf ****" && \
  git clone https://github.com/NixOS/patchelf.git && \
  cd patchelf && \
  ./bootstrap.sh && ./configure && make && make check && make install

Expected behavior

To pass tests... python's auditwheel produce invalid binaries on that OS.

patchelf --version output 0.16.1 0.17.0-alpha

Additional context

patchelf was tested on amd64 on the same OS - it was fine and works fine. We need that on AlmaLinux 8 to work, cause this OS is officially used to build python libraries.

Mic92 commented 2 years ago

We would also need tests/replace-add-needed.sh.log and tests/set-interpreter-long.sh.log produced by these tests to see what is going wrong.

bigcat88 commented 2 years ago

patchelf 0.17.0-alpha: tests/test-suite.log

Look like there is no much info...

Redbeanw44602 commented 2 years ago

I think this is related to #425

bigcat88 commented 2 years ago

Looks like my problem is duplicate of https://github.com/NixOS/patchelf/issues/426 , except on amd64 for me all is fine.

Mic92 commented 2 years ago

The add-debug-tag.sh error is due a binutils bug that I have worked around in https://github.com/NixOS/patchelf/pull/435

Mic92 commented 2 years ago

I cannot reproduce any of the test failures in the latest master of patchelf (78a2a707e4dde495b7f02816dd973554d8c3365d) in almalinux on arm8.

This is what I run:

[root@07bfd7de4c43 src]# uname -a
Linux 07bfd7de4c43 5.10.150 #1-NixOS SMP Wed Oct 26 11:25:57 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
> docker run -v$(pwd):/src --rm -ti arm64v8/almalinux   
> dnf install -y autoconf automake gcc gcc-c++ make
> ./bootstrap.sh 
> ./configure
> make
> make check
>  cat /etc/os-release 
NAME="AlmaLinux"
VERSION="8.6 (Sky Tiger)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.6 (Sky Tiger)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:8::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8"
ALMALINUX_MANTISBT_PROJECT_VERSION="8.6"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.6"
bigcat88 commented 2 years ago

Linux buildkitsandbox 5.15.0-1022-azure #27~20.04.1-Ubuntu SMP Mon Oct 17 02:03:50 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux AlmaLinux the same version that in your logs - tests failed... maybe it is some GitHub error in emulator? Looks like it is not easily reproducible.(checked this on 0.16.1 version)

Updated: On last version from git, add-debug-tag.sh is ok, but those two replace-add-needed.sh and set-interpreter-long.sh are still fails.

Mic92 commented 2 years ago

I tested this on real hardware and using qemu-user emulation on x86_64.

bigcat88 commented 2 years ago

I can create a test repo with one action file and dockerfile that reproduce what I got, or can close an issue. I do not understand how we got different results and what cause this.

thesamesam commented 2 years ago

If you have some way of reproducing it easily, then of course it'd be great to share it.

bigcat88 commented 2 years ago

https://github.com/bigcat88/test_patchelf

Bo98 commented 1 year ago

replace-add-needed doesn't seem to be a patchelf bug as bypassing patchelf entirely still doesn't work:

# gcc -o simpletest tests/simple.c
# ldd simpletest
ldd: exited with unknown exit code (139)

Same with set-interpreter-long:

# /lib/ld-linux-aarch64.so.1 ./simpletest
Segmentation fault

A direct ./simpletest doesn't segfault, despite /lib/ld-linux-aarch64.so.1 being listed under .interp.

System dynamic linker just seems busted in general under this setup. patchelf itself seems to work though.

bigcat88 commented 1 year ago

I am closing this, cause on quay.io/pypa/manylinux_2_28_aarch64 docker image(os is the same) it is works...

edited: no it doesn't work but looks like it is really not a patchelf problem, as mentioned before