rust-lang / libz-sys

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

crate wants to install to /usr/local during building #109

Open johanneskoester opened 2 years ago

johanneskoester commented 2 years ago

When building the crate (at least as a dependency, with zlib-ng and static feature enabled), it want to install stuff into /usr/local.

Example:

Compiling libz-sys v1.1.8
error: failed to run custom build command for `libz-sys v1.1.8`

Caused by:
  process didn't exit successfully: `/projects/koesterlab/varlociraptor-clinical-testcases/target/debug/build/libz-sys-bff081efc5b46ae9/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
  cargo:rerun-if-changed=build.rs
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
  CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = Some("/homes/johannes/mambaforge/envs/build:/homes/johannes/mambaforge/envs/build/x86_64-conda-linux-gnu/sysroot/usr")
  CMAKE_x86_64-unknown-linux-gnu = None
  CMAKE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "/homes/johannes/.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_INSTALL_PREFIX=/projects/koesterlab/varlociraptor-clinical-testcases/target/debug/build/libz-sys-c7199d5580f447fd/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -ffunction-sections -pipe -isystem /homes/johannes/mambaforge/envs/build/include" "-DCMAKE_C_COMPILER=/homes/johannes/mambaforge/envs/build/bin/x86_64-conda-linux-gnu-cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -ffunction-sections -pipe -isystem /homes/johannes/mambaforge/envs/build/include" "-DCMAKE_CXX_COMPILER=/homes/johannes/mambaforge/envs/build/bin/x86_64-conda-linux-gnu-c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -ffunction-sections -pipe -isystem /homes/johannes/mambaforge/envs/build/include" "-DCMAKE_ASM_COMPILER=/homes/johannes/mambaforge/envs/build/bin/x86_64-conda-linux-gnu-cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- Using CMake version 3.25.1
  -- ZLIB_HEADER_VERSION: 1.2.11
  -- ZLIBNG_HEADER_VERSION: 2.1.0.devel
  -- Arch detected: 'x86_64'
  -- Basearch of 'x86_64' has been detected as: 'x86'
  -- Architecture-specific source files: arch/x86/x86_features.c;arch/x86/slide_hash_avx2.c;arch/x86/chunkset_avx.c;arch/x86/compare256_avx2.c;arch/x86/adler32_avx2.c;arch/x86/adler32_avx512.c;arch/x86/adler32_avx512_vnni.c;arch/x86/chunkset_sse41.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/crc32_fold_pclmulqdq.c
  -- The following features have been enabled:

   * CMAKE_BUILD_TYPE, Build type: Debug (selected)
   * AVX2_SLIDEHASH, Support AVX2 optimized slide_hash, using "-mavx2"
   * AVX_CHUNKSET, Support AVX 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"
   * 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_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_SSE41, Build with SSE41
   * WITH_SSE42, Build with SSE42
   * WITH_PCLMULQDQ, Build with PCLMULQDQ

  -- The following features have been disabled:

   * FORCE_TZCNT, Assume CPU is TZCNT capable
   * 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
   * WITH_VPCLMULQDQ, Build with VPCLMULQDQ
   * INSTALL_UTILS, Copy minigzip and minideflate during install

  -- Configuring done
  -- Generating done
  -- Build files have been written to: /projects/koesterlab/varlociraptor-clinical-testcases/target/debug/build/libz-sys-c7199d5580f447fd/out/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug"
  [100%] Built target zlib
  Install the project...
  -- Install configuration: "Debug"
  -- Installing: /usr/local/lib/libz.a

  --- stderr
  CMake Error at cmake_install.cmake:54 (file):
    file INSTALL cannot copy file
    "/projects/koesterlab/varlociraptor-clinical-testcases/target/debug/build/libz-sys-c7199d5580f447fd/out/build/libz.a"
    to "/usr/local/lib/libz.a": Permission denied.

  make: *** [Makefile:100: install] Error 1
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

Is there anything we can do against that?

joshtriplett commented 1 year ago

Can you give a recipe for reproducing this?