Skip to content

mbuffer: cross-compiled libgcc_s.so.1 must be built with glibc headers for pthread_cleanup_push() to work #213453

@Majiir

Description

@Majiir

Describe the bug

On armv7l-linux or aarch64-linux cross-compiled from x86_64-linux, mbuffer breaks:

$ echo "hello" | mbuffer
hello
libgcc_s.so.1 must be installed for pthread_exit to work
Aborted (core dumped)

From armv7l-linux:

Module linux-vdso.so.1 with build-id 04745a31932e964ec4cd2f2af22bff73c959bc5d
Module libatomic.so.1 without build-id.
Module libdl.so.2 with build-id e21ee3b08115e4ff693e068a5ae47e30a6eed56e
Module ld-linux-armhf.so.3 with build-id 5450bffccfed072763370bd64a69b6ea758babb1
Module libc.so.6 with build-id cc4343a8abc2fde08e30176f06b9f4385f438ef5
Module libpthread.so.0 with build-id 6b805729d47513ad23db66eeac106a69998cb666
Module libm.so.6 with build-id 9350661951669899d3d720161626db749d157003
Module libcrypto.so.3 with build-id f4a6e190dcfd9af5793d9afd5cd89ef82559a3e4
Module mbuffer without build-id.
Stack trace of thread 2019:
#0  0x00000000b6a7b2f8 __pthread_kill_implementation (libc.so.6 + 0x7b2f8)
ELF object binary architecture: ARM

Steps To Reproduce

You can either run this on another architecture using boot.binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ].

$ nix build nixpkgs#pkgsCross.aarch64-multiplatform.mbuffer
$ echo "hello" | result/bin/mbuffer

or

$ nix build nixpkgs#pkgsCross.armv7l-hf-multiplatform.mbuffer
$ echo "hello" | result/bin/mbuffer

Expected behavior

mbuffer should not crash:

$ echo "hello" | mbuffer
hello
summary:  0.0 kiByte in  0.0sec - average of  0.0 kiB/s

Additional context

This was responsible for syncoid failing to replicate datasets to my ARM NAS.

The issue does not occur for natively compiled aarch64-linux builds. It appears to be a cross-compilation issue only.

Notify maintainers

@tokudan @skeuchel

Metadata

 - system: `"armv7l-linux"`
 - host os: `Linux 6.1.8, NixOS, 22.11 (Raccoon), 22.11.20230127.cc4bb87`

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used on
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions