Skip to content

std::sys::env::environ is causing linking problems on FreeBSD #153451

@arrowd

Description

@arrowd

On FreeBSD the extern char** environ symbol is defined in the CRT rather than libc. This is known to cause linking problems for shared libraries when the linker is passed --no-undefined. The usual workaround for this issue is to resolve environ dynamically as suggested in https://reviews.freebsd.org/D30842#840642 I already pushed such a fix into LLVM and some other projects.

I've put up a minimal reproduction code at https://github.com/arrowd/rust-environ-problem Simply run make to get the linking error.

CC @asomers

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dynamic-libraryArea: Dynamic/Shared LibrariesA-linkageArea: linking into static, shared libraries and binariesA-processArea: `std::process` and `std::env`C-bugCategory: This is a bug.O-freebsdOperating system: FreeBSDT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions