Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc-1.19.0 make install fails with "could not find native static library lzma" #43545

Closed
dschepler opened this issue Jul 29, 2017 · 14 comments
Closed
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@dschepler
Copy link

Using the same build process that worked for me with rustc-1.18.0:

mkdir obj-x86_64-linux-gnu
cd obj-x86_64-linux-gnu
../configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --localstatedir=/var
make -j8
make install DESTDIR=/home/daniel/src/rustc/rustc-1.19.0/debian/tmp

This gave errors:

   Compiling error-chain v0.10.0
error: could not find native static library `lzma`, perhaps an -L flag is missing?

error: Could not compile `lzma-sys`.

To learn more, run the command again with --verbose.


command did not execute successfully: "/home/daniel/src/rustc/rustc-1.19.0/obj-x86_64-linux-gnu/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "8" "--target" "x86_64-unknown-linux-gnu" "--release" "--manifest-path" "/home/daniel/src/rustc/rustc-1.19.0/src/tools/rust-installer/Cargo.toml"
expected success, got: exit code: 101


failed to run: /home/daniel/src/rustc/rustc-1.19.0/obj-x86_64-linux-gnu/build/bootstrap/debug/bootstrap install
Build completed unsuccessfully in 0:01:05
make[1]: *** [Makefile:72: install] Error 1
make[1]: Leaving directory '/home/daniel/src/rustc/rustc-1.19.0/obj-x86_64-linux-gnu'
dh_auto_install: make -j8 install DESTDIR=/home/daniel/src/rustc/rustc-1.19.0/debian/tmp returned exit code 2
make: *** [debian/rules:6: binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Oddly, after this failure, I found a directory /home/daniel/src/rustc/rustc-1.19.0/debian/tmp/home/daniel/src/rustc/rustc-1.19.0/obj-x86_64-linux-gnu/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/build/lzma-sys-21cbe9c072a2ac8f/out/ within the DESTDIR.

(By the way, this is for my own homebrew one-user "distribution", not for official Debian or Ubuntu, etc., packaging.)

@sfackler
Copy link
Member

You'll need to have a copy of liblzma around on your system: https://tukaani.org/xz/

@dschepler
Copy link
Author

I do have liblzma on my system:

daniel@frobnitz:~/src/rustc/rustc-1.19.0$ ls -l /usr/lib64/liblzma.*
-rw-r--r-- 1 root root 281316 Jan 12  2017 /usr/lib64/liblzma.a
-rwxr-xr-x 1 root root    921 Jan 12  2017 /usr/lib64/liblzma.la
lrwxrwxrwx 1 root root     16 Jan 12  2017 /usr/lib64/liblzma.so -> liblzma.so.5.2.3
lrwxrwxrwx 1 root root     16 Jan 12  2017 /usr/lib64/liblzma.so.5 -> liblzma.so.5.2.3
-rwxr-xr-x 1 root root 154152 Jan 12  2017 /usr/lib64/liblzma.so.5.2.3

@Mark-Simulacrum Mark-Simulacrum added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Aug 3, 2017
@Pulfer
Copy link

Pulfer commented Aug 9, 2017

I've got the same error trying to build rust 1.19.0. And I do have liblzma too:

ls -l /usr/lib/liblzma.*
-rw-r--r-- 1 root root 927410 Feb  5  2017 /usr/lib/liblzma.a
lrwxrwxrwx 1 root root     26 Mar 29 16:53 /usr/lib/liblzma.so -> ../../lib/liblzma.so.5.2.3*
$ ls -l /lib/liblzma.*
lrwxrwxrwx 1 root root     16 Mar 23 14:55 /lib/liblzma.so.5 -> liblzma.so.5.2.3*
-rwxr-xr-x 1 root root 226644 Feb  5  2017 /lib/liblzma.so.5.2.3*

Running /home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/bootstrap/debug/rustc --crate-name lzma_sys src/vendor/lzma-sys/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=a0acd66d608edaf9 -C extra-filename=-a0acd66d608edaf9 --out-dir /home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/i686-unknown-linux-gnu/release/deps --target i686-unknown-linux-gnu -L dependency=/home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/i686-unknown-linux-gnu/release/deps -L dependency=/home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/release/deps --extern libc=/home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/i686-unknown-linux-gnu/release/deps/liblibc-c578c3be28d6df55.rlib --cap-lints allow -L /home/vuohi/rpm/BUILD/rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/i686-unknown-linux-gnu/release/build/lzma-sys-307e68ecb4275fe2/out/lib -l static=lzma

error: could not find native static library lzma, perhaps an -L flag is missing?
error: Could not compile lzma-sys.

@Pulfer
Copy link

Pulfer commented Aug 9, 2017

Looks like liblzma.a is just not installed to rustc-1.19.0-src/build/i686-unknown-linux-gnu/stage0-tools/i686-unknown-linux-gnu/release/build/lzma-sys-307e68ecb4275fe2/out/lib/

@saintdev
Copy link

saintdev commented Sep 1, 2017

Still failing for me with 1.20.0

@fefe17
Copy link

fefe17 commented Sep 4, 2017

I have the same issue when attempting to compile rustc 1.20 on amd64-linux.
When I tried jury-rigging the build by manually putting the liblzma.a into the path suggested by Pulfer above, the build still failed:

= note: /usr/lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/rustc-1.20.0-src/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps/liblzma_sys-0be566c65e5be899.rlib(liblzma_la-common.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/rustc-1.20.0-src/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps/liblzma_sys-0be566c65e5be899.rlib(liblzma_la-stream_encoder.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC

Any many more of this same error message.

Note that there is a liblzma.a falling out of the build process. Using that instead of the system one yields the same error messages.

Also note that I'm using my own distro here, which uses a stock gcc with no patches. In particular, the default mode is -fno-pic, as the GNU project is shipping gcc.

@Mark-Simulacrum
Copy link
Member

I do not know that this is a Rust issue, though? It looks like it would more likely be the fault of liblzma-sys and should be reported there.

@saintdev
Copy link

@Mark-Simulacrum The issue only happens when compiling rustc from source. I can create an empty project, add xz2 to the dependencies in the Cargo.toml, and lzma_sys compiles just fine. However when I attempt to make install in the rust sources, it fails to build rust-installer, with the above error.

@Mark-Simulacrum
Copy link
Member

Could you clone this repo and try to reproduce that way?

@saintdev
Copy link

@Mark-Simulacrum On stable branch rust-installer fails to build both with and without --enable-vendor.

On master rust-installer builds without --enable-vendor. I was not able to test with --enable-vendor on master because bootstrap complains about the vendored dependencies created by the current version of cargo vendor.

@paulmenzel
Copy link

Has there been any progress regarding this issue? Installing Rust 1.19.0 from source fails here too.

$ make install DESTDIR=/dev/shm/bee-root/rustc/rustc-1.19.0-0/image
[…]
   Compiling miniz-sys v0.1.9
   Compiling lzma-sys v0.1.4
   Compiling backtrace-sys v0.1.10
   Compiling flate2 v0.2.19
   Compiling clap v2.19.3
   Compiling error-chain v0.10.0
error: could not find native static library `lzma`, perhaps an -L flag is missing?

error: Could not compile `lzma-sys`.
Build failed, waiting for other jobs to finish...
error: build failed


command did not execute successfully: "/dev/shm/bee-root/rustc/rustc-1.19.0-0/build/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "64" "--target" "x86_64-unknown-linux-gnu" "--release" "--frozen" "--manifest-path" "/dev/shm/bee-root/rustc/rustc-1.19.0-0/source/src/tools/rust-installer/Cargo.toml"
expected success, got: exit code: 101
$ file /usr/lib/liblzma.a
/usr/lib/liblzma.a: current ar archive

@ikeydoherty
Copy link

Same issue here in Solus

   Compiling error-chain v0.10.0
error: could not find native static library `lzma`, perhaps an -L flag is missing?

error: Could not compile `lzma-sys`.
Build failed, waiting for other jobs to finish...
error: build failed


command did not execute successfully: "/home/build/YPKG/root/rust/build/rustc-1.20.0-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "8" "--target" "x86_64-unknown-linux-gnu" "--release" "--frozen" "--manifest-path" "/home/build/YPKG/root/rust/build/rustc-1.20.0-src/src/tools/rust-installer/Cargo.toml"
expected success, got: exit code: 101

Bootstrapping 1.20.0 with 1.19.0 using Rust official stage0 (2017-07-20). xz-devel provides liblzma.a:

/usr/lib64/liblzma.a:        current ar archive
/usr/lib64/liblzma.so:       symbolic link to liblzma.so.5.2.3
/usr/lib64/liblzma.so.5:     symbolic link to liblzma.so.5.2.3
/usr/lib64/liblzma.so.5.2.3: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=3c8b4dbcf2b9115c0753cf90aadaf25243ec77a1, stripped

The liblzma libset built with -fPIC by default.

@paulmenzel
Copy link

Rust 1.21.0 with lzma-sys v0.1.8 seems to build fine. No idea, how to tell Rust 1.19.0 to use the newer lzma-sys.

@jyn514
Copy link
Member

jyn514 commented Oct 11, 2021

I'm going to close this since past Rust releases are immutable; I haven't heard anyone mention this being a problem since 1.19.

@jyn514 jyn514 closed this as completed Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

9 participants