electrs: Fails compiling against Bionic libc

Compiling against Bionic libc with the Android NDK gives:

   Compiling sysconf v0.3.4
error[E0081]: discriminant value `96` already exists
  --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/sysconf-0.3.4/src/raw.rs:83:19
   |
20 | macro_rules! sc { ($var:ident) => (libc::$var as isize) }
   |                                    ------------------- first use of `96`
...
83 |     Sc2CVersion = 96, // TODO(joshlf): Switch to a libc constant once it's added
   |                   ^^ enum already has `96`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0081`.
error: could not compile `sysconf`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `electrs v0.8.3 (/home/builder/.termux-build/electrs/src)`, intermediate artifacts can be found at `/home/builder/.termux-build/electrs/src/target`

Looks like it’s an issue with the sysconf dep. Is it possible to work around this?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (16 by maintainers)

Most upvoted comments

@ulzeraj could you try to apply this patch?

Thanks!

It seems to get worked until a point where it tries to use llvm-config. LLVM/Clang is the main compiler on this version of FreeBSD but apparently this tool wasn’t included. I’m installing the llvm version from ports and will report back once its finished compiling.

   Compiling librocksdb-sys v6.11.4
The following warnings were emitted during compilation:

warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

error: failed to run custom build command for `librocksdb-sys v6.11.4`

Caused by:
  process didn't exit successfully: `/usr/Users/ulzeraj/electrs/target/release/build/librocksdb-sys-8059431862de149d/build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
  cargo:warning=set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/lib.rs:1959:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The tooling I’m using to create the Android build actually supports having a load of *.patch files it’ll automatically apply after pulling the source so I’ll have a go at patching this on my end for now.

Thanks!