deckarep / flappy-rust

A Rust SDL2 clone of Flappy Gopher which is a clone of Flappy Bird
65 stars 4 forks source link

/usr/bin/ld: cannot find -lSDL2_image and the like #1

Open GildedHonour opened 7 years ago

GildedHonour commented 7 years ago

Arch linux, sdl2 is installed, the "-dev" is installed automatically with sdl2. but:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "/home/alex/tmp/flappy-rust/target/debug/deps/flappy_rust-24495436fb6b58aa.0.o" "-o" "/home/alex/tmp/flappy-rust/target/debug/deps/flappy_rust-24495436fb6b58aa" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/alex/tmp/flappy-rust/target/debug/deps" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/alex/tmp/flappy-rust/target/debug/deps/libsdl2-3b347601ec96a2c3.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/liblazy_static-3b17cb290f94de07.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libc_vec-be496150d8557b7a.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libnum-1dc0cc712369fa49.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libnum_iter-e3d53b72a44dd492.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libnum_integer-bbbfaf8dce75e1b6.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libbitflags-65ddff5d2b91509e.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/librand-c9d9fbdab2355ee4.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libnum_traits-69f4129d46397118.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/libsdl2_sys-ee994632e6c1cf31.rlib" "/home/alex/tmp/flappy-rust/target/debug/deps/liblibc-5dc7b85e748840b4.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-59ddb13a3f650112.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-767b332f5908b01d.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-f398b0d5b9a21c21.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-6b4d3f27209030d8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-3af8bfb25c05686b.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f1fb18790492c3aa.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-6bc0b2bf6ca2be30.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-ca857c642bda864a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-77fac022534befb6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9d5fb400d5bdba42.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9e459e24d06424e8.rlib" "-l" "SDL2_ttf" "-l" "SDL2_image" "-l" "SDL2_mixer" "-l" "SDL2_gfx" "-l" "SDL2" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /usr/bin/ld: cannot find -lSDL2_ttf
          /usr/bin/ld: cannot find -lSDL2_image
          /usr/bin/ld: cannot find -lSDL2_mixer
          /usr/bin/ld: cannot find -lSDL2_gfx
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile `flappy-rust`.

Caused by:
  process didn't exit successfully: `rustc --crate-name flappy_rust src/main.rs --crate-type bin --emit=dep-info,link -ebuginfo=2 -C metadata=24495436fb6b58aa -C extra-filename=495436fb6b58aa --out-dir /home/alex/tmp/flappy-rust/targetbug/deps -L dependency=/home/alex/tmp/flappy-rust/target/dg/deps --extern sdl2=/home/alex/tmp/flappy-rust/target/debdeps/libsdl2-3b347601ec96a2c3.rlib --extern rand=/home/alemp/flappy-rust/target/debug/deps/librand-c9d9fbdab2355ee4.b` (exit code: 101)
light4 commented 7 years ago

@GildedHonour Have you installed sdl2_mixer, sdl2_ttf, sdl2_image and sdl2_gfx?

GildedHonour commented 7 years ago

@light4 they're already specified in the Cargo.toml and that error is caused by cargo build

ironicbrew commented 3 years ago

@GildedHonour I had this same issue, you need to install them on Arch separately to get the examples to work

ex.

https://archlinux.org/packages/extra/x86_64/sdl2_gfx/

pacman -S sdl2_gfx