Why can't Rust-ldd see symbols in a static build of Libsvtav1?
12:51 20 Feb 2026

Disclosure: I am a totally blind individual. If there are any formatting issues with the below code snippets that I failed to detect, I respectfully request that you please bare with me.

I am attempting to link a static build of FFmpeg's Libav* libraries for use in a Rust application. I built FFmpeg and all of its dependencies as static libraries using my system's gcc (13.3.0, Ubuntu 24.04.1 WSL).

I am able to compile and link a simple C program that calls avformat_open_input() just fine. The exact same test in Rust results in numerous symbols from Libsvtav1 being reported as undefined by the linker.

These same results are obtained whether I attempt the build using my own build script or using one of the crates that
provide bindings to the FFmpeg libraries such as Rusty_ffmpeg. Attempting to link only Libsvtav1 and call into it directly (no FFmpeg) yields the same result as well.

Libsvtav1 is built using the exact same toolchain, and in the exact same environment as every other library in the set. I cannot work out what's special about it. The .a file itself is being found by Cargo just fine, but the linker can't seem to find symbols in it.

Build systems are not my strong suit. Is there some special flag I need to build Libsvtav1 with so that it can be linked successfully by both ld and Rust-ldd?

Libsvtav1 is built as follows:

git clone --depth=1 https://gitlab.com/AOMediaCodec/SVT-AV1.git
#Current FFmpeg does not support SVT-AV1 4.X yet. Todo bump this.
git fetch --tags
git checkout v3.1.2
cd SVT-AV1
mkdir ./build
cd build
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build/output"
make -j 8
make install

Attempt to link it using pkg-config crate:

let mut pkg_config = pkg_config::Config::new();
pkg_config.atleast_version("1.8.1");//Ubuntu 24.04.4.
pkg_config.statik(true);
pkg_config.probe("libavformat")
.unwrap();

Alternative attempt to configure the build manually with hard-coded search path:

println!("cargo::rustc-link-search=native=/home/caturria/ffmpeg_build/output/lib");
println!("cargo::rustc-link-search=native=/home/caturria/ffmpeg_build/output/lib/x86_64-linux-gnu ");
println!("cargo::rustc-link-lib=avformat");
println!("cargo::rustc-link-lib=avcodec");
println!("cargo::rustc-link-lib=swscale");
println!("cargo:rustc-link-lib=avutil");
println!("cargo::rustc-link-lib=crypto");
println!("cargo::rustc-link-lib=ssl");
println!("cargo::rustc-link-lib=x264");
println!("cargo::rustc-link-lib=SvtAv1Enc");
println!("cargo::rustc-link-lib=dav1d");
println!("cargo::rustc-link-lib=mp3lame");
println!("cargo::rustc-link-lib=opus");
println!("cargo::rustc-link-lib=vorbis");
println!("cargo::rustc-link-lib=vorbisenc");
println!("cargo::rustc-link-lib=ogg");
println!("cargo::rustc-link-lib=swresample");
println!("cargo::rustc-link-lib=z");

A total of thirteen undefined reference errors, all related to libSvtAv1Enc.a:

  = note: rust-lld: error: undefined symbol: svt_metadata_array_free
          >>> referenced by libsvtav1.c:419 (libavcodec/libsvtav1.c:419)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          >>> referenced by libsvtav1.c:680 (libavcodec/libsvtav1.c:680)
          >>>               libsvtav1.o:(eb_enc_close) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_add_metadata
          >>> referenced by libsvtav1.c:545 (libavcodec/libsvtav1.c:545)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_get_packet
          >>> referenced by libsvtav1.c:610 (libavcodec/libsvtav1.c:610)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_release_out_buffer
          >>> referenced by libsvtav1.c:665 (libavcodec/libsvtav1.c:665)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          >>> referenced by libsvtav1.c:627 (libavcodec/libsvtav1.c:627)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          >>> referenced by libsvtav1.c:619 (libavcodec/libsvtav1.c:619)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_send_picture
          >>> referenced by libsvtav1.c:556 (libavcodec/libsvtav1.c:556)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          >>> referenced by libsvtav1.c:511 (libavcodec/libsvtav1.c:511)
          >>>               libsvtav1.o:(eb_receive_packet) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_deinit
          >>> referenced by libsvtav1.c:675 (libavcodec/libsvtav1.c:675)
          >>>               libsvtav1.o:(eb_enc_close) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_deinit_handle
          >>> referenced by libsvtav1.c:676 (libavcodec/libsvtav1.c:676)
          >>>               libsvtav1.o:(eb_enc_close) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_init_handle
          >>> referenced by libsvtav1.c:433 (libavcodec/libsvtav1.c:433)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_parse_parameter
          >>> referenced by libsvtav1.c:324 (libavcodec/libsvtav1.c:324)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_set_parameter
          >>> referenced by libsvtav1.c:447 (libavcodec/libsvtav1.c:447)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_init
          >>> referenced by libsvtav1.c:452 (libavcodec/libsvtav1.c:452)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_stream_header
          >>> referenced by libsvtav1.c:465 (libavcodec/libsvtav1.c:465)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          
          rust-lld: error: undefined symbol: svt_av1_enc_stream_header_release
          >>> referenced by libsvtav1.c:480 (libavcodec/libsvtav1.c:480)
          >>>               libsvtav1.o:(eb_enc_init) in archive /home/caturria/ffmpeg_build/output/lib/libavcodec.a
          collect2: error: ld returned 1 exit status
          

error: could not compile `cvc_encoder` (bin "cvc_encoder") due to 1 previous error
c ffmpeg rust-cargo lld