lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

hdf5-threadsafe: fix cmake flag, disable c++ api.

Short:
- fix incorrect cmake flag `"-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"` -> `"-DHDF5_ENABLE_THREADSAFE:BOOL=ON"`.
- disable unsupported c++ api in hdf5-threadsafe.

Breaking:
Note: this bug means that historically nixpkgs was building hdf5-threadsafe without threadsafety enabled, but with c++ support.
C++ and threadsafe are unsupported, so this fix is a slight breaking change if downstream users were relying on hdf5-threadsafe exposing the c++ api.
If we instead want to expose both c++ and threadsafe, we would need "-DALLOW_UNSUPPORTED=ON", but then we are exposing a combination not supported or tested by upstream.

Related:
typo introduced in https://github.com/NixOS/nixpkgs/commit/cbd4d659e34c27cae5f48d7fdf6b2863f6492e6f
in the transition to cmake `"--enable-threadsafe"` was changed to `"-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"`.
Note the double `D`, the correct syntax is `-DFLAG_NAME=VALUE`.

C++ was enabled by default in https://github.com/NixOS/nixpkgs/commit/9046690c73d913972e510566f03fad33fbe7eaf1

Longer:
```
$ nix build .#legacyPackages.aarch64-darwin.hdf5-threadsafe
$ nix log $(nix eval --raw .#legacyPackages.aarch64-darwin.hdf5-threadsafe.drvPath)
[...]
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_EXPORT_NO_PACKAGE_REGISTRY
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_SBINDIR
CMAKE_POLICY_DEFAULT_CMP0025
DHDF5_ENABLE_THREADSAFE

[...]
```

```
$ git grep -ni 'DHDF5_ENABLE_THREADSAFE'
pkgs/tools/misc/hdf5/default.nix:93: "-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"
```

We can see the correct version of this flag in the hdf5 repo
```
$ git grep -ni 'HDF5_ENABLE_THREADSAFE'
.github/workflows/arm-main-cmake.yml:94: -DHDF5_ENABLE_THREADSAFE:BOOL=ON \
[...]
CMakeBuildOptions.cmake:59:option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
[...]
```

after this fix we can again inspect the cmake output, and we no longer see a warning for this unsupported variable

```
$ nix build .#legacyPackages.aarch64-darwin.hdf5-threadsafe
$ nix log $(nix eval --raw .#legacyPackages.aarch64-darwin.hdf5-threadsafe.drvPath)
[...]

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

CMAKE_EXPORT_NO_PACKAGE_REGISTRY
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_SBINDIR
CMAKE_POLICY_DEFAULT_CMP0025

[...]
```

if we try to compile with both cppSupport and threadsafe we receive
```
> CMake Error at CMakeLists.txt:959 (message):
> **** C++ and thread-safety options are not supported, override with ALLOW_UNSUPPORTED option ****
```

Testing:
Builds clean on aarch64-darwin and x86_64-linux.

+6 -3
+2 -2
pkgs/tools/misc/hdf5/default.nix
··· 23 23 }: 24 24 25 25 # cpp and mpi options are mutually exclusive 26 - # (--enable-unsupported could be used to force the build) 26 + # "-DALLOW_UNSUPPORTED=ON" could be used to force the build. 27 27 assert !cppSupport || !mpiSupport; 28 28 29 29 let ··· 90 90 ++ lib.optional javaSupport "-DHDF5_BUILD_JAVA=ON" 91 91 ++ lib.optional usev110Api "-DDEFAULT_API_VERSION=v110" 92 92 ++ lib.optionals threadsafe [ 93 - "-DDHDF5_ENABLE_THREADSAFE:BOOL=ON" 93 + "-DHDF5_ENABLE_THREADSAFE:BOOL=ON" 94 94 "-DHDF5_BUILD_HL_LIB=OFF" 95 95 ] 96 96 # broken in nixpkgs since around 1.14.3 -> 1.14.4.3
+4 -1
pkgs/top-level/all-packages.nix
··· 3139 3139 cppSupport = false; 3140 3140 }; 3141 3141 3142 - hdf5-threadsafe = hdf5.override { threadsafe = true; }; 3142 + hdf5-threadsafe = hdf5.override { 3143 + cppSupport = false; 3144 + threadsafe = true; 3145 + }; 3143 3146 3144 3147 heaptrack = kdePackages.callPackage ../development/tools/profiling/heaptrack { }; 3145 3148