Electrs: Can't build with rust 1.40.0

Created on 20 Dec 2019  路  21Comments  路  Source: romanz/electrs

Building with rust 1.39.0 works fine. 1.40 gets the error below. This is on 32 bit armv7l hardware.

   Compiling librocksdb-sys v5.18.3
error: failed to run custom build command for `librocksdb-sys v5.18.3`

Caused by:
  process didn't exit successfully: `/home/bitcoin/electrs/target/release/build/librocksdb-sys-e908501be0012fa4/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=rocksdb/
cargo:rerun-if-changed=snappy/
cargo:rerun-if-changed=lz4/
cargo:rerun-if-changed=zstd/
cargo:rerun-if-changed=zlib/
cargo:rerun-if-changed=bzip2/
NUM_JOBS = Some("8")
TARGET = Some("armv7-unknown-linux-gnueabihf")
OPT_LEVEL = Some("3")
HOST = Some("armv7-unknown-linux-gnueabihf")
CXX_armv7-unknown-linux-gnueabihf = None
CXX_armv7_unknown_linux_gnueabihf = None
HOST_CXX = None
CXX = None
CXXFLAGS_armv7-unknown-linux-gnueabihf = None
CXXFLAGS_armv7_unknown_linux_gnueabihf = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None

...

error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.7.0/fused-src/" "-I" "snappy/" "-I" "lz4/lib/" "-I" "zstd/lib/" "-I" "zstd/lib/dictBuilder/" "-I" "zlib/" "-I" "bzip2/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DSNAPPY=1" "-DLZ4=1" "-DZSTD=1" "-DZLIB=1" "-DBZIP2=1" "-DNDEBUG=1" "-DOS_LINUX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/home/bitcoin/electrs/target/release/build/librocksdb-sys-3d51c0756006fa16/out/rocksdb/utilities/transactions/pessimistic_transaction_db.o" "-c" "rocksdb/utilities/transactions/pessimistic_transaction_db.cc" with args "c++" did not execute successfully (status code exit code: 1).

All 21 comments

I am having the same build error on raspibolt right now

I was getting this problem because I missed the following line from the tutorial:
sudo apt install clang cmake

Thanks for opening this issue, and sorry for the delayed response.
Would it be possible to reproduce this issue only for rust-rocksdb crate on ARM?

Also https://github.com/romanz/electrs/issues/201 :)

Would it be possible to reproduce this issue only for rust-rocksdb crate on ARM?

How would I go about doing that? Sorry but I'm not that familiar with rust/cargo.

You can clone https://github.com/rust-rocksdb/rust-rocksdb and run cargo test on it:

$ git clone https://github.com/rust-rocksdb/rust-rocksdb
$ cd rust-rocksdb
$ cargo test

I was just able to build electrs with 1.41.0 - if it was just a passing issue then maybe this can be closed?

Sounds good, closing.

FWIW, I can confirm that building with Rust 1.41 works like a charm on the Raspberry Pi 4 (Raspbian Buster, ARMv7)

Looks like this issue is back... same setup as before with cargo 1.41.0, but now it won't build v5.15.5 using the latest from master.

   Compiling librocksdb-sys v5.18.5
error: failed to run custom build command for `librocksdb-sys v5.18.5`

Caused by:
  process didn't exit successfully: `/home/bitcoin/electrs/target/release/build/librocksdb-sys-bf582e2f480abbad/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=rocksdb/
TARGET = Some("armv7-unknown-linux-gnueabihf")
OPT_LEVEL = Some("3")
HOST = Some("armv7-unknown-linux-gnueabihf")
CXX_armv7-unknown-linux-gnueabihf = None
CXX_armv7_unknown_linux_gnueabihf = None
HOST_CXX = None
CXX = None
CXXFLAGS_armv7-unknown-linux-gnueabihf = None
CXXFLAGS_armv7_unknown_linux_gnueabihf = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None

@Stadicus Can you see if you get the same issue?

I just compiled Electrs a few days ago on a Raspberry Pi 4 using Rust 1.48.0 (see https://github.com/Stadicus/RaspiBolt/pull/673/commits/4a59a8e541f4cb34c67f2cb4289385cd54271455).

Not sure if that information helps. Is there a reason to stay on Rust 1.41?

We are supporting Rust 1.41 since it's the version installed on stable Debian:
https://packages.debian.org/stable/rustc

Looks like this issue is back... same setup as before with cargo 1.41.0, but now it won't build v5.15.5 using the latest from master.

Maybe you can try to build it with RocksDB being dynamically linked:
https://github.com/romanz/electrs/blob/master/doc/usage.md#dynamic-linking

Maybe you can try to build it with RocksDB being dynamically linked:
https://github.com/romanz/electrs/blob/master/doc/usage.md#dynamic-linking

I wasn't able to find any binaries for arm7 on ubuntu for librocksdb-dev so I couldn't figure out a way to get dynamic linking to work. But moving to 1.48.0 resolved the issue for me again... I guess some dependencies are losing compatibility with older rust versions?

I actually attempted to cross compile rocksdb for arm7 a few weeks ago and failed. To me it looks like Rocksdb is not well supported on 32 bit OSes (Raspbian is 32 bit OS even if it, runs on 64 bit Rpi4). I did succeed at cross-compiling electrs for arm64 using dynamic linking.

If you have Pi4, I'd suggest considering moving to 64-bit OS (Debian, not Raspbian, I know it has disadvantages :( ). If you're in the mood to play with it you can also try out experimental version of my repository which contains arm64 packages of various Bitcoin stuff including electrs. LMK if you're interested, setting up experimental version is purposely not well documented to discourage random people from using it.

FWIW, this should have nothing to do with Rust version. IDK why it appears as if it has.

FWIW, this should have nothing to do with Rust version. IDK why it appears as if it has.

Do you think it's just coincidence? I tried building several times on 1.41 and it failed every time, then it worked the first time on 1.48.

I'm thinking about switching to a raspi4 with 8GB ram running 64 bit raspbian, so if/when I do I'll check out your repository. Thanks.

That's very strange, the reason I believe it should be unrelated is that the C compiler appears to be failing during the build of rocksdb and Rust version should not affect it. This would need deeper analysis to tell for sure.

The main reason to use older version of Rust is that it's packaged in Debian repository and thus can be installed more safely. To my knowledge, rustup doesn't check signatures.

To my knowledge, rustup doesn't check signatures

In my guide, I install Rust manually, including signatures check:
https://stadicus.github.io/RaspiBolt/raspibolt_50_electrs.html#install-dependencies

I mean, you're checking signature of Rustup, but Rustup doesn't check the signatures of downloaded components. Didn't verify this yet.

I mean, you're checking signature of Rustup, but Rustup doesn't check the signatures of downloaded components. Didn't verify this yet.

The archive (https://static.rust-lang.org/dist/rust-1.48.0-armv7-unknown-linux-gnueabihf.tar.gz) that is downloaded is 200 MB and IIUC it is simply installed locally. I'm not aware that there are additional components that are downloaded. But I might be wrong and I guess this discussion is a bit off-topic... :)

Oh, sorry, I thought that guide downloaded Rustup, but it downloads Rust itself then. That's good! Would be nice to have the key verified from independent source and signed too.

Also we had an issue recently that someone installed Rust using your guide on x86_64, which broke the system. Perhaps an explicit warning that the guide will only work on RPi would be useful?

Also we had an issue recently that someone installed Rust using your guide on x86_64, which broke the system. Perhaps an explicit warning that the guide will only work on RPi would be useful?

Thanks for this hint, I added a warning: https://github.com/Stadicus/RaspiBolt/pull/682

-- off-topic out :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

burguesia picture burguesia  路  4Comments

sangaman picture sangaman  路  6Comments

gbenattar picture gbenattar  路  4Comments

seth586 picture seth586  路  3Comments

lukechilds picture lukechilds  路  3Comments