Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure: osl #262633

Closed
pbsds opened this issue Oct 21, 2023 · 3 comments · Fixed by #268670
Closed

Build failure: osl #262633

pbsds opened this issue Oct 21, 2023 · 3 comments · Fixed by #268670
Labels
0.kind: build failure A package fails to build

Comments

@pbsds
Copy link
Member

pbsds commented Oct 21, 2023

Steps To Reproduce

nix build github:nixos/nixpkgs/21735d31cf4b091d69f5dd24d5a06a874eb33499#osl

Build log

CMake Error at /nix/store/ljk2a5s49msk252is7zw3kwq5dxdbkdr-openimageio-2.4.15.0-dev/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake:43:
  Parse error.  Function missing ending ")".  End of file reached.
Call Stack (most recent call first):
  src/cmake/checked_find_package.cmake:127 (find_package)
  src/cmake/externalpackages.cmake:107 (checked_find_package)
  CMakeLists.txt:172 (include)


CMake Error at src/cmake/checked_find_package.cmake:127 (find_package):
  find_package Error reading CMake code from
  "/nix/store/ljk2a5s49msk252is7zw3kwq5dxdbkdr-openimageio-2.4.15.0-dev/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake".
Call Stack (most recent call first):
  src/cmake/externalpackages.cmake:107 (checked_find_package)
  CMakeLists.txt:172 (include)


-- OpenImageIO library not found 
--     Try setting OpenImageIO_ROOT ? 
--     Maybe this will help:  src/build-scripts/build_openimageio.bash 
CMake Error at src/cmake/checked_find_package.cmake:177 (message):
  OpenImageIO is required, aborting.
Call Stack (most recent call first):
  src/cmake/externalpackages.cmake:107 (checked_find_package)
  CMakeLists.txt:172 (include)

Additional context

/nix/store/ljk2a5s49msk252is7zw3kwq5dxdbkdr-openimageio-2.4.15.0-dev/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake:43 rendered in micro:

image

bumping osl to 1.13.4.0-dev did not work.

Applying AcademySoftwareFoundation/OpenShadingLanguage#1742 did not work

Notify maintainers

@Hodapp87

Metadata

  • system: "x86_64-linux"
  • host os: Linux 6.1.55, NixOS, 23.05 (Stoat), 23.05.20231011.bd1cde4
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.13.5
  • nixpkgs: /nix/store/mbz4hixfgxq5b6vc0k3pp2iglcd4c353-source
@pbsds pbsds added the 0.kind: build failure A package fails to build label Oct 21, 2023
@ShaddyDC
Copy link
Contributor

I have verified that the problem exists with the current openimageio derivation even with version 2.4.11.1, which was updated away from in June.

› rg 2.4.11.1 pkgs/development/libraries/openimageio/default.nix
19:  version = "2.4.11.1";

› nix build .#openimageio.dev -L
warning: Git tree '/home/space/repos/nixpkgs' is dirty

nixpkgs on  master via   on ☁️  (eu-central-1) took 10s 
› bat result-dev/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake | rg 'define ZLIB'
        find_dependency(ZLIB 1.3.#define ZLIB_VERSION "1.3")  # Because OpenEXR doesn't do it

I guess somehow the ZLIB_VERSION is replaced improperly here, but I've got no idea what could be causing it, and I'm really confused why it's only become a problem recently, as it doesn't look like osl has been touched in the last 3 months either.

@ShaddyDC
Copy link
Contributor

ShaddyDC commented Nov 2, 2023

I've tracked it down to this commit updating zlib, and reverting it seems to fix it.

I also believe it's a cmake issue. Consider this CMakeLists.txt file

cmake_minimum_required(VERSION 3.25)

project(test)

find_package(ZLIB)

Output:

-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin/gcc - 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: /nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /nix/store/s5gzrzha72q79v92wqq61x9ir8xiwbxk-zlib-1.3/lib/libz.so (found version "1.3.#define ZLIB_VERSION "1.3"")  
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/space/repos/tmp/build

Maybe because the header zlib.hchanged #define ZLIB_VERSION "1.2.13" to #define ZLIB_VERSION "1.3" (see diff? But if I'm reading the FindZLIB.cmake file correctly, I think it should just set the version to an empty string?

Either way, this patch seems to fix it

diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/d
efault.nix
index 9fccef25da17..12ce729b97e9 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -38,7 +38,12 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-/wukwpIBPbwnUws6geH5qBPNOd4Byl4Pi/NVcC76WT4=";
   };

-  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
+  postPatch = ''
+    # TODO Remove next patch update
+    substituteInPlace zlib.h \
+      --replace '"1.3"' '"1.3.0"'
+  '' +
+  lib.optionalString stdenv.hostPlatform.isDarwin ''
     substituteInPlace configure \
       --replace '/usr/bin/libtool' '${stdenv.cc.targetPrefix}ar' \
       --replace 'AR="libtool"' 'AR="${stdenv.cc.targetPrefix}ar"' \

I don't think it's worth raising with zlib because with the next patch version they're going to fix it anyway. It might be worth warning them in advance of 1.4.
It's probably worth raising with cmake, because they will want to support all version, and then zlib won't have to care anymore either.

I can open a PR for this tomorrow or when I have time, but don't wait for me if anybody wants to do it before.

@pbsds pbsds mentioned this issue Nov 2, 2023
14 tasks
@trofi
Copy link
Contributor

trofi commented Nov 2, 2023

Maybe because the header zlib.hchanged #define ZLIB_VERSION "1.2.13" to #define ZLIB_VERSION "1.3" (see diff? But if I'm reading the FindZLIB.cmake file correctly, I think it should just set the version to an empty string?

Nice catch! One minor note: you are looking at cmake's master branch. It seems to be already fixed there as: Kitware/CMake@9034394

We'll need that backport to nixpkgs.

UPDATE: or wait for cmake-3.27.4+ to reach master. With now cmake-3.27.7 is in staging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants