Skip to content
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

build.rs: emit position-independent code when compiling on ARM64 #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

belowm
Copy link

@belowm belowm commented Feb 25, 2025

Currently, this crate cannot be used in ARM64 projects: While the crate itself compiles just fine, a binary project depending on libxdp_sys fails to compile:

/usr/bin/ld: /home/.../target/debug/deps/liblibxdp_sys-7ecba993bf090f40.rlib(libxdp.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC 

This PR adds the CFLAGS -fPIC -pie when invoking make for libxdp, which fixes the issue (well, at least for me).

@chenhengqi chenhengqi requested a review from d0nutptr March 9, 2025 02:58
@chenhengqi
Copy link
Owner

@KarstenB Please help reviewing this PR. Thanks.

@KarstenB
Copy link
Collaborator

KarstenB commented Mar 9, 2025

What exactly are you trying to do? I use liblibxdp_sys via xsk-rs on my Mac in ARM64 linux without any issues. Are you trying to create a statically linked binary with musl?
A simple reproducable .devcontainer example would be awesome.

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.

3 participants