aldanor / hdf5-rust

HDF5 for Rust
https://docs.rs/hdf5
Apache License 2.0
310 stars 85 forks source link

Cross compiling with static linking fails on first compile due to Cmake configuration errors #290

Open CramBL opened 4 months ago

CramBL commented 4 months ago

Steps to reproduce

rustup target add x86_64-unknown-linux-musl
sudo apt install musl-tools
git clone git@github.com:aldanor/hdf5-rust.git --recurse
cd hdf5-rust
RUSTFLAGS="--codegen target-feature=+crt-static" \
    cargo run --example simple --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc --target "x86_64-unknown-linux-musl"

Relevant part (whole output in the bottom of the issue)

  --- stderr
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     TEST_LFS_WORKS_RUN (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_PRINTF_LL_TEST_RUN (advanced)
     H5_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LDOUBLE_TO_LONG_SPECIAL_RUN (advanced)
     H5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LONG_TO_LDOUBLE_SPECIAL_RUN (advanced)
     H5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LDOUBLE_TO_LLONG_ACCURATE_RUN (advanced)
     H5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LLONG_TO_LDOUBLE_CORRECT_RUN (advanced)
     H5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_DISABLE_SOME_LDOUBLE_CONV_RUN (advanced)
     H5_DISABLE_SOME_LDOUBLE_CONV_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_NO_ALIGNMENT_RESTRICTIONS_RUN (advanced)
     H5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  thread 'main' panicked at /home/marcbk/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

Simply invoking the same build command again completes the compilation and produces a statically linked binary

ldd target/x86_64-unknown-linux-musl/debug/examples/simple
#   statically linked

Proposed solution

Let user define the missing defines that generate the errors.

Simply adding the following to https://github.com/aldanor/hdf5-rust/blob/master/hdf5-src/build.rs allows the build to continue with no errors on first try (while running cargo clean prior):

cfg.define("TEST_LFS_WORKS_RUN", "OFF");
cfg.define("H5_PRINTF_LL_TEST_RUN", "OFF");
cfg.define("H5_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_LDOUBLE_TO_LONG_SPECIAL_RUN", "OFF");
cfg.define("H5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_LONG_TO_LDOUBLE_SPECIAL_RUN", "OFF");
cfg.define("H5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_LDOUBLE_TO_LLONG_ACCURATE_RUN", "OFF");
cfg.define("H5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_LLONG_TO_LDOUBLE_CORRECT_RUN", "OFF");
cfg.define("H5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_DISABLE_SOME_LDOUBLE_CONV_RUN", "OFF");
cfg.define("H5_DISABLE_SOME_LDOUBLE_CONV_RUN__TRYRUN_OUTPUT", "OFF");
cfg.define("H5_NO_ALIGNMENT_RESTRICTIONS_RUN", "OFF");
cfg.define("H5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT", "OFF");

Full compiler failure output

warning: `hdf5-sys` (build script) generated 1 warning
The following warnings were emitted during compilation:

warning: hdf5-src@0.8.1: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `musl-g++` installed?

error: failed to run custom build command for `hdf5-src v0.8.1 (/home/marcbk/test/hdf5-rust/hdf5-src)`

Caused by:
  process didn't exit successfully: `/home/marcbk/test/hdf5-rust/target/debug/build/hdf5-src-f7da7ad76cdac73e/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:zlib_header=/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/libz-sys-4a798fdc2f99a2cc/out/include/zlib.h
  cargo:zlib=z
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-musl = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_musl = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-linux-musl = None
  CMAKE_GENERATOR_x86_64_unknown_linux_musl = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `musl-g++` installed?
  CMAKE_PREFIX_PATH_x86_64-unknown-linux-musl = None
  CMAKE_PREFIX_PATH_x86_64_unknown_linux_musl = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-linux-musl = None
  CMAKE_x86_64_unknown_linux_musl = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/home/marcbk/test/hdf5-rust/hdf5-src/ext/hdf5" "-DHDF5_NO_PACKAGES=ON" "-DBUILD_SHARED_LIBS=OFF" "-DBUILD_TESTING=OFF" "-DHDF5_BUILD_TOOLS=OFF" "-DHDF5_BUILD_EXAMPLES=OFF" "-DHDF5_BUILD_JAVA=OFF" "-DHDF5_BUILD_FORTRAN=OFF" "-DHDF5_BUILD_CPP_LIB=OFF" "-DHDF5_BUILD_UTILS=OFF" "-DHDF5_ENABLE_PARALLEL=OFF" "-DHDF5_ENABLE_DEPRECATED_SYMBOLS=OFF" "-DHDF5_ENABLE_THREADSAFE=OFF" "-DALLOW_UNSUPPORTED=OFF" "-DHDF5_BUILD_HL_LIB=OFF" "-DHDF5_ENABLE_Z_LIB_SUPPORT=ON" "-DH5_ZLIB_HEADER=/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/libz-sys-4a798fdc2f99a2cc/out/include/zlib.h" "-DZLIB_STATIC_LIBRARY=z" "-DCMAKE_SYSTEM_NAME=Linux" "-DCMAKE_SYSTEM_PROCESSOR=x86_64" "-DCMAKE_INSTALL_PREFIX=/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_C_COMPILER=/usr/bin/musl-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_CXX_COMPILER=musl-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_ASM_COMPILER=/usr/bin/musl-gcc" "-DCMAKE_BUILD_TYPE=Debug"
  -- The C compiler identification is GNU 11.4.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/musl-gcc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- SOVERSION: 103.3.0
  -- SOVERSION_TOOLS: 102.0.0
  -- SOVERSION_CXX: 103.3.0
  -- SOVERSION_F: 102.1.0
  -- SOVERSION_HL: 100.1.4
  -- SOVERSION_HL_CXX: 100.1.5
  -- SOVERSION_HL_F: 100.0.6
  -- SOVERSION_JAVA: 100.5.0
  -- Looking for include file sys/file.h
  -- Looking for include file sys/file.h - found
  -- Looking for include files sys/file.h, sys/ioctl.h
  -- Looking for include files sys/file.h, sys/ioctl.h - found
  -- Looking for 3 include files sys/file.h, ..., sys/resource.h
  -- Looking for 3 include files sys/file.h, ..., sys/resource.h - found
  -- Looking for 4 include files sys/file.h, ..., sys/socket.h
  -- Looking for 4 include files sys/file.h, ..., sys/socket.h - found
  -- Looking for 5 include files sys/file.h, ..., sys/stat.h
  -- Looking for 5 include files sys/file.h, ..., sys/stat.h - found
  -- Looking for 6 include files sys/file.h, ..., sys/time.h
  -- Looking for 6 include files sys/file.h, ..., sys/time.h - found
  -- Looking for 7 include files sys/file.h, ..., sys/types.h
  -- Looking for 7 include files sys/file.h, ..., sys/types.h - found
  -- Looking for 8 include files sys/file.h, ..., features.h
  -- Looking for 8 include files sys/file.h, ..., features.h - found
  -- Looking for 9 include files sys/file.h, ..., dirent.h
  -- Looking for 9 include files sys/file.h, ..., dirent.h - found
  -- Looking for 10 include files sys/file.h, ..., setjmp.h
  -- Looking for 10 include files sys/file.h, ..., setjmp.h - found
  -- Looking for 11 include files sys/file.h, ..., stddef.h
  -- Looking for 11 include files sys/file.h, ..., stddef.h - found
  -- Looking for 12 include files sys/file.h, ..., stdint.h
  -- Looking for 12 include files sys/file.h, ..., stdint.h - found
  -- Looking for 13 include files sys/file.h, ..., unistd.h
  -- Looking for 13 include files sys/file.h, ..., unistd.h - found
  -- Looking for 14 include files sys/file.h, ..., io.h
  -- Looking for 14 include files sys/file.h, ..., io.h - not found
  -- Looking for 14 include files sys/file.h, ..., winsock2.h
  -- Looking for 14 include files sys/file.h, ..., winsock2.h - not found
  -- Looking for 14 include files sys/file.h, ..., globus/common.h
  -- Looking for 14 include files sys/file.h, ..., globus/common.h - not found
  -- Looking for 14 include files sys/file.h, ..., pdb.h
  -- Looking for 14 include files sys/file.h, ..., pdb.h - not found
  -- Looking for 14 include files sys/file.h, ..., pthread.h
  -- Looking for 14 include files sys/file.h, ..., pthread.h - found
  -- Looking for 15 include files sys/file.h, ..., srbclient.h
  -- Looking for 15 include files sys/file.h, ..., srbclient.h - not found
  -- Looking for 15 include files sys/file.h, ..., string.h
  -- Looking for 15 include files sys/file.h, ..., string.h - found
  -- Looking for 16 include files sys/file.h, ..., strings.h
  -- Looking for 16 include files sys/file.h, ..., strings.h - found
  -- Looking for 17 include files sys/file.h, ..., stdlib.h
  -- Looking for 17 include files sys/file.h, ..., stdlib.h - found
  -- Looking for 18 include files sys/file.h, ..., memory.h
  -- Looking for 18 include files sys/file.h, ..., memory.h - found
  -- Looking for 19 include files sys/file.h, ..., dlfcn.h
  -- Looking for 19 include files sys/file.h, ..., dlfcn.h - found
  -- Looking for 20 include files sys/file.h, ..., inttypes.h
  -- Looking for 20 include files sys/file.h, ..., inttypes.h - found
  -- Looking for 21 include files sys/file.h, ..., netinet/in.h
  -- Looking for 21 include files sys/file.h, ..., netinet/in.h - found
  -- Looking for 22 include files sys/file.h, ..., netdb.h
  -- Looking for 22 include files sys/file.h, ..., netdb.h - found
  -- Looking for 23 include files sys/file.h, ..., arpa/inet.h
  -- Looking for 23 include files sys/file.h, ..., arpa/inet.h - found
  -- Looking for 24 include files sys/file.h, ..., stdbool.h
  -- Looking for 24 include files sys/file.h, ..., stdbool.h - found
  -- Looking for include file quadmath.h
  -- Looking for include file quadmath.h - found
  -- Looking for ceil in m;
  -- Looking for ceil in m; - found
  -- Looking for dlopen in dl;m
  -- Looking for dlopen in dl;m - found
  -- Looking for WSAStartup in ws2_32;m;dl
  -- Looking for WSAStartup in ws2_32;m;dl - not found
  -- Looking for gethostbyname in wsock32;m;dl
  -- Looking for gethostbyname in wsock32;m;dl - not found
  -- Looking for gethostname in ucb;m;dl
  -- Looking for gethostname in ucb;m;dl - not found
  -- Performing Other Test STDC_HEADERS - Success
  -- Performing TEST_LFS_WORKS... no
  -- Performing Other Test HAVE_OFF64_T - Failed
  -- Looking for fseeko
  -- Looking for fseeko - found
  -- Performing Test HAVE_STAT64_STRUCT
  -- Performing Test HAVE_STAT64_STRUCT - Failed
  -- 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 char
  -- Check size of char - done
  -- Check size of short
  -- Check size of short - done
  -- Check size of int
  -- Check size of int - done
  -- Check size of unsigned
  -- Check size of unsigned - done
  -- Check size of long
  -- Check size of long - done
  -- Check size of long long
  -- Check size of long long - done
  -- Check size of __int64
  -- Check size of __int64 - failed
  -- Check size of float
  -- Check size of float - done
  -- Check size of double
  -- Check size of double - done
  -- Check size of long double
  -- Check size of long double - done
  -- Check size of int8_t
  -- Check size of int8_t - done
  -- Check size of uint8_t
  -- Check size of uint8_t - done
  -- Check size of int_least8_t
  -- Check size of int_least8_t - done
  -- Check size of uint_least8_t
  -- Check size of uint_least8_t - done
  -- Check size of int_fast8_t
  -- Check size of int_fast8_t - done
  -- Check size of uint_fast8_t
  -- Check size of uint_fast8_t - done
  -- Check size of int16_t
  -- Check size of int16_t - done
  -- Check size of uint16_t
  -- Check size of uint16_t - done
  -- Check size of int_least16_t
  -- Check size of int_least16_t - done
  -- Check size of uint_least16_t
  -- Check size of uint_least16_t - done
  -- Check size of int_fast16_t
  -- Check size of int_fast16_t - done
  -- Check size of uint_fast16_t
  -- Check size of uint_fast16_t - done
  -- Check size of int32_t
  -- Check size of int32_t - done
  -- Check size of uint32_t
  -- Check size of uint32_t - done
  -- Check size of int_least32_t
  -- Check size of int_least32_t - done
  -- Check size of uint_least32_t
  -- Check size of uint_least32_t - done
  -- Check size of int_fast32_t
  -- Check size of int_fast32_t - done
  -- Check size of uint_fast32_t
  -- Check size of uint_fast32_t - done
  -- Check size of int64_t
  -- Check size of int64_t - done
  -- Check size of uint64_t
  -- Check size of uint64_t - done
  -- Check size of int_least64_t
  -- Check size of int_least64_t - done
  -- Check size of uint_least64_t
  -- Check size of uint_least64_t - done
  -- Check size of int_fast64_t
  -- Check size of int_fast64_t - done
  -- Check size of uint_fast64_t
  -- Check size of uint_fast64_t - done
  -- Check size of size_t
  -- Check size of size_t - done
  -- Check size of ssize_t
  -- Check size of ssize_t - done
  -- Check size of ptrdiff_t
  -- Check size of ptrdiff_t - done
  -- Check size of off_t
  -- Check size of off_t - done
  -- Check size of off64_t
  -- Check size of off64_t - failed
  -- Check size of time_t
  -- Check size of time_t - done
  -- Check size of _Bool
  -- Check size of _Bool - done
  -- Performing Other Test DEV_T_IS_SCALAR - Success
  -- Looking for CLOCK_MONOTONIC
  -- Looking for CLOCK_MONOTONIC - not found
  -- Performing Test H5_HAVE_TM_GMTOFF
  -- Performing Test H5_HAVE_TM_GMTOFF - Success
  -- Performing Test H5_HAVE___TM_GMTOFF
  -- Performing Test H5_HAVE___TM_GMTOFF - Success
  -- Performing Test H5_TIME_WITH_SYS_TIME
  -- Performing Test H5_TIME_WITH_SYS_TIME - Success
  -- Performing Test H5_HAVE_STRUCT_TIMEZONE
  -- Performing Test H5_HAVE_STRUCT_TIMEZONE - Failed
  -- Looking for gettimeofday
  -- Looking for gettimeofday - found
  -- Performing Other Test GETTIMEOFDAY_GIVES_TZ - Success
  -- Performing Other Test HAVE_TM_ZONE - Failed
  -- Performing Other Test HAVE_STRUCT_TM_TM_ZONE - Failed
  -- Performing Other Test HAVE_TIMEZONE - Success
  -- Performing Test H5_HAVE_STAT_ST_BLOCKS
  -- Performing Test H5_HAVE_STAT_ST_BLOCKS - Success
  -- Looking for ioctl
  -- Looking for ioctl - found
  -- Performing Test H5_HAVE_STRUCT_VIDEOCONFIG
  -- Performing Test H5_HAVE_STRUCT_VIDEOCONFIG - Failed
  -- Performing Test H5_HAVE_STRUCT_TEXT_INFO
  -- Performing Test H5_HAVE_STRUCT_TEXT_INFO - Failed
  -- Looking for _getvideoconfig
  -- Looking for _getvideoconfig - not found
  -- Looking for gettextinfo
  -- Looking for gettextinfo - not found
  -- Looking for _scrsize
  -- Looking for _scrsize - not found
  -- Looking for GetConsoleScreenBufferInfo
  -- Looking for GetConsoleScreenBufferInfo - not found
  -- Looking for TIOCGWINSZ
  -- Looking for TIOCGWINSZ - found
  -- Looking for TIOCGETD
  -- Looking for TIOCGETD - found
  -- Looking for getpwuid
  -- Looking for getpwuid - found
  -- Looking for alarm
  -- Looking for alarm - found
  -- Looking for fcntl
  -- Looking for fcntl - found
  -- Looking for flock
  -- Looking for flock - found
  -- Looking for fork
  -- Looking for fork - found
  -- Looking for frexpf
  -- Looking for frexpf - found
  -- Looking for frexpl
  -- Looking for frexpl - found
  -- Looking for gethostname
  -- Looking for gethostname - found
  -- Looking for getrusage
  -- Looking for getrusage - found
  -- Looking for llround
  -- Looking for llround - found
  -- Looking for llroundf
  -- Looking for llroundf - found
  -- Looking for lround
  -- Looking for lround - found
  -- Looking for lroundf
  -- Looking for lroundf - found
  -- Looking for lstat
  -- Looking for lstat - found
  -- Looking for pread
  -- Looking for pread - found
  -- Looking for pwrite
  -- Looking for pwrite - found
  -- Looking for rand_r
  -- Looking for rand_r - found
  -- Looking for random
  -- Looking for random - found
  -- Looking for round
  -- Looking for round - found
  -- Looking for roundf
  -- Looking for roundf - found
  -- Looking for setsysinfo
  -- Looking for setsysinfo - not found
  -- Looking for signal
  -- Looking for signal - found
  -- Looking for longjmp
  -- Looking for longjmp - found
  -- Looking for setjmp
  -- Looking for setjmp - found
  -- Looking for siglongjmp
  -- Looking for siglongjmp - found
  -- Looking for sigsetjmp
  -- Looking for sigsetjmp - found
  -- Looking for sigprocmask
  -- Looking for sigprocmask - found
  -- Looking for snprintf
  -- Looking for snprintf - found
  -- Looking for srandom
  -- Looking for srandom - found
  -- Looking for strdup
  -- Looking for strdup - found
  -- Looking for strtoll
  -- Looking for strtoll - found
  -- Looking for strtoull
  -- Looking for strtoull - found
  -- Looking for symlink
  -- Looking for symlink - found
  -- Looking for system
  -- Looking for system - found
  -- Looking for tmpfile
  -- Looking for tmpfile - found
  -- Looking for asprintf
  -- Looking for asprintf - found
  -- Looking for vasprintf
  -- Looking for vasprintf - found
  -- Looking for waitpid
  -- Looking for waitpid - found
  -- Looking for vsnprintf
  -- Looking for vsnprintf - found
  -- Performing Other Test VSNPRINTF_WORKS - Success
  -- Performing Other Test HAVE_ATTRIBUTE - Success
  -- Performing Other Test HAVE_C99_FUNC - Success
  -- Performing Other Test HAVE_FUNCTION - Success
  -- Performing Other Test HAVE_C99_DESIGNATED_INITIALIZER - Success
  -- Performing Other Test SYSTEM_SCOPE_THREADS - Success
  -- Performing Other Test HAVE_SOCKLEN_T - Success
  -- Performing Other Test HAVE_INLINE - Success
  -- Performing Other Test HAVE___INLINE__ - Success
  -- Performing Other Test HAVE___INLINE - Success
  -- Checking for appropriate format for 64 bit long:
  -- Width test failed with result: PLEASE_FILL_OUT-FAILED_TO_RUN
  -- Checking for appropriate format for 64 bit long: not found
  -- Looking for difftime
  -- Looking for difftime - found
  -- Looking for clock_gettime
  -- Looking for clock_gettime - found
  -- Looking for clock_gettime in rt
  -- Looking for clock_gettime in rt - found
  -- Looking for clock_gettime in posix4
  -- Looking for clock_gettime in posix4 - not found
  -- Check size of __float128
  -- Check size of __float128 - done
  -- Check size of _Quad
  -- Check size of _Quad - failed
  -- Checking IF your system converts long double to (unsigned) long values with special algorithm... no
  -- Checking IF your system can convert (unsigned) long to long double values with special algorithm... no
  -- Checking IF correctly converting long double to (unsigned) long long values... no
  -- Checking IF correctly converting (unsigned) long long to long double values... no
  -- Checking IF the cpu is power9 and cannot correctly converting long double values... no
  -- Checking IF alignment restrictions are strictly enforced... no
  -- Warnings Configuration: default:  -std=c99  -ffunction-sections -fdata-sections -fPIC -m64 -static :   -ffunction-sections -fdata-sections -fPIC -m64 -static
  -- CMAKE_C_FLAGS_GENERAL=-Wall;-Wcast-qual;-Wconversion;-Wextra;-Wfloat-equal;-Wformat=2;-Winit-self;-Winvalid-pch;-Wmissing-include-dirs;-Wno-c++-compat;-Wno-format-nonliteral;-Wshadow;-Wundef;-Wwrite-strings;-pedantic
  -- Filter ZLIB is ON
  -- Configuring incomplete, errors occurred!
  See also "/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/CMakeFiles/CMakeOutput.log".
  See also "/home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     TEST_LFS_WORKS_RUN (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_PRINTF_LL_TEST_RUN (advanced)
     H5_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LDOUBLE_TO_LONG_SPECIAL_RUN (advanced)
     H5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LONG_TO_LDOUBLE_SPECIAL_RUN (advanced)
     H5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LDOUBLE_TO_LLONG_ACCURATE_RUN (advanced)
     H5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_LLONG_TO_LDOUBLE_CORRECT_RUN (advanced)
     H5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_DISABLE_SOME_LDOUBLE_CONV_RUN (advanced)
     H5_DISABLE_SOME_LDOUBLE_CONV_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
     H5_NO_ALIGNMENT_RESTRICTIONS_RUN (advanced)
     H5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT (advanced)
  For details see /home/marcbk/test/hdf5-rust/target/x86_64-unknown-linux-musl/debug/build/hdf5-src-e377d37d8310b99c/out/build/TryRunResults.cmake
  thread 'main' panicked at /home/marcbk/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

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

  build script failed, must exit now
Isaac-Leonard commented 1 month ago

Is it safe to add these config options when not cross compiling?

Isaac-Leonard commented 1 month ago

So I forked the repo and added the above config options to the build.rs file and it works fine when building in the repo but the configuration options seem to have no affect when I patch my project with my fork for hdf5-src, do you know what may be going on?

magnusuMET commented 1 month ago

@Isaac-Leonard Does it work if you use the fork (hdf5-metno-src) at https://github.com/metno/hdf5-rust?

CramBL commented 1 month ago

FYI: I'm following this issue but won't be contributing much to the discussion due to my very limited HDF5 knowledge.

Isaac-Leonard commented 1 month ago

I couldn't get it to work unfortunately though I think due to dependency conflicts rather then because of the code. I've solved the issue for now though by building on an older version of a platform that works without cross compiling.