Skip to content

Revert libc::memfd_create for gnu and musl #2005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

StephenWakely
Copy link

Closes #1972

cf15c2b introduced changes to force a hard dependency on libc::memfd_create. This symbol doesn't exist in Ubuntu 16.04 or CentOS 7 and thus it breaks our builds. Neither of these are EOL for a few more years.

 = note: /target/x86_64-unknown-linux-gnu/debug/deps/libnix-0e1e3ef93965abb0.rlib(nix-0e1e3ef93965abb0.nix.194bd3d9-cgu.7.rcgu.o): In function `nix::sys::memfd::memfd_create::h8f53f62aa4e9fe80':
          /cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/nix-0.26.2/src/sys/memfd.rs:56: undefined reference to `memfd_create'
          collect2: error: ld returned 1 exit status

This change pulls out using libc::memfd_create for gnu and musl. I believe the original commit was intended just for freebsd, so the original intent of that commit remains unchanged.

@asomers
Copy link
Member

asomers commented Feb 26, 2023

I don't want to hold back development for the sake of six year old distros. The correct solution is to figure out the righth way to enable as-needed in the linker.

@jszwedko
Copy link

I don't want to hold back development for the sake of six year old distros.

That is completely reasonable. Do you have a minimum glibc that you are targeting? That would help with setting expectations. With https://github.com/vectordotdev/vector, we have users deploying on systems with older libcs (in particular CentOS 7) and so have a desire to maintain compatibility with them.

@asomers
Copy link
Member

asomers commented Feb 27, 2023

No, we don't target a minimum glibc. Have you checked to see what, if any, minimum glibc the Rust standard library targets?

@asomers
Copy link
Member

asomers commented Feb 27, 2023

Actually, I don't think glibc is really the problem. The problem is more likely the old linker that you're using.

@jszwedko
Copy link

No, we don't target a minimum glibc. Have you checked to see what, if any, minimum glibc the Rust standard library targets?

It looks like 2.17, which matches what we are targeting: https://github.com/rust-lang/rust/blob/7d782b7ff4d57170e110211565209ecc5bbb3907/src/doc/rustc/src/platform-support.md?plain=1#L40

@nekopsykose
Copy link

does RUSTFLAGS="-Clink-arg=-Wl,--as-needed" fix it for you, in case it's not the default?

@jszwedko
Copy link

jszwedko commented Mar 4, 2023

does RUSTFLAGS="-Clink-arg=-Wl,--as-needed" fix it for you, in case it's not the default?

We did try that, but it didn't seem to make a difference. See #1972 (comment)

@nekopsykose
Copy link

it's link-arg (linkarg isn't recognised?), but no worries, just a guess :)

@asomers
Copy link
Member

asomers commented Aug 11, 2023

Superseded by #2049

@asomers asomers closed this Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nix 0.26 can't work on ubuntu16.04
4 participants