I've been trying to compile Lorikeet + gkl-rs with x86_64-unknown-linux-musl as the target in order to produce a statically linked binary that can easily be distributed in releases. However, I'm having some difficulties with the custome build script that gkl-rs uses.
These are the errors I get when I've attempted it:
The following warnings were emitted during compilation:
warning: In file included from gkl/pairhmm/avx-pairhmm.h:26,
warning: from gkl/pairhmm/avx_impl.cc:25:
warning: gkl/pairhmm/Context.h:27:10: fatal error: cmath: No such file or directory
warning: #include <cmath> // std::isinf
warning: ^~~~~~~
warning: compilation terminated.
error: failed to run custom build command for `gkl v0.1.0 (https://github.com/philipc/gkl-rs#11a88b99)`
Caused by:
process didn't exit successfully: `/github/workspace/target/release/build/gkl-3421105fe0419bef/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=gkl
TARGET = Some("x86_64-unknown-linux-musl")
OPT_LEVEL = Some("3")
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
CROSS_COMPILE = None
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-o" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/pairhmm/pairhmm_common.o" "-c" "gkl/pairhmm/pairhmm_common.cc"
exit status: 0
running: "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-o" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/smithwaterman/smithwaterman_common.o" "-c" "gkl/smithwaterman/smithwaterman_common.cc"
exit status: 0
AR_x86_64-unknown-linux-musl = None
AR_x86_64_unknown_linux_musl = None
TARGET_AR = None
AR = None
running: "ar" "cq" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/libgkl-common.a" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/pairhmm/pairhmm_common.o" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/smithwaterman/smithwaterman_common.o"
exit status: 0
running: "ar" "s" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/libgkl-common.a"
exit status: 0
cargo:rustc-link-lib=static=gkl-common
cargo:rustc-link-search=native=/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out
TARGET = Some("x86_64-unknown-linux-musl")
OPT_LEVEL = Some("3")
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
CROSS_COMPILE = None
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-mavx" "-o" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/pairhmm/avx_impl.o" "-c" "gkl/pairhmm/avx_impl.cc"
cargo:warning=In file included from gkl/pairhmm/avx-pairhmm.h:26,
cargo:warning= from gkl/pairhmm/avx_impl.cc:25:
cargo:warning=gkl/pairhmm/Context.h:27:10: fatal error: cmath: No such file or directory
cargo:warning= #include <cmath> // std::isinf
cargo:warning= ^~~~~~~
cargo:warning=compilation terminated.
exit status: 1
--- stderr
error occurred: Command "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-mavx" "-o" "/github/workspace/target/x86_64-unknown-linux-musl/release/build/gkl-9101aadbf0ecc6ed/out/gkl/pairhmm/avx_impl.o" "-c" "gkl/pairhmm/avx_impl.cc" with args "musl-gcc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
error: build failed
Hi Philip,
I've been trying to compile Lorikeet + gkl-rs with x86_64-unknown-linux-musl as the target in order to produce a statically linked binary that can easily be distributed in releases. However, I'm having some difficulties with the custome build script that gkl-rs uses. These are the errors I get when I've attempted it:
I thought this might be something to do with using
musl-gcc
rather thanmusl-g++
to compile, but the docker container this in running is meant to usemusl-g++
in order to get past thiscmath
issue. (See: https://github.com/rhysnewell/rust-cargo-musl-action/blob/master/Dockerfile)Any help would be appreciated! :)
Cheers, Rhys