Home > OS >  Compile time linker error on Ubuntu 22.04
Compile time linker error on Ubuntu 22.04

Time:09-20

When compiling Rust code on a fresh install of Ubuntu 22.04 LTS I get a linker error, here are the following details:

Uname -a

Linux AAAHHH 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Cargo version

cargo 1.63.0 (fd9c4297c 2022-07-01)

Full error

warning: unused import: `self`
 --> src/steps.rs:1:33
  |
1 | use egui_macroquad::macroquad::{self, prelude::*};
  |                                 ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `unnamed_mmo` (lib) generated 1 warning
   Compiling unnamed_mmo v0.1.0-pre-alpha.0 (/media/mreggo/Development/unnamed-mmo)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.0.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.1.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.10.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.11.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.12.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.13.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.14.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.15.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.2.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.3.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.4.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.5.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.6.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.7.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.8.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.9.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.cn983jvsi7mcs9h.rcgu.o" "-Wl,--as-needed" "-L" "/media/mreggo/Development/unnamed-mmo/target/debug/deps" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libunnamed_mmo-2c746eee4874a18d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui_macroquad-a8cc6dc94b07d25e.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libmacroquad-ac264e227317db34.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbumpalo-7d9155bf1a1665c3.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libfontdue-33a63242772c0327.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libttf_parser-b3c8b8d720c6b5c7.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libhashbrown-9e2decfb672733a0.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libahash-c5793c70560e7663.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libimage-1c895249afdb303d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcolor_quant-714c7bd4ee3b992f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_iter-95204558e59f30d3.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libpng-2cbdbec1823fbc5f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libminiz_oxide-8db99177623dc4aa.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcrc32fast-6a860851d096dc79.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libdeflate-c8c1809616477c8f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbyteorder-7b9cf4829e681df6.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libadler32-74ce685e2e920957.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbitflags-8780a692ba87d6ba.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_rational-12de4139181448df.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_integer-8cab700b16a4e037.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_traits-26d4c34b964a9552.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libquad_rand-99bba40bc69d3f4c.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libglam-370e9f6f5d986fca.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui_miniquad-2c0aac1d91c9642f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libquad_url-9e43f30574a6006a.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libwebbrowser-43f0af5d13c99f5b.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui-4e41391646208c48.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libepaint-77b2a6267e67391b.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnohash_hasher-9b983351300bd960.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libab_glyph-6925c34a95138a11.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libowned_ttf_parser-033f2e7aaabf7169.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libttf_parser-062a0ad8dfb5981c.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libab_glyph_rasterizer-c02d35faa1a9dd51.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libahash-0cdb04cf6022941f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libgetrandom-5f90ecbc2af37a3e.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcfg_if-98b415fcc3fed93d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libonce_cell-d6d4d0dc0f424a80.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libatomic_refcell-c2ffa9b2b327b49d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libemath-29d160f1dc82ca95.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbytemuck-7d72d8521917be17.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libminiquad-10b6f8f5710eb382.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libsapp_linux-1f0a95a8b78fa130.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/liblibc-6764eec4e7ae87b9.rlib" "-Wl,--start-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a0276d45c4e70d36.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e72e4bc570b29ac1.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-ef705efd7af4ac2a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-85860d11f97207b6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-dcaf592febce562e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-7eebb71bfaa13f92.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1bad01341e0f12ee.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-a19d31fe44863ac3.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-a0aa8c376bb6fe43.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-4163b7759a8467eb.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-037a678c8b3ea5d2.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-a1a7907c635fb0ff.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-54dd34e8808f1bfe.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7f95849889eaf9ae.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b38f3f2103ea975c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-36492562254cd4fb.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6648866114f93094.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-8180acc287427382.rlib" "-Wl,--end-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-e1b6a3281fcc9d3d.rlib" "-Wl,-Bdynamic" "-lGL" "-lX11" "-lXi" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lGL: No such file or directory
          /usr/bin/ld: cannot find -lX11: No such file or directory
          /usr/bin/ld: cannot find -lXi: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `unnamed_mmo` due to previous error

CodePudding user response:

Looks like you're missing a few libraries your project is trying to link with. Try this:

$ sudo apt install libgl-dev libx11-dev libxi-dev
  • Related