Skip to content

i686-unknown-linux-musl gives builds sizeof(int64_t) == 4 on 64-bit hosts #436

Closed
@alecmocatta

Description

@alecmocatta

See for example this assertion raised by the miniz-sys crate on a stock 64-bit ubuntu machine:

$ cargo test --target i686-unknown-linux-musl
   Compiling miniz-sys v0.1.12 (/home/alec/flate2-rs/miniz-sys)
error: failed to run custom build command for `miniz-sys v0.1.12 (/home/alec/flate2-rs/miniz-sys)`

Caused by:
  process didn't exit successfully: `/home/alec/flate2-rs/target/debug/build/miniz-sys-db79608bd7405c9f/build-script-build` (exit code: 1)
--- stdout
TARGET = Some("i686-unknown-linux-musl")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_i686-unknown-linux-musl = None
CC_i686_unknown_linux_musl = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_i686-unknown-linux-musl = None
CFLAGS_i686_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,mmx,sse,sse2")
running: "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m32" "-static" "-march=i686" "-Wl,-melf_i386" "-fvisibility=hidden" "-DMINIZ_NO_STDIO" "-DMINIZ_NO_ARCHIVE_APIS" "-DMINIZ_NO_ARCHIVE_WRITING_APIS" "-DMINIZ_NO_TIME" "-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES" "-o" "/home/alec/flate2-rs/target/i686-unknown-linux-musl/debug/build/miniz-sys-0ae776d4c6f5a15f/out/miniz.o" "-c" "miniz.c"
cargo:warning=miniz.c:31:23: error: size of array ‘mz_validate_uint64’ is negative
cargo:warning= typedef unsigned char mz_validate_uint64[sizeof(mz_uint64) == 8 ? 1 : -1];
cargo:warning=                       ^~~~~~~~~~~~~~~~~~
exit code: 1

--- stderr


error occurred: Command "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m32" "-static" "-march=i686" "-Wl,-melf_i386" "-fvisibility=hidden" "-DMINIZ_NO_STDIO" "-DMINIZ_NO_ARCHIVE_APIS" "-DMINIZ_NO_ARCHIVE_WRITING_APIS" "-DMINIZ_NO_TIME" "-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES" "-o" "/home/alec/flate2-rs/target/i686-unknown-linux-musl/debug/build/miniz-sys-0ae776d4c6f5a15f/out/miniz.o" "-c" "miniz.c" with args "musl-gcc" did not execute successfully (status code exit code: 1).

I don't know if or where this should be fixed? musl-gcc encodes the target triple (in my case x86_64-linux-musl) so an i386 version of musl-gcc needs to be installed and used.

Perhaps asserting on musl-gcc -v 2>&1 | grep Target would be useful? I was getting silent corruption of data with the zstd crate; a build error would be much preferred.

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