ring icon indicating copy to clipboard operation
ring copied to clipboard

Building on AArch64 Linux with Clang complaining about not having fPIC

Open SchrodingerZhu opened this issue 2 years ago • 3 comments

Basically, I got a same error as https://github.com/monero-project/monero/issues/1304. Maybe -fPIC flag is needed https://github.com/briansmith/ring/blob/08fcf4a5b9bfa7e06863e586cef8e4f137604439/build.rs#L518

SchrodingerZhu avatar Dec 24 '21 06:12 SchrodingerZhu

readelf -r ring-c322d96f1cad079c/out/*.o | grep GFp_armcap_P

000000000004  000f00000114 R_AARCH64_ADR_PRE 0000000000000000 GFp_armcap_P + 0
000000000010  000f0000011d R_AARCH64_LDST32_ 0000000000000000 GFp_armcap_P + 0
000000000000  000e00000113 R_AARCH64_ADR_PRE 0000000000000000 GFp_armcap_P + 0
000000000004  000e0000011d R_AARCH64_LDST32_ 0000000000000000 GFp_armcap_P + 0

SchrodingerZhu avatar Dec 24 '21 09:12 SchrodingerZhu

readelf -r ring-e283409aa5b73913.ring.1h5en42m-cgu.1.rcgu.o | grep GFp_armcap_P

T 0000000000000000 GFp_armcap_P + 0
000000000020  05bd00000138 R_AARCH64_LD64_GO 0000000000000000 GFp_armcap_P + 0
0000000000c8  05bd00000137 R_AARCH64_ADR_GOT 0000000000000000 GFp_armcap_P + 0
0000000000cc  05bd00000138 R_AARCH64_LD64_GO 0000000000000000 GFp_armcap_P + 0

SchrodingerZhu avatar Dec 24 '21 09:12 SchrodingerZhu

not sure what happened but this fix works for me:

https://chromium.googlesource.com/chromium/src.git/+/1ff8654cb2647b511cb32dae4ffea9f7929b1ed9

This flag is not clearly documented.

SchrodingerZhu avatar Dec 24 '21 10:12 SchrodingerZhu

Could somebody please test this with ring 0.17.3 and report whether it is still an issue?

briansmith avatar Oct 13 '23 23:10 briansmith

Closing due to inactivity, because in ring 0.17.x we've delegated the handle PIC-related compiler flag handling to cc-rs, and due to inactivity.

briansmith avatar Jan 16 '24 00:01 briansmith