rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust

Home Page:https://docs.rs/flate2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't compile zlib-ng feature on M1 Mac

stjepangolemac opened this issue · comments

This is how I use it:

flate2 = { version = "=1.0.24", default-features = false, features = ["zlib-ng"] }

This is what I get when I compile:

error: failed to add native library <redacted>/target/debug/build/libz-ng-sys-9e9c491639259674/out/lib/libz-ng.a: file too small to be an archive

I'm using a M1 Max MBP with 12.5.1 MacOS. I've tried installing zlib-ng with homebrew but it didn't change anything.

Building it with zlib-ng-compat works though. It doesn't work actually:

Error output
   Compiling futures-executor v0.3.24
   Compiling futures v0.3.24
   Compiling tokio-util v0.6.9
   Compiling tokio-native-tls v0.3.0
error: failed to run custom build command for `libz-sys v1.1.8`

Caused by:
  process didn't exit successfully: `/Users/sgolem/code/mgnr/juliarobots/willferrous/target/debug/build/libz-sys-33329c634e0dc433/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
  cargo:rerun-if-changed=build.rs
  CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_aarch64-apple-darwin = None
  CMAKE_GENERATOR_aarch64_apple_darwin = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-apple-darwin = None
  CMAKE_PREFIX_PATH_aarch64_apple_darwin = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-apple-darwin = None
  CMAKE_aarch64_apple_darwin = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "/Users/sgolem/.cargo/registry/src/github.com-1ecc6299db9ec823/libz-sys-1.1.8/src/zlib-ng" "-DBUILD_SHARED_LIBS=OFF" "-DZLIB_COMPAT=ON" "-DZLIB_ENABLE_TESTS=OFF" "-DWITH_GZFILEOP=ON" "-DCMAKE_IN
  -- Using CMake version 3.24.0
  -- ZLIB_HEADER_VERSION: 1.2.11
  -- ZLIBNG_HEADER_VERSION: 2.1.0.devel
  -- Arch detected: 'aarch64'
  -- Basearch of 'aarch64' has been detected as: 'arm'
  -- Architecture-specific source files: arch/arm/arm_features.c;arch/arm/crc32_acle.c;arch/arm/insert_string_acle.c;arch/arm/adler32_neon.c;arch/arm/chunkset_neon.c;arch/arm/compare256_neon.c;arch/arm/slide_hash_
  -- The following features have been enabled:

   * CMAKE_BUILD_TYPE, Build type: Debug (selected)
   * ACLE_CRC, Support ACLE optimized CRC hash generation, using "-march=armv8-a+crc"
   * NEON_ADLER32, Support NEON instructions in adler32, using "-march=armv8-a+simd"
   * NEON_SLIDEHASH, Support NEON instructions in slide_hash, using "-march=armv8-a+simd"
   * WITH_GZFILEOP, Compile with support for gzFile related functions
   * ZLIB_COMPAT, Compile with zlib compatible API
   * WITH_SANITIZER, Enable sanitizer support
   * WITH_OPTIM, Build with optimisation
   * WITH_NEW_STRATEGIES, Use new strategies
   * WITH_ACLE, Build with ACLE
   * WITH_NEON, Build with NEON intrinsics

  -- The following features have been disabled:

   * ZLIB_SYMBOL_PREFIX, Publicly exported symbols DO NOT have a custom prefix
   * ZLIB_ENABLE_TESTS, Build test binaries
   * ZLIB_DUAL_LINK, Dual link tests against system zlib
   * WITH_FUZZERS, Build test/fuzz
   * WITH_BENCHMARKS, Build test/benchmarks
   * WITH_BENCHMARK_APPS, Build application benchmarks
   * WITH_NATIVE_INSTRUCTIONS, Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)
   * WITH_MAINTAINER_WARNINGS, Build with project maintainer warnings
   * WITH_CODE_COVERAGE, Enable code coverage reporting
   * WITH_INFLATE_STRICT, Build with strict inflate distance checking
   * WITH_INFLATE_ALLOW_INVALID_DIST, Build with zero fill for inflate invalid distances
   * INSTALL_UTILS, Copy minigzip and minideflate during install

  -- Configuring done
  -- Generating done
  -- Build files have been written to: /Users/sgolem/code/mgnr/juliarobots/willferrous/target/debug/build/libz-sys-29c908ca7e3c9af8/out/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--parallel" "10"
  Consolidate compiler generated dependencies of target zlib
  [  2%] Building C object CMakeFiles/zlib.dir/arch/arm/insert_string_acle.c.o
  [  5%] Building C object CMakeFiles/zlib.dir/arch/arm/chunkset_neon.c.o
  [ 10%] Building C object CMakeFiles/zlib.dir/arch/arm/adler32_neon.c.o
  [ 10%] Building C object CMakeFiles/zlib.dir/arch/arm/crc32_acle.c.o
  [ 12%] Building C object CMakeFiles/zlib.dir/arch/arm/compare256_neon.c.o
  [ 15%] Building C object CMakeFiles/zlib.dir/arch/arm/slide_hash_neon.c.o

  --- stderr
  make: warning: -jN forced in submake: disabling jobserver mode.
  error: unknown target CPU 'armv8-a+crc'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  error: unknown target CPU 'armv8-a+crc'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/insert_string_acle.c.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/crc32_acle.c.o] Error 1
  error: unknown target CPU 'armv8-a+simd'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/compare256_neon.c.o] Error 1
  error: unknown target CPU 'armv8-a+simd'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  error: unknown target CPU 'armv8-a+simd'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  error: unknown target CPU 'armv8-a+simd'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/adler32_neon.c.o] Error 1
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/chunkset_neon.c.o] Error 1
  make[2]: *** [CMakeFiles/zlib.dir/arch/arm/slide_hash_neon.c.o] Error 1
  make[1]: *** [CMakeFiles/zlib.dir/all] Error 2
  make: *** [all] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

  build script failed, must exit now', /Users/sgolem/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

EDIT: I updated to MacOS 12.6 but it didn't help.

Hmm, do you still have this issue? I can't reproduce it and that error output is quite odd.

It's a long shot, but I'm on cmake 3.24.2, any chance that helps?

I'm on the same version of cmake.

I later discovered that this happens only when I have my conda environment activated. It's probably messing up PATH or something like that.

I'll close this, would do it earlier but I forgot about it. Thank you for responding. 🙏