Bindgen: Some extern functions couldn’t be found

⚓ Rust    📅 2025-07-17    👤 surdeus    👁️ 4      

surdeus

"Some extern functions couldn't be found; some native libraries may need to be installed or have their path specified"

Help with cargo build and Rust bindgen and custom C/C++ library, on Ubuntu Linux. Native libraries are mpfr, gmp, gmpxx. For purposes of this example, external code has been reduced to two functions, add_long(long i, long j) and add_double(double i, double j).

Note, the generated bindings.rs uses link_name with \u{1} whereas on GitHub the extern C code uses link(name="library_name"). Neither option appears to work!

Keywords:
bindgen
pkg-config
cargo:rustc-link-lib
cargo:rustc-link-search
.header()
.clang_arg()
.clang_args()
.allowlist_function()
.parse_callbacks()
CargoCallbacks
LD_LIBRARY_PATH
gmp
mpfr
library
dynamic
static
Makefile
cargo 1.87.0
rustc 1.87.0

https://github.com/AlexWeslowski/Bindgen-Demo

3 posts - 2 participants

Read full topic

🏷️ rust_feed