0

I'm trying to cross compile a rust project with cross. My project depends on libcurl. The linker can find the libcurl .so but not the libraries which it depends on:

I'm running:

cross build -vv --target=arm-unknown-linux-gnueabihf

which gives me:

  = note: /usr/arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libnghttp2.so.14, needed by /usr/lib/arm-linux-gnueabihf/libcurl.so, not found (try using -rpath or -rpath-link)

I've already confirmed that the library its looking for exists:

root@80a13d68ad84:/# find /usr/lib -name "libnghttp2.so.14"
/usr/lib/x86_64-linux-gnu/libnghttp2.so.14
/usr/lib/arm-linux-gnueabihf/libnghttp2.so.14

I've read about rust build scripts here, where I can add paths to the library search path, but that has not resolved the issue, this is what my build.rs looks like:

fn main() {
    println!("cargo:rustc-link-search=native=/usr/lib/arm-linux-gnueabihf");
}

The error suggests using -rpath or -rpath-link, so how do I configure the rpath in rust? Or is there a different way to resolve this issue?

XORNAND
  • 142
  • 1
  • 4

1 Answers1

0

You might be able to specify linker arguments by using an environment variable like

RUSTFLAGS="-C link-arg=--rpath=..."

Cargo allows placing the same kind of flag in the configuration file (see here) but I'm not sure if cross has the same support for something like that.