Skip to content

aws-lc-sys v0.32.0 fails to build for musl with fatal error: linux/random.h: No such file or directory #894

@davemo88

Description

@davemo88

Problem:

build a project depending on aws-lc-sys v0.32.0 for musl targets, e.g. cargo build --target=x86_64-unknown-linux-musl fails with:
cargo:warning=/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/crypto/rand_extra/urandom.c:39:10: fatal error: linux/random.h: No such file or directory

Relevant details

My Cargo.lock had v0.28.0, which still works. I'm building in docker with rust:latest image on an M4 Mac Mini.

Build log:

44.05 warning: [email protected]: Building with: CC
44.05 warning: [email protected]: Symbol Prefix: Some("aws_lc_0_32_0")
44.05 warning: [email protected]: Compilation of 'c11.c' succeeded - Ok(["/worker/target/aarch64-unknown-linux-musl/release/b
uild/aws-lc-sys-9f1565ba1f5744af/out/out-c11/7dfda64fdf5a526c-c11.o"]).
44.05 warning: [email protected]: Using flag: -ffile-prefix-map=/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557
f/aws-lc-sys-0.32.0=
44.05 warning: [email protected]: Compilation of 'stdalign_check.c' succeeded - Ok(["/worker/target/aarch64-unknown-linux-mus
l/release/build/aws-lc-sys-9f1565ba1f5744af/out/out-stdalign_check/7dfda64fdf5a526c-stdalign_check.o"]).
44.05 warning: [email protected]: Compilation of 'builtin_swap_check.c' succeeded - Ok(["/worker/target/aarch64-unknown-linux
-musl/release/build/aws-lc-sys-9f1565ba1f5744af/out/out-builtin_swap_check/7dfda64fdf5a526c-builtin_swap_check.o"]).
44.05 warning: [email protected]: Compilation of 'neon_sha3_check.c' succeeded - Ok(["/worker/target/aarch64-unknown-linux-mu
sl/release/build/aws-lc-sys-9f1565ba1f5744af/out/out-neon_sha3_check/7dfda64fdf5a526c-neon_sha3_check.o"]).
44.05 warning: [email protected]: /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/cry
pto/rand_extra/urandom.c:39:10: fatal error: linux/random.h: No such file or directory
44.05 warning: [email protected]:    39 | #include <linux/random.h>
44.05 warning: [email protected]:       |          ^~~~~~~~~~~~~~~~
44.05 warning: [email protected]: compilation terminated.
44.05 warning: [email protected]: ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C
" "aarch64-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-std=c11" "-I" "/usr/local/cargo/registry/s
rc/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/generated-include" "-I" "/usr/local/cargo/registry/src/index.crates.io-
1949cf8c6b5b557f/aws-lc-sys-0.32.0/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0
.32.0/aws-lc/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_par
ty/s2n-bignum/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_pa
rty/s2n-bignum/s2n-bignum-imported/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0
.32.0/aws-lc/third_party/jitterentropy/jitterentropy-library" "-Wall" "-Wextra" "-Wno-unused-parameter" "-pthread" "-ffile-pr
efix-map=/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0=" "-D_XOPEN_SOURCE=700" "-DBORINGSS
L_IMPLEMENTATION=1" "-DBORINGSSL_PREFIX=aws_lc_0_32_0" "-DAWS_LC_STDALIGN_AVAILABLE=1" "-DAWS_LC_BUILTIN_SWAP_SUPPORTED=1" "-
DMY_ASSEMBLER_SUPPORTS_NEON_SHA3_EXTENSION=1" "-o" "/worker/target/aarch64-unknown-linux-musl/release/build/aws-lc-sys-9f1565
ba1f5744af/out/7bf3e571b6558a6b-urandom.o" "-c" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.
32.0/aws-lc/crypto/rand_extra/urandom.c"
44.05 error: failed to run custom build command for `aws-lc-sys v0.32.0`
44.05
44.05 Caused by:
44.05   process didn't exit successfully: `/worker/target/release/build/aws-lc-sys-ddf5f7807b9a24a6/build-script-main` (exit
status: 1)
...
44.05   cargo:warning=/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/crypto/rand_ext
ra/urandom.c:39:10: fatal error: linux/random.h: No such file or directory
44.05   cargo:warning=   39 | #include <linux/random.h>
44.05   cargo:warning=      |          ^~~~~~~~~~~~~~~~
44.05   cargo:warning=compilation terminated.
44.05   exit status: 0
44.05   exit status: 0
44.05   exit status: 0
44.05   exit status: 0
44.05   exit status: 0
44.05   exit status: 0
44.05   exit status: 1
44.05   cargo:warning=ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C" "aarch64-l
inux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-std=c11" "-I" "/usr/local/cargo/registry/src/index.cra
tes.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/generated-include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b
557f/aws-lc-sys-0.32.0/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc
/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bignu
m/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/third_party/s2n-bign
um/s2n-bignum-imported/include" "-I" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc
/third_party/jitterentropy/jitterentropy-library" "-Wall" "-Wextra" "-Wno-unused-parameter" "-pthread" "-ffile-prefix-map=/us
r/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0=" "-D_XOPEN_SOURCE=700" "-DBORINGSSL_IMPLEMENTA
TION=1" "-DBORINGSSL_PREFIX=aws_lc_0_32_0" "-DAWS_LC_STDALIGN_AVAILABLE=1" "-DAWS_LC_BUILTIN_SWAP_SUPPORTED=1" "-DMY_ASSEMBLE
R_SUPPORTS_NEON_SHA3_EXTENSION=1" "-o" "/worker/target/aarch64-unknown-linux-musl/release/build/aws-lc-sys-9f1565ba1f5744af/o
ut/7bf3e571b6558a6b-urandom.o" "-c" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.32.0/aws-lc/
crypto/rand_extra/urandom.c"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions