Skip to content

libgcc_s.so is missing from glibc when cross compiling #40797

@lopsided98

Description

@lopsided98

Issue description

I'm not sure what the intended behavior actually is, but there is an issue with libgcc_s.so when cross-compiling, or perhaps the native case is actually incorrect.

I came across this problem when debugging why tmon crashes with the error: libgcc_s.so.1 must be installed for pthread_cancel to work when exiting, but only when it is cross-compiled. I noticed that, for native builds only, glibc copies libgcc_s.so from bootstrap gcc. This libgcc_s.so from the bootstrap tools is present in the glibc used to build all other derivations, which does not seem right to me (it doesn't seem like normal derivations should have access to any libraries/binaries from the the bootstrap tools).

pthreads needs libgcc_s.so, and it is able to find it when built natively because libgcc_s.so is part of glibc, which is on the RPATH. When cross-compiling, glibc does not have libgcc_s.so, and the gcc libs are not on the RPATH, so pthreads cannot find libgcc_s.so.

I can see that there are a number of cases where people have worked around this problem in nixpkgs, by manually linking to libgcc_s. This solves the problem for tmon, but I still think there is a bug because of the different behavior between native and cross builds.

cc @vcunat

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: cross-compilationBuilding packages on a different platform than they will be used on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions