raylib-rs icon indicating copy to clipboard operation
raylib-rs copied to clipboard

Failing to link with shared raylib

Open rakivo opened this issue 1 year ago • 0 comments

I've followed nobuild guide but anyway keep facing this error:

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/yarson/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/yarson/.cargo/bin:/usr/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/rocm/bin:/usr/lib/rustup/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcv68FIE/symbols.o" "/home/yarson/Coding/probe/raylib_rust/target/release/deps/raylib_rust-4d232eb3bbaff2ef.raylib_rust.311e897e0720339c-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/home/yarson/Coding/probe/raylib_rust/target/release/deps" "-L" "./build/" "-L" "/home/yarson/Coding/probe/raylib_rust/target/release/build/raylib-sys-3c90d6748415b075/out" "-L" "/home/yarson/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bdynamic" "-lraylib" "-L" "/home/yarson/Coding/probe/raylib_rust/target/release/deps" "-lplug" "-Wl,-Bstatic" "/home/yarson/Coding/probe/raylib_rust/target/release/deps/liblibloading-0d7a5d82a9890c35.rlib" "-L" "/home/yarson/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bdynamic" "-lstd-2d08990d644ac786" "-Wl,-Bstatic" "/home/yarson/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-715e69127681e2e0.rlib" "-Wl,-Bdynamic" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/yarson/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/yarson/Coding/probe/raylib_rust/target/release/deps/raylib_rust-4d232eb3bbaff2ef" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/yarson/Coding/probe/raylib_rust/target/release/deps/libplug.so: undefined reference to `GetDroppedFiles'
          /usr/bin/ld: /home/yarson/Coding/probe/raylib_rust/target/release/deps/libplug.so: undefined reference to `GetScreenData'
          /usr/bin/ld: /home/yarson/Coding/probe/raylib_rust/target/release/deps/libplug.so: undefined reference to `CloseAudioStream'
          /usr/bin/ld: /home/yarson/Coding/probe/raylib_rust/target/release/deps/libplug.so: undefined reference to `StopSoundMulti'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

my build.rs:

fn main() {
    println!("cargo:rustc-link-search=./build/");
    println!("cargo:rustc-link-lib=raylib");
}

I've tried raylib 3.5, raylib 3.0, not working.

My rustc version: rustc 1.77.2 (25ef9e3d8 2024-04-09).

It's strange though, linkage failed only with this 4 functions

rakivo avatar May 10 '24 20:05 rakivo