alexcrichton / xxhash2-rs

Rust bindings to libxxhash
http://alexcrichton.com/xxhash2-rs
Apache License 2.0
5 stars 2 forks source link

xxhash-sys does not build on musl #1

Open cetra3 opened 6 years ago

cetra3 commented 6 years ago

Not sure how to resolve this one.

Using the musl docker Trying to build this library, I get the following error:

error: failed to run custom build command for `xxhash-sys v0.1.0 (file:///home/rust/src/xxhash2-rs/xxhash-sys)`
process didn't exit successfully: `/home/rust/src/xxhash2-rs/xxhash-sys/target/debug/build/xxhash-sys-a7428465afe3c0dd/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/home/rust/src/xxhash2-rs/xxhash-sys/xxHash/cmake_unofficial" "-DCMAKE_INSTALL_PREFIX=/home/rust/src/xxhash2-rs/xxhash-sys/target/x86_64-unknown-linux-musl/debug/build/xxhash-sys-4f8fccc5a263f844/out" "-DCMAKE_C_FLAGS= -DXXH_NAMESPACE=__rust_xxhash_sys_ -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_C_COMPILER=/usr/bin/musl-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_CXX_COMPILER=musl-g++" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/musl-gcc
-- Check for working C compiler: /usr/bin/musl-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring incomplete, errors occurred!
See also "/home/rust/src/xxhash2-rs/xxhash-sys/target/x86_64-unknown-linux-musl/debug/build/xxhash-sys-4f8fccc5a263f844/out/build/CMakeFiles/CMakeOutput.log".
See also "/home/rust/src/xxhash2-rs/xxhash-sys/target/x86_64-unknown-linux-musl/debug/build/xxhash-sys-4f8fccc5a263f844/out/build/CMakeFiles/CMakeError.log".

--- stderr
CMake Error at CMakeLists.txt:4 (project):
  The CMAKE_CXX_COMPILER:

    musl-g++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.29/src/lib.rs:632:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

If I manually build this it works ok:

rust@65a31555fef5:~/src/xxhash2-rs/xxhash-sys/xxHash$ cmake cmake_unofficial/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rust/src/xxhash2-rs/xxhash-sys/xxHash
rust@65a31555fef5:~/src/xxhash2-rs/xxhash-sys/xxHash$ make
[ 25%] Building C object CMakeFiles/xxhash.dir/xxhash.c.o
[ 50%] Linking C shared library libxxhash.so
[ 50%] Built target xxhash
[ 75%] Building C object CMakeFiles/xxhashstatic.dir/xxhash.c.o
[100%] Linking C static library libxxhash.a
[100%] Built target xxhashstatic
alexcrichton commented 6 years ago

Thanks! It seems like the c++ compiler should either be omitted or specified to something that exists? (seems like it isn't used anyway?)

cetra3 commented 6 years ago

Yeah I don't think it's used for this case. I'm not sure how to control cmake via build.rs though?

alexcrichton commented 6 years ago

I think we may either need to pass an option saying "don't pass the C++ compiler" or explicitly pass one that's known to exist (but won't get used) like c++

dandxy89 commented 3 years ago

@cetra3 were you able to resolve this? Experiencing a similiar issue myself

cetra3 commented 3 years ago

@dandxy89 no unfortunately. I instead used https://github.com/shepmaster/twox-hash