flier / rust-fasthash

A suite of non-cryptographic hash functions for Rust.
Apache License 2.0
138 stars 28 forks source link

fasthash-sys build fail for target x86_64-unknown-linux-musl #9

Closed jolisper closed 3 years ago

jolisper commented 6 years ago

I'm trying to build my crate for a musl based linux (alpine) and when I run:

$ cargo build --target=x86_64-unknown-linux-musl

on master branch, shows the following output:

   Compiling fasthash-sys v0.3.1 (/home/jorge/src/almundo/rust-fasthash/fasthash-sys)
   Compiling xoroshiro128 v0.3.0
error: failed to run custom build command for `fasthash-sys v0.3.1 (/home/jorge/src/almundo/rust-fasthash/fasthash-sys)`
process didn't exit successfully: `/home/jorge/src/almundo/rust-fasthash/target/debug/build/fasthash-sys-5ac0ee8496bbb7b0/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-musl")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-musl")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
CROSS_COMPILE = None
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-static" "-Wno-implicit-fallthrough" "-Wno-unknown-attributes" "-msse4.2" "-maes" "-mavx" "-mavx2" "-DT1HA0_RUNTIME_SELECT=1" "-DT1HA0_AESNI_AVAILABLE=1" "-Wall" "-Wextra" "-o" "/home/jorge/src/almundo/rust-fasthash/target/x86_64-unknown-linux-musl/debug/build/fasthash-sys-05781192139ce1a5/out/src/fasthash.o" "-c" "src/fasthash.cpp"
cargo:warning=In file included from src/fasthash.hpp:1:0,
cargo:warning=                 from src/fasthash.cpp:1:
cargo:warning=src/smhasher/City.h:49:10: fatal error: utility: No such file or directory
cargo:warning= #include <utility>
cargo:warning=          ^~~~~~~~~
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-static" "-Wno-implicit-fallthrough" "-Wno-unknown-attributes" "-msse4.2" "-maes" "-mavx" "-mavx2" "-DT1HA0_RUNTIME_SELECT=1" "-DT1HA0_AESNI_AVAILABLE=1" "-Wall" "-Wextra" "-o" "/home/jorge/src/almundo/rust-fasthash/target/x86_64-unknown-linux-musl/debug/build/fasthash-sys-05781192139ce1a5/out/src/fasthash.o" "-c" "src/fasthash.cpp" with args "musl-gcc" did not execute successfully (status code exit code: 1).

', /home/jorge/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.54/src/lib.rs:1670:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

The problem is the same using stable and nightly toolchains.

Any idea how to fix this? Or how to proceed in order to build this crate for musl target?

flier commented 6 years ago

< utility > is part of C++ stdlib, it seems you missed musl C++ support?

stefanhoelzl commented 5 years ago

I get an similar error under Windows 10

Internal error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\x86_amd64\\cl.exe" "/nologo" "/MD" "/Z7" "-Wno-implicit-fallthrough" "-Wno-unknown-attributes" "-msse4.2" "-maes" "-mavx" "-mavx2" "/DT1HA0_RUNTIME_SELECT=1" "/DT1HA0_
AESNI_AVAILABLE=1" "/W4" "/FoD:\\temp\\dexter\\target\\debug\\build\\fasthash-sys-2fd15fb3b4e39d71\\out\\src\\fasthash.o" "/c" "src/fasthash.cpp" with args "cl.exe" did not execute successfully (status code exit code: 2).

rust Version: rustc 1.36.0 (a53f9df32 2019-07-03)

mashedcode commented 5 years ago

@jolisper you may have some luck with this: https://github.com/emk/rust-musl-builder/issues/65#issuecomment-469049466