Skip to content

Failure to build static musl package with aws-lc-sys dependencies #838

@TristanCacqueray

Description

@TristanCacqueray

Describe the bug

Building a static command with aws-lc-sys fails with the following error: cannot find -lc: No such file or directory

Reproduction
In the examples/cross-musl/Cargo.toml, add:

[dependencies]
aws-lc-sys = "0.28.2"

Then run the following commands:

$ cd examples/cross-musl
$ cargo build
...
$ nix build
error: builder for '/nix/store/rblk1rwhp0s0789hry56c3nm9qmx5vk8-cross-musl-deps-0.1.0.drv' failed with exit code 101;
       last 25 log lines:
       >   RUSTC_WRAPPER = None
       >   cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
       >   cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
       >   CRATE_CC_NO_DEFAULTS = None
       >   DEBUG = Some(false)
       >   CARGO_CFG_TARGET_FEATURE = Some(crt-static,fxsr,sse,sse2)
       >   cargo:rerun-if-env-changed=CFLAGS
       >   CFLAGS = None
       >   cargo:rerun-if-env-changed=TARGET_CFLAGS
       >   TARGET_CFLAGS = None
       >   cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_musl
       >   CFLAGS_x86_64_unknown_linux_musl = None
       >   cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-musl
       >   CFLAGS_x86_64-unknown-linux-musl = None
       >   CARGO_ENCODED_RUSTFLAGS = Some(-Ctarget-feature=+crt-static)
       >
       >   --- stderr
       >
       >   thread 'main' panicked at /nix/store/s5ssq2ricm247rwvf8jy8dk170ivxham-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/aws-lc-sys-0.28.2/builder/cc_builder.rs:476:9:
       >   COMPILER: gccARGS: ["-O3", "-ffunction-sections", "-fdata-sections", "-fPIC", "-m64", "-static", "-Wall", "-Wextra", "/nix/store/diicfd1kkmb1jdxlybxwwsg7d07fcg09-cargo-package-aws-lc-sys-0.28.2/aws-lc/tests/compiler_features_tests/memcmp_invalid_stripped_check.c", "-Wno-unused-parameter", "-o", "/build/source/target/x86_64-unknown-linux-musl/release/build/aws-lc-sys-c336602b344073e3/out/memcmp_invalid_stripped_check"]EXECUTED: trueERROR: /nix/store/hzw38c3f7s0w200cgk9645z53al7k8lw-binutils-2.44/bin/ld: cannot find -lc: No such file or directory
       >   /nix/store/hzw38c3f7s0w200cgk9645z53al7k8lw-binutils-2.44/bin/ld: have you installed the static version of the c library ?
       >   collect2: error: ld returned 1 exit status
       >   OUTPUT: Failed to compile memcmp_invalid_stripped_check
       >
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       For full logs, run:
         nix log /nix/store/rblk1rwhp0s0789hry56c3nm9qmx5vk8-cross-musl-deps-0.1.0.drv
error: 1 dependencies of derivation '/nix/store/m7rp309xyxh7q6h4njql1vgrfbi5psr6-cross-musl-0.1.0.drv' failed to build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions