Skip to content

Static build fails with netcdf-src 0.5.0 #179

@weiznich

Description

@weiznich

Steps to reproduce:

# use a container to have a reproducible environment
docker run -it --rm rust:1.94.0
# all other commands inside of the container
apt update && apt install cmake
cargo new testing && cd testing
cargo add netcdf@0.12.0 -F static

Build output:

error: failed to run custom build command for `netcdf-src v0.5.0`

Caused by:
  process didn't exit successfully: `/testing/target/debug/build/netcdf-src-b51afe7298f37332/build-script-build` (exit status: 101)
  --- stdout
  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 = None
  CMAKE_x86_64-unknown-linux-gnu = None
  CMAKE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE = None
  CMAKE = None
  -- The C compiler identification is GNU 14.2.0
  -- The CXX compiler identification is GNU 14.2.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Checking for Deprecated Options
  -- Performing Test LIBTOOL_HAS_NO_UNDEFINED
  -- Performing Test LIBTOOL_HAS_NO_UNDEFINED - Success
  -- Performing Test CC_HAS_WCONVERSION
  -- Performing Test CC_HAS_WCONVERSION - Success
  -- Performing Test CC_HAS_SHORTEN_64_32
  -- Performing Test CC_HAS_SHORTEN_64_32 - Failed
  -- NETCDF_ENABLE_PLUGINS: OFF
  -- Configuring incomplete, errors occurred!

  --- stderr
  running: cd "/testing/target/debug/build/netcdf-src-14c4e99e63f237df/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netcdf-src-0.5.0/source" "-B" "/testing/target/debug/build/netcdf-src-14c4e99e63f237df/out/build" "-DBUILD_SHARED_LIBS=OFF" "-DNETCDF_FIND_SHARED_LIBS=OFF" "-DNETCDF_BUILD_UTILITIES=OFF" "-DNETCDF_ENABLE_EXAMPLES=OFF" "-DNETCDF_ENABLE_DAP_REMOTE_TESTS=OFF" "-DNETCDF_ENABLE_TESTS=OFF" "-DNETCDF_ENABLE_EXTREME_NUMBERS=OFF" "-DNETCDF_ENABLE_FILTER_TESTING=OFF" "-DNETCDF_ENABLE_PARALLEL_TESTS=OFF" "-DNETCDF_ENABLE_FILTER_TESTING=OFF" "-DENABLE_BASH_SCRIPT_TESTING=OFF" "-DNETCDF_NETCDF_ENABLE_PLUGINS=OFF" "-DPLUGIN_INSTALL_DIR=OFF" "-DHDF5_ROOT=/testing/target/debug/build/hdf5-metno-src-098144ad14d7aaca/out/include/../" "-DHDF5_USE_STATIC_LIBRARIES=ON" "-DNETCDF_ENABLE_LIBXML2=OFF" "-DNETCDF_ENABLE_PARALLEL4=OFF" "-DNETCDF_ENABLE_NCZARR=ON" "-DNETCDF_ENABLE_NCZARR_ZIP=OFF" "-DNETCDF_ENABLE_S3=OFF" "-DNETCDF_ENABLE_DAP=OFF" "-DNETCDF_ENABLE_BYTERANGE=OFF" "-DZLIB_ROOT=/testing/target/debug/build/libz-sys-13c2fa517481ca3d/out/include/.." "-DCMAKE_INSTALL_PREFIX=/testing/target/debug/build/netcdf-src-14c4e99e63f237df/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
  CMake Error at /usr/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
    Could not find a package configuration file provided by "ZLIB" with any of
    the following names:

      ZLIBConfig.cmake
      zlib-config.cmake

    Add the installation prefix of "ZLIB" to CMAKE_PREFIX_PATH or set
    "ZLIB_DIR" to a directory containing one of the above files.  If "ZLIB"
    provides a separate development package or SDK, be sure it has been
    installed.
  Call Stack (most recent call first):
    /testing/target/debug/build/hdf5-metno-src-098144ad14d7aaca/out/cmake/hdf5-config.cmake:157 (find_dependency)
    /usr/share/cmake-3.31/Modules/FindHDF5.cmake:513 (find_package)
    cmake/dependencies.cmake:137 (find_package)
    CMakeLists.txt:923 (include)



  thread 'main' (5268) panicked at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.58/src/lib.rs:1132:5:

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

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

Building netcdf 0.11.1 with netcdf-src 0.4.4 works in the same environment.

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