Skip to content

[BUG] r31 Beta 1 Linux ARM64: simpleperf cannot find libc_musl.so at startup #2270

Todo

Description

@mkurz

Description

In the official NDK r31 Beta 1 Linux ARM64 archive, the host simpleperf executable fails before displaying help because it cannot locate libc_musl.so. Adding the directory containing the NDK's existing ARM64 copy to LD_LIBRARY_PATH makes the same executable start successfully.

Filing separately from #1752 as requested for Linux ARM64 host problems.

Package

Reproduction

Extract the archive without modifying it, then replace the path below:

ndk_root=/absolute/path/to/android-ndk-r31-beta1
env -i PATH=/usr/bin:/bin "$ndk_root/simpleperf/bin/linux/arm64/simpleperf" --help

Observed exit status: 1. In the actual test sandbox the extracted package was mounted at /ndk, and stderr was:

relinterp: /ndk/simpleperf/bin/linux/arm64/simpleperf: fatal error: unable to find loader libc_musl.so in rpath $ORIGIN/:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/../../lib64:$ORIGIN/../../../lib64

Expected: usage/help output and exit status 0 without needing an additional library-path setting for the shipped executable.

Diagnostic comparison

With the same unmodified executable and environment, add only the existing bundled library directory:

env -i PATH=/usr/bin:/bin \
  LD_LIBRARY_PATH="$ndk_root/toolchains/llvm/prebuilt/linux-arm64/lib" \
  "$ndk_root/simpleperf/bin/linux/arm64/simpleperf" --help

This prints the normal usage and subcommand list and exits 0.

The failing run was also traced with strace. All five loader lookups return ENOENT:

/ndk/simpleperf/bin/linux/arm64/libc_musl.so
/ndk/simpleperf/bin/linux/arm64/lib64/libc_musl.so
/ndk/simpleperf/bin/linux/arm64/../lib64/libc_musl.so
/ndk/simpleperf/bin/linux/arm64/../../lib64/libc_musl.so
/ndk/simpleperf/bin/linux/arm64/../../../lib64/libc_musl.so

The package contains libc_musl.so elsewhere, including toolchains/llvm/prebuilt/linux-arm64/lib/libc_musl.so.

Test conditions and scope

The tests used Bubblewrap with networking disabled, the NDK and system tools mounted read-only, a cleared environment, private temporary/work directories, and a 20-second timeout. Neither run timed out. The tested Simpleperf executable was compared byte-for-byte with its ZIP member afterward and was unchanged.

The host has 16 KB pages, but a page-size-specific cause has not been established; a 4 KB host was not tested. The successful comparison covers startup/help only. Profiling and libsimpleperf_report.so were not functionally tested.

I am using a supported NDK

  • I have checked and the NDK I'm using is currently supported

Affected versions

r31 (31.0.16996043-beta1)

Host OS

Linux (arm64)

Host OS version

Arch Linux ARM; kernel 7.1.13-3-2-ARCH; uname -m: aarch64; getconf PAGE_SIZE: 16384.

Affected ABIs

Not applicable: failure is in a Linux host executable before any Android target is involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions