SonuBardai / lockbox

L🦀CKBOX: Lockbox is a command-line tool built in rust for generating and managing passwords. It uses strong encryption algorithms to securely store your passwords, so you can be sure that your data is safe.
https://crates.io/crates/lock_box
MIT License
21 stars 10 forks source link

"linking with `cc` failed" when using cargo install #86

Closed JanNeuendorf closed 9 months ago

JanNeuendorf commented 10 months ago

I can not install the program by entering cargo install lock_box I get a long error related to missing C libraries. If I, however, clone the repo and run cargo install --path=. the program installs just fine. This problem appears on Ubuntu and Arch, but cargo install lock_box works fine on Fedora. I am not entirely sure that the problem is caused by lockbox, but I thought I should share this anyway, just in case.

SonuBardai commented 10 months ago

Hey @JanNeuendorf. Thankyou for creating the issue. Can you perhaps share the long error message that you're seeing when you try to install lockbox directly from cargo?

JanNeuendorf commented 9 months ago

Sure, here is the error message.

Compiling lock_box v0.1.1 error: linking with cc failed: exit status: 1

= note: LC_ALL="C" PATH="/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/jan/tectonic/tectonic:/usr/lib64/mpich/lib:/usr/lib64/mpich/bin:/home/jan/.wasmtime/bin:/home/jan/Dropbox/scripts:/home/jan/.cargo/bin:/home/jan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/jan/Dropbox/scripts" VSLANG="1033" "cc" "-m64" "/tmp/rustc54rtIl/symbols.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.0.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.1.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.2.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.3.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.4.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.5.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.6.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.7.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.lockbox.c900226f5b48af1f-cgu.8.rcgu.o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388.59v0ar1a1873y3ya.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/cargo-install8JkQof/release/deps" "-L" "/tmp/cargo-install8JkQof/release/build/ring-07c3ff7d0be53886/out" "-L" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-install8JkQof/release/deps/liblock_box-5c564c8ddcdf6c39.rlib" "/tmp/cargo-install8JkQof/release/deps/libserde_json-73b9e13067d10a58.rlib" "/tmp/cargo-install8JkQof/release/deps/libryu-0877fee6a683ae09.rlib" "/tmp/cargo-install8JkQof/release/deps/libitoa-77bfe198ba25d978.rlib" "/tmp/cargo-install8JkQof/release/deps/librpassword-969fe2fa07d52c0d.rlib" "/tmp/cargo-install8JkQof/release/deps/librtoolbox-00ca6c31dd56e29f.rlib" "/tmp/cargo-install8JkQof/release/deps/libserde-61dae5b7483c5fa0.rlib" "/tmp/cargo-install8JkQof/release/deps/libring-191c0101cbe8331b.rlib" "/tmp/cargo-install8JkQof/release/deps/libspin-6a9cfda09888b81c.rlib" "/tmp/cargo-install8JkQof/release/deps/libuntrusted-b60881ce429c3013.rlib" "/tmp/cargo-install8JkQof/release/deps/libonce_cell-80c0790d8ff436c6.rlib" "/tmp/cargo-install8JkQof/release/deps/libaes_gcm-0d28a225b9df6c3f.rlib" "/tmp/cargo-install8JkQof/release/deps/libctr-a111deb5eb6bf37d.rlib" "/tmp/cargo-install8JkQof/release/deps/libghash-dd7507611d82944d.rlib" "/tmp/cargo-install8JkQof/release/deps/libpolyval-7e033c6402572832.rlib" "/tmp/cargo-install8JkQof/release/deps/libopaque_debug-e0a52d52b5e5eb13.rlib" "/tmp/cargo-install8JkQof/release/deps/libuniversal_hash-67ab81b43ca87ee1.rlib" "/tmp/cargo-install8JkQof/release/deps/libsubtle-f02029a3d904654a.rlib" "/tmp/cargo-install8JkQof/release/deps/libaes-bca3265304ced623.rlib" "/tmp/cargo-install8JkQof/release/deps/libcpufeatures-7bf634e3f47d7b87.rlib" "/tmp/cargo-install8JkQof/release/deps/libcipher-5af44d97a19a685c.rlib" "/tmp/cargo-install8JkQof/release/deps/libinout-993c595015658fcb.rlib" "/tmp/cargo-install8JkQof/release/deps/libaead-68858601915a7412.rlib" "/tmp/cargo-install8JkQof/release/deps/libcrypto_common-856b10e08f3ca59a.rlib" "/tmp/cargo-install8JkQof/release/deps/libgeneric_array-7d1bd49329407f6b.rlib" "/tmp/cargo-install8JkQof/release/deps/libtypenum-d30a3e4cef509948.rlib" "/tmp/cargo-install8JkQof/release/deps/libpasswords-f73bbe985ecf343d.rlib" "/tmp/cargo-install8JkQof/release/deps/librandom_pick-2259966dd7401471.rlib" "/tmp/cargo-install8JkQof/release/deps/librandom_number-697094ddfcbb1f88.rlib" "/tmp/cargo-install8JkQof/release/deps/librand-cca258a2c4a0bd08.rlib" "/tmp/cargo-install8JkQof/release/deps/librand_chacha-539fa79a447ac94d.rlib" "/tmp/cargo-install8JkQof/release/deps/libppv_lite86-dcb073098ff0b7d6.rlib" "/tmp/cargo-install8JkQof/release/deps/librand_core-9588746f4df96d15.rlib" "/tmp/cargo-install8JkQof/release/deps/libgetrandom-d84806229385682e.rlib" "/tmp/cargo-install8JkQof/release/deps/libcfg_if-89637bf5efe449ff.rlib" "/tmp/cargo-install8JkQof/release/deps/libclipboard-e6205d0f5e3329b0.rlib" "/tmp/cargo-install8JkQof/release/deps/libx11_clipboard-e1c3aa3c18a307a4.rlib" "/tmp/cargo-install8JkQof/release/deps/libxcb-1d7fe1900a23aa0e.rlib" "/tmp/cargo-install8JkQof/release/deps/liblog-423e8759622cfd0d.rlib" "/tmp/cargo-install8JkQof/release/deps/libanyhow-5ed48ede9b354587.rlib" "/tmp/cargo-install8JkQof/release/deps/libterminal_size-bbab91cbc2acbd4b.rlib" "/tmp/cargo-install8JkQof/release/deps/librustix-9cf5ee9bc1a64309.rlib" "/tmp/cargo-install8JkQof/release/deps/libio_lifetimes-cc549f6ec84a30bf.rlib" "/tmp/cargo-install8JkQof/release/deps/liblibc-7d3d06959f24d71d.rlib" "/tmp/cargo-install8JkQof/release/deps/libbitflags-6d1ff9b57fbaff72.rlib" "/tmp/cargo-install8JkQof/release/deps/liblinux_raw_sys-5365d5def54aba08.rlib" "/tmp/cargo-install8JkQof/release/deps/libcolored-22395c16d213a5c5.rlib" "/tmp/cargo-install8JkQof/release/deps/liblazy_static-afd5eb1d3a601861.rlib" "/tmp/cargo-install8JkQof/release/deps/libis_terminal-a7af8e36b8f8a103.rlib" "/tmp/cargo-install8JkQof/release/deps/librustix-ee5cc4a0fb0304d2.rlib" "/tmp/cargo-install8JkQof/release/deps/libbitflags-63042f40ffa9ce00.rlib" "/tmp/cargo-install8JkQof/release/deps/liblinux_raw_sys-3512b048a770ad9d.rlib" "/tmp/cargo-install8JkQof/release/deps/libclap-f1a456c65d6cf4a1.rlib" "/tmp/cargo-install8JkQof/release/deps/libclap_builder-a0964cf098086f3e.rlib" "/tmp/cargo-install8JkQof/release/deps/libstrsim-4e5e04806465da48.rlib" "/tmp/cargo-install8JkQof/release/deps/libanstream-b219982ff1fb2ac2.rlib" "/tmp/cargo-install8JkQof/release/deps/libanstyle_query-6b4d53dbd37662ba.rlib" "/tmp/cargo-install8JkQof/release/deps/libcolorchoice-f7a3e89c3f715522.rlib" "/tmp/cargo-install8JkQof/release/deps/libanstyle_parse-9fbb70ebfe3462ca.rlib" "/tmp/cargo-install8JkQof/release/deps/libutf8parse-dfc971e5e2d20e8c.rlib" "/tmp/cargo-install8JkQof/release/deps/libclap_lex-3f12e14928565820.rlib" "/tmp/cargo-install8JkQof/release/deps/libanstyle-cb7883d1c6d3142a.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-fcf70ff533b679b2.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-0c444f82ff6357fe.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-1c489496724861fb.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-d78ac6160f3d6c83.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-809f163ce43a1738.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-175dcc30aa334793.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-cd8ec97f4bc5bb94.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-ee389c47b08d0950.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-cb31e582b020f933.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-9ec867386c5b7a05.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-fadf2e6707443620.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-f89fab2dfdbb31f7.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-6b9f3014e302f71b.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-43dc09dbe07dbc55.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-90b35e743da38af2.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-e7c6d1877111e953.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-5532010d21dfada0.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-a241e0394ca8cc1d.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-90c8d5109b409073.rlib" "-Wl,-Bdynamic" "-lxcb" "-lxcb-render" "-lxcb-shape" "-lxcb-xfixes" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/cargo-install8JkQof/release/deps/lockbox-b986c0b24c96e388" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" = note: /usr/bin/ld: cannot find -lxcb-render: No such file or directory /usr/bin/ld: cannot find -lxcb-shape: No such file or directory /usr/bin/ld: cannot find -lxcb-xfixes: No such file or directory collect2: error: ld returned 1 exit status

error: could not compile lock_box (bin "lockbox") due to previous error error: failed to compile lock_box v0.1.1, intermediate artifacts can be found at /tmp/cargo-install8JkQof. To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

SonuBardai commented 9 months ago

@JanNeuendorf I think I realized why you're able to build from github but you can't from cargo. The lockbox 0.1.1 version that's on crates.io right now has a few dependencies introduced by the clipboard crate that requires linux users to install some X Window System dependencies. I have removed the need for those dependencies on the current version that's in the repo. This should be fixed with the 0.1.2 version of lockbox. Until then, if you want to directly install from cargo then you'll need to install the following dependencies on linux machines.

sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

Thankyou for the detailed explanation on the issue 😄 I think we're almost ready for the 0.1.2 release so this problem should be soon fixed for good.

JanNeuendorf commented 9 months ago

Okay, that sounds good. I can confirm that the fix works on my machine. Thank you for looking into it!

SonuBardai commented 9 months ago

Thankyou so much for raising the issue and helping make lockbox awesome! ❤️ Marking this issue as resolved.