rust-lang / libz-sys

Rust crate package to link to a system libz (zlib)
Apache License 2.0
110 stars 73 forks source link

Failed to build zlib-ng with gnullvm target. #153

Open QianNangong opened 10 months ago

QianNangong commented 10 months ago
  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-gnullvm = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnullvm = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-gnullvm = None
  CMAKE_GENERATOR_x86_64_pc_windows_gnullvm = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-gnullvm = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_gnullvm = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-gnullvm = None
  CMAKE_x86_64_pc_windows_gnullvm = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/Users/me/my_project/target/x86_64-pc-windows-gnullvm/release/build/libz-ng-sys-38db99fd6e7950b4/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libz-ng-sys-1.1.12/src/zlib-ng" "-DCMAKE_RC_COMPILER=/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang" "-DBUILD_SHARED_LIBS=OFF" "-DZLIB_COMPAT=OFF" "-DZLIB_ENABLE_TESTS=OFF" "-DWITH_GZFILEOP=ON" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_SYSTEM_PROCESSOR=AMD64" "-DCMAKE_INSTALL_PREFIX=/Users/me/my_project/target/x86_64-pc-windows-gnullvm/release/build/libz-ng-sys-38db99fd6e7950b4/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections --target=x86_64-pc-windows-gnullvm" "-DCMAKE_C_COMPILER=/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections --target=x86_64-pc-windows-gnullvm" "-DCMAKE_CXX_COMPILER=/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections --target=x86_64-pc-windows-gnullvm" "-DCMAKE_ASM_COMPILER=/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang" "-DCMAKE_BUILD_TYPE=Release"
  -- Using CMake version 3.25.2
  -- ZLIB_HEADER_VERSION: 1.2.13
  -- ZLIBNG_HEADER_VERSION: 2.1.3
  -- The C compiler identification is Clang 17.0.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /opt/llvm-mingw/bin/x86_64-w64-mingw32-clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Arch not recognized, falling back to cmake arch: 'AMD64'
  -- Basearch of 'AMD64' has been detected as: 'x86'
  -- Performing Test FNO_LTO_AVAILABLE
  -- Performing Test FNO_LTO_AVAILABLE - Success
  -- Looking for sys/auxv.h
  -- Looking for sys/auxv.h - not found
  -- Looking for sys/sdt.h
  -- Looking for sys/sdt.h - not found
  -- Looking for unistd.h
  -- Looking for unistd.h - found
  -- Looking for sys/types.h
  -- Looking for sys/types.h - found
  -- Looking for stdint.h
  -- Looking for stdint.h - found
  -- Looking for stddef.h
  -- Looking for stddef.h - found
  -- Check size of off64_t
  -- Check size of off64_t - done
  -- Looking for fseeko
  -- Looking for fseeko - found
  -- Looking for strerror
  -- Looking for strerror - found
  -- Looking for posix_memalign
  -- Looking for posix_memalign - not found
  -- Looking for aligned_alloc
  -- Looking for aligned_alloc - not found
  -- Performing Test HAVE_NO_INTERPOSITION
  -- Performing Test HAVE_NO_INTERPOSITION - Success
  -- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN
  -- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN - Success
  -- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL
  -- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL - Success
  -- Performing Test HAVE_ATTRIBUTE_ALIGNED
  -- Performing Test HAVE_ATTRIBUTE_ALIGNED - Success
  -- Performing Test HAVE_THREAD_LOCAL
  -- Performing Test HAVE_THREAD_LOCAL - Success
  -- Performing Test HAVE_BUILTIN_CTZ
  -- Performing Test HAVE_BUILTIN_CTZ - Success
  -- Performing Test HAVE_BUILTIN_CTZLL
  -- Performing Test HAVE_BUILTIN_CTZLL - Success
  -- Performing Test HAVE_PTRDIFF_T
  -- Performing Test HAVE_PTRDIFF_T - Success
  -- Performing Test HAVE_AVX2_INTRIN
  -- Performing Test HAVE_AVX2_INTRIN - Success
  -- Performing Test HAVE_CASCADE_LAKE
  -- Performing Test HAVE_CASCADE_LAKE - Success
  -- Performing Test HAVE_AVX512_INTRIN
  -- Performing Test HAVE_AVX512_INTRIN - Success
  -- Performing Test HAVE_MASK_INTRIN
  -- Performing Test HAVE_MASK_INTRIN - Success
  -- Performing Test HAVE_AVX512VNNI_INTRIN
  -- Performing Test HAVE_AVX512VNNI_INTRIN - Success
  -- Performing Test HAVE_SSE42CRC_INLINE_ASM
  -- Performing Test HAVE_SSE42CRC_INLINE_ASM - Success
  -- Performing Test HAVE_SSE42CRC_INTRIN
  -- Performing Test HAVE_SSE42CRC_INTRIN - Success
  -- Performing Test HAVE_SSE2_INTRIN
  -- Performing Test HAVE_SSE2_INTRIN - Success
  -- Performing Test HAVE_SSSE3_INTRIN
  -- Performing Test HAVE_SSSE3_INTRIN - Success
  -- Performing Test HAVE_PCLMULQDQ_INTRIN
  -- Performing Test HAVE_PCLMULQDQ_INTRIN - Success
  -- Performing Test HAVE_VPCLMULQDQ_INTRIN
  -- Performing Test HAVE_VPCLMULQDQ_INTRIN - Success
  -- Performing Test HAVE_XSAVE_INTRIN
  -- Performing Test HAVE_XSAVE_INTRIN - Success
  -- Architecture-specific source files: arch/x86/x86_features.c;arch/x86/slide_hash_avx2.c;arch/x86/chunkset_avx2.c;arch/x86/compare256_avx2.c;arch/x86/adler32_avx2.c;arch/x86/adler32_avx512.c;arch/x86/adler32_avx512_vnni.c;arch/x86/adler32_sse42.c;arch/x86/insert_string_sse42.c;arch/x86/chunkset_sse2.c;arch/x86/compare256_sse2.c;arch/x86/slide_hash_sse2.c;arch/x86/adler32_ssse3.c;arch/x86/chunkset_ssse3.c;arch/x86/crc32_pclmulqdq.c;arch/x86/crc32_vpclmulqdq.c
  -- The following features have been enabled:

   * CMAKE_BUILD_TYPE, Build type: Release (selected)
   * SSE2, Support the SSE2 instruction set, using ""
   * AVX2_SLIDEHASH, Support AVX2 optimized slide_hash, using "-mavx2"
   * AVX2_CHUNKSET, Support AVX2 optimized chunkset, using "-mavx2"
   * AVX2_COMPARE256, Support AVX2 optimized compare256, using "-mavx2"
   * AVX2_ADLER32, Support AVX2-accelerated adler32, using "-mavx2"
   * AVX512_ADLER32, Support AVX512-accelerated adler32, using "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mtune=cascadelake"
   * AVX512VNNI_ADLER32, Support AVX512VNNI adler32, using "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni -mtune=cascadelake"
   * SSE42_CRC, Support SSE4.2 optimized CRC hash generation, using "-msse4.2"
   * SSSE3_ADLER32, Support SSSE3-accelerated adler32, using "-mssse3"
   * PCLMUL_CRC, Support CRC hash generation using PCLMULQDQ, using "-mssse3 -msse4.2 -mpclmul"
   * VPCLMUL_CRC, Support CRC hash generation using VPCLMULQDQ, using "-mvpclmulqdq -mavx512f -mavx512f -mavx512dq -mavx512bw -mavx512vl -mtune=cascadelake"
   * XSAVE, Support XSAVE intrinsics using "-mxsave"
   * WITH_GZFILEOP, Compile with support for gzFile related functions
   * ZLIBNG_ENABLE_TESTS, Test zlib-ng specific API
   * WITH_SANITIZER, Enable sanitizer support
   * WITH_GTEST, Build gtest_zlib
   * WITH_OPTIM, Build with optimisation
   * WITH_NEW_STRATEGIES, Use new strategies
   * WITH_AVX2, Build with AVX2
   * WITH_AVX512, Build with AVX512
   * WITH_AVX512VNNI, Build with AVX512 VNNI
   * WITH_SSE2, Build with SSE2
   * WITH_SSSE3, Build with SSSE3
   * WITH_SSE42, Build with SSE42
   * WITH_PCLMULQDQ, Build with PCLMULQDQ
   * WITH_VPCLMULQDQ, Build with VPCLMULQDQ

  -- The following features have been disabled:

   * FORCE_SSE2, Assume CPU is SSE2 capable
   * ZLIB_SYMBOL_PREFIX, Publicly exported symbols DO NOT have a custom prefix
   * ZLIB_COMPAT, Compile with zlib compatible API
   * ZLIB_ENABLE_TESTS, Build test binaries
   * 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/me/my_project/target/x86_64-pc-windows-gnullvm/release/build/libz-ng-sys-38db99fd6e7950b4/out/build
  running: cd "/Users/me/my_project/target/x86_64-pc-windows-gnullvm/release/build/libz-ng-sys-38db99fd6e7950b4/out/build" && MAKEFLAGS="-j --jobserver-fds=7,10 --jobserver-auth=7,10" "cmake" "--build" "." "--target" "install" "--config" "Release"
  [  4%] Building C object CMakeFiles/zlib.dir/chunkset.c.obj
  [  4%] Building C object CMakeFiles/zlib.dir/adler32_fold.c.obj
  [  8%] Building C object CMakeFiles/zlib.dir/compress.c.obj
  [  6%] Building C object CMakeFiles/zlib.dir/crc32_braid.c.obj
  [ 10%] Building C object CMakeFiles/zlib.dir/crc32_braid_comb.c.obj
  [ 12%] Building C object CMakeFiles/zlib.dir/adler32.c.obj
  [ 17%] Building C object CMakeFiles/zlib.dir/crc32_fold.c.obj
  [ 17%] Building C object CMakeFiles/zlib.dir/compare256.c.obj
  [ 19%] Building C object CMakeFiles/zlib.dir/cpu_features.c.obj
  [ 21%] Building C object CMakeFiles/zlib.dir/deflate_fast.c.obj
  [ 23%] Building C object CMakeFiles/zlib.dir/deflate.c.obj
  [ 25%] Building C object CMakeFiles/zlib.dir/deflate_huff.c.obj
  [ 27%] Building C object CMakeFiles/zlib.dir/deflate_medium.c.obj
  [ 29%] Building C object CMakeFiles/zlib.dir/deflate_quick.c.obj
  [ 31%] Building C object CMakeFiles/zlib.dir/deflate_rle.c.obj
  [ 34%] Building C object CMakeFiles/zlib.dir/deflate_slow.c.obj
  [ 36%] Building C object CMakeFiles/zlib.dir/deflate_stored.c.obj
  [ 38%] Building C object CMakeFiles/zlib.dir/functable.c.obj
  [ 40%] Building C object CMakeFiles/zlib.dir/infback.c.obj
  [ 42%] Building C object CMakeFiles/zlib.dir/inflate.c.obj
  [ 44%] Building C object CMakeFiles/zlib.dir/inftrees.c.obj
  [ 46%] Building C object CMakeFiles/zlib.dir/insert_string.c.obj
  [ 48%] Building C object CMakeFiles/zlib.dir/insert_string_roll.c.obj
  [ 51%] Building C object CMakeFiles/zlib.dir/slide_hash.c.obj
  [ 53%] Building C object CMakeFiles/zlib.dir/trees.c.obj
  [ 55%] Building C object CMakeFiles/zlib.dir/uncompr.c.obj
  [ 57%] Building C object CMakeFiles/zlib.dir/zutil.c.obj
  [ 59%] Building C object CMakeFiles/zlib.dir/arch/x86/x86_features.c.obj
  [ 61%] Building C object CMakeFiles/zlib.dir/arch/x86/slide_hash_avx2.c.obj
  [ 63%] Building C object CMakeFiles/zlib.dir/arch/x86/chunkset_avx2.c.obj
  [ 65%] Building C object CMakeFiles/zlib.dir/arch/x86/compare256_avx2.c.obj
  [ 68%] Building C object CMakeFiles/zlib.dir/arch/x86/adler32_avx2.c.obj
  [ 70%] Building C object CMakeFiles/zlib.dir/arch/x86/adler32_avx512.c.obj
  [ 72%] Building C object CMakeFiles/zlib.dir/arch/x86/adler32_avx512_vnni.c.obj
  [ 74%] Building C object CMakeFiles/zlib.dir/arch/x86/adler32_sse42.c.obj

  --- stderr
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS
      CMAKE_CXX_COMPILER
      CMAKE_CXX_FLAGS

  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libz-ng-sys-1.1.12/src/zlib-ng/arch/x86/x86_features.c:39:5: error: call to undeclared function '__cpuidex'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     39 |     __cpuidex((int *)registers, info, subinfo);
        |     ^
  1 warning and 1 error generated.
  make[2]: *** [CMakeFiles/zlib.dir/arch/x86/x86_features.c.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
  1 warning generated.
  warning: unknown warning option '-Wno-pedantic-ms-format'; did you mean '-Wno-pedantic-macros'? [-Wunknown-warning-option]
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  1 warning generated.
  make[1]: *** [CMakeFiles/zlib.dir/all] Error 2
  make: *** [all] Error 2
  thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 2

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Byron commented 10 months ago

CI doesn't seem to reproduce the issue in particular as it can't find the toolchain in the first place: https://github.com/rust-lang/libz-sys/actions/runs/6062781035/job/16449371625?pr=154.

Do you have any hints on how to reproduce this issue?

The toolchain isn't tested here BTW, and once CI can reproduce the failure there is a chance for a fix, too. It would probably have to be contributed though.

QianNangong commented 10 months ago

I build my project via

cargo +nightly build --target=x86_64-pc-windows-gnullvm -Z build-std

The x86_64-pc-windows-gnullvm target is in Tier 3 and no std is prebuilt.

QianNangong commented 10 months ago

And I use https://github.com/mstorsjo/llvm-mingw as cross compile toolchains, it should be available via MSYS2 also.

Byron commented 10 months ago

Thanks! This seems to be the explanation why CI can't get ahold of this toolchain (and that I have never seen it).

I don't know if there is any policy of which tiers this crate aims to support, but I think none of the supported targets are not prebuilt.

With that said, I am happy to keep this open as tracking ticket, but would hope that CI support for it could be added so potential fixes can be validated. Reproducing this on CI seems expensive, maybe even prohibitive, on a 2 core VM so supporting this toolchain while in tier 3 might not be feasible for that reason alone.

QianNangong commented 10 months ago

I will try to fix it by myself but I have no idea how to fix it...

mati865 commented 6 months ago

This issue should no longer happen in latest version of this crate due to an upstream fix: https://github.com/zlib-ng/zlib-ng/commit/1c1e728637025cf1d13d99718ccb2d5cb1e9dfaa