I recently updated to Ubuntu 18.04. And of course I also recently updated nightly rust. I'm not sure which caused the problem, though I suspect the former. Edit: same problem with stable 1.25
Since around the same time, I can't build a number of rust programs that use native libs. Most seem to be related to libz
but I'm not certain that all of them are; there are several different failures. I haven't looked carefully at all cases; there might be some that involve other libs and this is just a common one.
The simplest is probably a failure to link when trying to cargo install bat
, as below:
[.......] "-Wl,--end-group" "/home/dan/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-795361e8a622f052.rlib" "-Wl,-Bdynamic" "-l" "z" "-l" "c" "-l" "util" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util"
= note: /usr/bin/x86_64-linux-gnu-ld: cannot find -lz
collect2: error: ld returned 1 exit status
Other cases seem to occur in configure/CMake routines when building other crates, such as libssh2-sys
, that in turn depend on libz.
I'm most definitely not missing libz:
1 lrwxrwxrwx 1 root root 14 May 23 2017 /lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11
81 -rw-r--r-- 1 root root 116960 May 23 2017 /lib/x86_64-linux-gnu/libz.so.1.2.11
What's going on here? Do I need to clear some cargo dependency when the underlying OS is upgraded? Does the libz-sys crate need an update somehow?