rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Fix for bindgen use in rust_shared_library

Open neilisaac opened this issue 1 year ago • 0 comments

When linking a rust_shared_library that depends on a bindgen_rust_library, I get errors such as:

          /usr/bin/ld.gold: error: /.../some_rust_binding.rlib(some_c_lib.o): requires dynamic R_X86_64_PC32 reloc against '_ZNSs4_Rep20_S_empty_rep_storageE' which may overflow at runtime; recompile with -fPIC

It looks to me like the rust_library target is including the cc_lib in its rlib output. This PR changes it to depend on the cc_library target instead, where the cc toolchain will provide both PIC and non-PIC objects to select as appropriate at link time.

neilisaac avatar Feb 24 '24 21:02 neilisaac