AcademySoftwareFoundation / openexr

The OpenEXR project provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the motion picture industry.
http://www.openexr.com/
BSD 3-Clause "New" or "Revised" License
1.6k stars 606 forks source link

fatal clang-format error on macOS can't upgrade/install via Homebrew #1737

Open GR899 opened 2 months ago

GR899 commented 2 months ago

Running on MacBook Pro Intel on macOS 11.7.10. Homebrew 4.2.19-127-g0ecac81

Trying to upgrade openexr via homebrew and receiving the following errors -- can't resolve -- please advise, unable to upgrade other packages that depend on openexr:

thanks in advance

==> Upgrading openexr
  3.2.2 -> 3.2.4 
==> cmake ..
Last 15 lines from /Users/XYZ/Library/Logs/Homebrew/openexr/01.cmake:

-- Using Imath from /usr/local/lib/cmake/Imath
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN - Success
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX - Success
-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - not found
-- OpenEXR pkg-config generation enabled
-- Configure OpenEXR 3.2.4, library API version: 31.3.2.4
-- Building OpenEXR libraries
-- Building OpenEXR tools
-- Building OpenEXR examples
-- clang-format not found.
-- Configuring incomplete, errors occurred!
meshula commented 2 months ago

Is it possible to ask at the brew issues (https://github.com/Homebrew/brew/issues) why clang-format is required in the installation process they have?

meshula commented 2 months ago

If something is misconfigured on our side, any advice they can provide is welcome.

kmilos commented 2 months ago

AFAICT, the missing clang-format is not fatal and should not stop the configuration, and might be a red herring. The actual error might be somewhere else... Could be seeing only stdout here, but not stderr?

kdt3rd commented 2 months ago

Yes, the clang-format bit is not fatal, need to see all the cmake output to know the source of the failed update, guessing it is deflate related which would be just off the last 15 lines of output?

GR899 commented 2 months ago

@meshula homebrew has said this is an openexr issue not a homebrew issue and they won't review

@kdt3rd below is the output, appears there are missing files from the distro?

Candidly this is a huge issue as this has broken a ton of stuff, including ffmpeg which I use daily and which opencv and many other packages depend.

FWIW clang functions as it should and compiles many other code.

If someone can make or please suggest fixes would appreciate it. Thanks much.

more /Users/XYZ/Library/Logs/Homebrew/openexr/01.cmake

2024-04-27 11:46:31 +0000

cmake
..
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/openexr/3.2.4
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
-Wno-dev
-DBUILD_TESTING=OFF
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk

-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang - 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/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libdeflate'
--   No package 'libdeflate' found
-- libdeflate was not found, installing from https://github.com/ebiggers/libdeflate.git (v1.18)
CMake Error at cmake/OpenEXRSetup.cmake:250 (file):
  file failed to open for reading (No such file or directory):

    /tmp/openexr-20240427-61216-hhp5r1/openexr-3.2.4/build/_deps/deflate-src/lib/lib_common.h
Call Stack (most recent call first):
  CMakeLists.txt:83 (include)

-- Using Imath from /usr/local/lib/cmake/Imath
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN - Success
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
-- Performing Test OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX - Success
-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - not found
-- OpenEXR pkg-config generation enabled
-- Configure OpenEXR 3.2.4, library API version: 31.3.2.4
-- Building OpenEXR libraries
-- Building OpenEXR tools
-- Building OpenEXR examples
-- clang-format not found.
-- Configuring incomplete, errors occurred!

HOMEBREW_VERSION: 4.2.19-127-g0ecac81
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0ecac81e330d8ea4da25611da6fef8cec3aab536
Last commit: 17 hours ago
Core tap JSON: 27 Apr 02:27 UTC
Core cask tap JSON: 27 Apr 01:33 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_BOOTSNAP: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 13.0.0 build 1300
Git: 2.32.0 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 11.7.10-x86_64
CLT: 13.2.0.0.1.1638488800
Xcode: 13.2.1

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/opt/imath/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11
HOMEBREW_GIT: git
HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/cmake/bin:/usr/local/opt/pkg-config/bin:/usr/bin:/bin:/usr/sbin:/sbin
cary-ilm commented 2 months ago

I can reproduce the problem with the above instructions. This isn't a solution, but the culprit seems to be the -DFETCHCONTENT_FULLY_DISCONNECTED=ONoption provided to cmake in the log above. At least, remove that option and it works.

meshula commented 2 months ago

FETCHCONTENT_FULLY_DISCONNECTED documentation, and our use of supplied versus fetched libdeflate is pasted below. I think it supports the theory previously noted that the issue is the availability of deflate when building for homebrew.

I stand by my original argument that the homebrew recipe is where a fix needs to lie. It's possible there's something we can do at our end, but I've read and reread the docs, and it's not clear to me what that might be.

FETCHCONTENT_FULLY_DISCONNECTED
When this option is enabled, no attempt is made to download or update any content. It is assumed that all content has already been populated in a previous run or the source directories have been pointed at existing contents the developer has provided manually (using options described further below). When the developer knows that no changes have been made to any content details, turning this option ON can significantly speed up the configure stage. It is OFF by default.

Note The FETCHCONTENT_FULLY_DISCONNECTED variable is not an appropriate way to prevent any network access on the first run in a build directory. Doing so can break projects, lead to misleading error messages, and hide subtle population failures. This variable is specifically intended to only be turned on after the first time CMake has been run. If you want to prevent network access even on the first run, use a [dependency provider](https://cmake.org/cmake/help/latest/command/cmake_language.html#dependency-providers) and populate the dependency from local content instead.

our docs talk about how to choose between a supplied libdeflate and getting cmake to fetch it.


As of OpenEXR release v3.2, OpenEXR depends on 
`libdeflate <https://github.com/ebiggers/libdeflate>`_ for
DEFLATE-based compression. Previous OpenEXR releases relied on `zlib
<https://www.zlib.net>`_. Builds of OpenEXR can choose either an
``libdeflate`` installation, or CMake can auto-fetch the source and build it
internally. The internal build is linked statically, so no extra
shared object is produced.

* ``OPENEXR_DEFLATE_REPO`` and ``OPENEXR_DEFLATE_TAG``

  The github Imath repo to auto-fetch if an installed library cannot
  be found, and the tag to sync it to. The default repo is
  ``https://github.com/ebiggers/libdeflate.git`` and the tag is
  ``v1.18``. The internal build is configured as a CMake subproject.

* ``OPENEXR_FORCE_INTERNAL_DEFLATE``

  If set to ``ON``, force auto-fetching and internal building of
  ``libdeflate`` using ``OPENEXR_DEFLATE_REPO`` and
  ``OPENEXR_DEFLATE_TAG``. This means do *not* use any existing
  installation of ``libdeflate``.
GR899 commented 2 months ago

Then, if you are convinced that homebrew is the fix can someone on your end (openEXR) please make the request? I'm doing this on macOS 11.7.10. Homebrew 4.2.19-127-g0ecac81 and this is the reporting Homebrew outputs:

-- Configuring incomplete, errors occurred!

Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!

Error: You are using macOS 11.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.

**Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.**

Do not report this issue: you are running in an unsupported configuration.

This happens every time I try to update a package that uses it: opencv, ffmpeg, jpeg-xl, etc., etc.

@cary-ilm If there is a command I can issue with my brew command, "remove that option and it works." e.g. brew install XYZ - can you please tell me what that is.

Thanks in advance to everyone who is reviewing / responding to this.

cary-ilm commented 2 months ago

Again not an ultimate solution, but if the system in question has libdeflate installed, then cmake should find it and avoid the fetch that's causing the problem. Can manage to install libdeflate independently ahead of time as a workaround?

It sounds like homebrew really doesn't like fetching content, which is something we need to resolve one way or the other.

meshula commented 2 months ago

Specifically to Cary's comment, if you first do this, does it help?

brew install libdeflate

If yes, then all we have to ask of homebrew is to update their recipe to specify that libdeflate is a dependency.

GR899 commented 2 months ago

@cary-ilm @meshula that appeared to work. Thanks very much for your input and help.

If you could ask homebrew to update their recipe to include libdeflate going forward I would appreciate it. While I've made notes for myself, once I finish testing the project I'm working on this macOS and platform, I'll be moving to macOS Sonoma against Apple Silicon for same code base.

Thanks again - +1

IronicResearch commented 1 month ago

Thanks for figuring this one out!

I encountered the same problem building 'openexr' on macOS 10.15 with clang 12.0, and initially thought the error log was choking on missing 'clang-format', except that did not resolve the actual error after successful brew install clang-format.

Good to be reminded to read the entire cmake log for the real error missing 'libdeflate', resolved by brew install libdeflate as suggested above.

meshula commented 1 month ago

Hi all, I don't have availability to go through the process documented here: https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request ~ Is anyone who uses homebrew able to take the time to work through their process for adding libdeflate to a recipe?