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

[BUG] Incremental builds fail: unknown "Deflate::Deflate" target #4439

Open
zachlewis opened this issue Sep 24, 2024 · 1 comment
Open

[BUG] Incremental builds fail: unknown "Deflate::Deflate" target #4439

zachlewis opened this issue Sep 24, 2024 · 1 comment

Comments

@zachlewis
Copy link
Contributor

Describe the bug

When I have OIIO find and build missing TIFF and libdeflate libraries once, there's no problem. However, if I use that same build directory for successive builds, the build system is able to find TIFF along with the other dependencies OIIO had built previously, as expected; but the build fails very shortly after, due to the TiffTargets.cmake

OpenImageIO version and dependencies
building with CMake-3.29+

OIIO 2.6.6.0dev | Linux/ARM
    Build compiler: gcc 10.2 | C++17/201703
    HW features enabled at build: neon
    No CUDA support (disabled / unavailable at build time)
Dependencies: BZip2 NONE, DCMTK NONE, FFmpeg NONE, fmt 10.2.1, Freetype 2.13.2, GIF NONE, Imath 3.1.10, JPEG 80, JXL NONE, libdeflate 1.20, Libheif NONE, libjpeg-turbo 3.0.3, LibRaw NONE, OpenColorIO 2.3.2, OpenCV
    NONE, OpenEXR 3.2.4, OpenGL, OpenJPEG NONE, PNG 1.6.44, Ptex NONE, Ptex NONE, pybind11 2.13.6, Python3 3.9.20, Qt5 NONE, Qt6 NONE, Robinmap 1.3.0, TBB NONE, TIFF 4.6.0, WebP NONE, yaml-cpp 0.8.0, ZLIB 1.2.7
Running on 20 cores 31.4GB 
    No compute specific hardware enabled.
OIIO 2.6.3.0dev | MacOS/ARM
    Build compiler: Apple clang 15.0 | C++17/201703
    HW features enabled at build: neon
    No CUDA support (disabled / unavailable at build time)
Dependencies: BZip2 1.0.8, DCMTK NONE, FFmpeg NONE, fmt 10.2.1, Freetype 2.13.2, GIF NONE, Imath 3.1.10, JPEG 80, JXL NONE, libdeflate 1.20, Libheif
    NONE, libjpeg-turbo 3.0.3, LibRaw NONE, OpenColorIO 2.3.2, OpenCV NONE, OpenEXR 3.2.4, OpenGL, OpenJPEG NONE, PNG 1.6.43, Ptex NONE, Ptex NONE, pybind11
    2.13.5, Python3 3.9.16, Qt5 NONE, Qt6 NONE, Robinmap 1.3.0, TBB NONE, TIFF 4.6.0, WebP NONE, ZLIB 1.2.12

To Reproduce

In an environment that does not have TIFF available:
Build OIIO twice in a row, using the same build directory

Steps to reproduce the behavior:

  1. Build OIIO using a persistent build directory, like /tmp/build_oiio, building all missing dependencies. The build should complete successfully, and TIFF libraries should live under /tmp/build_oiio/deps/dist/lib.
  2. Do the exact same thing again: build OIIO using the same build directory.

Evidence

After the first build completes successfully, the second build finds the freshly-made TIFF and libdeflate under <build_dir>/deps/dist/lib and elicits the following error:

  CMake Error at /tmp/build_oiio/deps/dist/lib/cmake/tiff/TiffTargets.cmake:61 (set_target_properties):
    The link interface of target "TIFF::tiff" contains:

      Deflate::Deflate

    but the target was not found.  Possible reasons include:

      * There is a typo in the target name.
      * A find_package call is missing for an IMPORTED target.
      * An ALIAS target is missing.

  Call Stack (most recent call first):
    /tmp/build_oiio/deps/dist/lib/cmake/tiff/TiffConfig.cmake:24 (include)
    /opt/_internal/pipx/venvs/cmake/lib/python3.10/site-packages/cmake/data/share/cmake-3.29/Modules/FindTIFF.cmake:103 (find_package)
    src/cmake/dependency_utils.cmake:374 (find_package)
    src/cmake/externalpackages.cmake:88 (checked_find_package)
    CMakeLists.txt:178 (include)

🔍

If I'm understanding what's happening, the Deflate::Deflate alias is only created if OIIO is building TIFF. This isn't a problem if the build system immediately finds and uses the TIFF libraries it just built; but I guess on subsequent builds, checked_find_package(TIFF) immediately finds TIFF from the first build, and never has the opportunity to invoke anything in build_TIFF.cmake.

This is a deceptively tricky issue, I think. I ran into this a few weeks ago, and pretty quickly discovered it wasn't as simple as lifting the checked_find_package(libdeflate ...) and subsequent alias_library_if_not_exists command to externalpackages.cmake, before the check for TIFF, although I can't remember what goes wrong, specifically -- just that I knew I was pretty immediately out of my depth.

🤷

I've been working around this by providing -DOpenImageIO_BUILD_LOCAL_DEPS=TIFF to CMake, forcing OIIO to always build TIFF. This works fine.

@zachlewis
Copy link
Contributor Author

See also: AcademySoftwareFoundation/openexr#1880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant