SeanLyons[m]: > <@seanmlyons22:matrix.org> I am trying to link a c static library into my rust program. Does anyone know if there is any requirements of the library for `rust-lld` to find it? I am quite sure that I have the right `-L` and `-l` options. I am calling rustc directly to strip out any potential issues with cargo or build.rs. > > This is the command (note that I have also tried with `-L` and `-l`: > > ``` > rustc --crate-name cc13x2_cc26x2_flash --edition=2021 src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 -C debug-assertions=on -C metadata=1ab2fc47a140afb5 -C extra-filename=-1ab2fc47a140afb5 --out-dir /Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps --target thumbv7em-none-eabi -L dependency=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps -L dependency=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/debug/deps --extern cortex_m=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps/libcortex_m-8a38242e065cd52d.rlib --extern flash_algorithm=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps/libflash_algorithm-c1ddc23f2f09f032.rlib --extern libc=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps/liblibc-492e23184cbd9914.rlib --extern rtt_target=/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/deps/librtt_target-0ea74ddb0a3e4deb.rlib -C link-arg=--nmagic -C link-arg=-Tlink.x -C link-arg=-Tmemory.x -C inline-threshold=5 -C no-vectorize-loops -C force-frame-pointers=no -l "/Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/lib/driverlib.a" -L /Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/build/cortex-m-3b797ecef263c29e/out -L /Users/seanlyons/dev/rust/cc13x2-cc26x2-flash/target/thumbv7em-none-eabi/debug/build/flash-algorithm-b2e1a7e29afecc9c/out > ``` > > Things I tried: > > 1. invoking `file` on the library says "current ar archive" > 2. Running `arm-none-eabi-readelf -h lib/driverlib.a` gives the following: > > ``` > File: lib/driverlib.a(pwr_ctrl.o) > ELF Header: > Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 > Class: ELF32 > Data: 2's complement, little endian > Version: 1 (current) > OS/ABI: UNIX - System V > ABI Version: 0 > Type: REL (Relocatable file) > Machine: ARM > Version: 0x1 > Entry point address: 0x0 > Start of program headers: 0 (bytes into file) > Start of section headers: 2632 (bytes into file) > Flags: 0x5000000, Version5 EABI > Size of this header: 52 (bytes) > Size of program headers: 0 (bytes) > Number of program headers: 0 > Size of section headers: 40 (bytes) > Number of section headers: 24 > ``` Your readelf says the OS/ABI is Unix. Is that right?