Zenn
Open30

MojaveでもまだまだHomebrewしたい!

四ツ山伊吹四ツ山伊吹

ねらい

$ brew update
==> Updating Homebrew...
Already up-to-date.

macOS Mojave(バージョン10.14)において、Homebrewで提供されるpackageを引き続き問題なく〝貯蔵〟し、このコンピュータの延命を図る。

四ツ山伊吹四ツ山伊吹

背景

$ brew doctor によれば、

Warning: You are using macOS 10.14.
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.

[抄訳]
我々開発チーム(とApple)はこの古いバージョンのOSに関してサポートを提供しない。
formulaのいくつかがビルドに失敗することが予想されるし、Homebrewがバグったり遅くなったりすることもあるだろう。

ということである。実際に手元のHomebrewでは先に挙げた事例が起こっている。

一方でやむを得ない事情のため、今後ともmacOS Mojaveの動くコンピュータでソフトウェア開発を続けなければならないため、Homebrewの利用を止めるというのは現実的ではない。

そういうわけで、どうにかこうにか誤魔化しながらHomebrewと上手くやっていく必要がある。

四ツ山伊吹四ツ山伊吹

Homebrewにおける制約

brew install および brew upgrade の振る舞い

  • ほとんどのパッケージは、公式ではbottleが提供されない。
  • したがって、新規にインストール、または更新するときに、ソースコードからビルドする必要がある。
  • 暗黙的に --build-from-source オプションが適用されるとみていい。

新しいAPI

4.0.0 — Homebrew で取り上げられている新機能

Using JSON files downloaded from formulae.brew.sh for package installation rather than local homebrew/core and homebrew/cask taps.

これは利用できない。暗黙的に HOMEBREW_NO_INSTALL_FROM_API 環境変数が設定されているものとみていい。

CA-cert

システムにインストールされているCA-certが古いことが原因でパッケージのビルドに失敗することがある。これはビルドの過程でcURLが使われているときに起こる。

ビルドエラー

どうやってもビルドできないパッケージが存在する。

四ツ山伊吹四ツ山伊吹
四ツ山伊吹四ツ山伊吹

対策

このエラーは、MojaveのCLTに同梱されているclangコンパイラのバージョンが古いために起こるようである。

あらかじめ新しめのLLVMをインストールしておき、これに含まれているclangコンパイラを代わりに使わせることでこの問題を回避できる。

四ツ山伊吹四ツ山伊吹
$ brew install llvm@15
$ brew upgrade --debug --verbose z3
[...]
BuildError: Failed executing: cmake --build build
1. raise
2. ignore
3. backtrace
4. irb
5. shell
Choose an action: 5
When you exit this shell, you will return to the menu.
bash-3.2$ rm -rf build
bash-3.2$ export PATH="$HOMEBREW_PREFIX/opt/llvm@15/bin:$PATH"
bash-3.2$ CC=clang CXX=clang++ cmake -S . -B build -DZ3_LINK_TIME_OPTIMIZATION=ON -DZ3_INCLUDE_GIT_DESCRIBE=OFF -DZ3_INCLUDE_GIT_HASH=OFF -DZ3_INSTALL_PYTHON_BINDINGS=ON -DZ3_BUILD_EXECUTABLE=ON -DZ3_BUILD_TEST_EXECUTABLES=OFF -DZ3_BUILD_PYTHON_BINDINGS=ON -DZ3_BUILD_DOTNET_BINDINGS=OFF -DZ3_BUILD_JAVA_BINDINGS=OFF -DZ3_USE_LIB_GMP=OFF -DPYTHON_EXECUTABLE=/usr/local/opt/python@3.11/bin/python3.11 -DCMAKE_INSTALL_PYTHON_PKG_DIR=lib/python3.11/site-packages -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/z3/4.12.2 -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
[...]
bash-3.2$ CC=clang CXX=clang++ cmake --build build
[...]
bash-3.2$ exit
四ツ山伊吹四ツ山伊吹
四ツ山伊吹四ツ山伊吹

brew upgrade している時、

[...]
Error: Failure while executing; `/usr/bin/env tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/592c007136b235b78c9fa8eafda449719cdea58e2a4afe18b9a445cd0050ba1b--doxygen-1.9.7.src.tar.gz --directory $HOMEBREW_TEMP/d20230524-37492-h4ujq9` exited with 1. Here's the output:
tar: Ignoring malformed pax extended attribute
tar: Ignoring malformed pax extended attribute
tar: Error exit delayed from previous errors.

となって失敗する。

四ツ山伊吹四ツ山伊吹

原因と対策

これは、macOS Mojaveに同梱されているTarユーティリティ (/usr/bin/tar) のバージョンが古いため発生する[1]。なおこの /usr/bin/tar/usr/bin/bsdtar へのシンボリックリンクとなっている。

$ /usr/bin/tar --version
bsdtar 2.8.3 - libarchive 2.8.3

$ ls -l /usr/bin/{bsd,}tar
-rwxr-xr-x  1 root  wheel  71040 May  4  2019 /usr/bin/bsdtar
lrwxr-xr-x  1 root  wheel      6 Jan  1  2019 /usr/bin/tar -> bsdtar

次の手順に従って解決できる:

  1. Homebrewから libarchive パッケージをインストール
  2. Homebrewリポジトリの Library/Homebrew/unpack_strategy/tar.rb を書き換える。
脚注
  1. cf. https://github.com/koekeishiya/yabai/issues/1216 ↩︎

四ツ山伊吹四ツ山伊吹
Library/Homebrew/unpack_strategy/tar.rb
diff --git a/Library/Homebrew/unpack_strategy/tar.rb b/Library/Homebrew/unpack_strategy/tar.rb
index 0290a02dd..1a968acfe 100644
--- a/Library/Homebrew/unpack_strategy/tar.rb
+++ b/Library/Homebrew/unpack_strategy/tar.rb
@@ -44,7 +44,7 @@ module UnpackStrategy
           path
         end
 
-        system_command! "tar",
+        system_command! "/usr/local/opt/libarchive/bin/tar",
                         args:    ["--extract", "--no-same-owner",
                                   "--file", tar_path,
                                   "--directory", unpack_dir],
四ツ山伊吹四ツ山伊吹

sdl2 パッケージ

/private/tmp/sdl2-20250114-77598-f0ttz7/SDL2-2.30.11/src/audio/coreaudio/SDL_coreaudio.m:885:36: error: use of undeclared identifier 'kAudioChannelLayoutTag_WAVE_6_1'; did you mean 'kAudioChannelLayoutTag_AAC_6_1'?
        layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   kAudioChannelLayoutTag_AAC_6_1
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudioTypes.h:1249:5: note: 'kAudioChannelLayoutTag_AAC_6_1' declared here
    kAudioChannelLayoutTag_AAC_6_1                  = (142U<<16) | 7,                       // C L R Ls Rs Cs Lfe
    ^
/private/tmp/sdl2-20250114-77598-f0ttz7/SDL2-2.30.11/src/audio/coreaudio/SDL_coreaudio.m:889:36: error: use of undeclared identifier 'kAudioChannelLayoutTag_WAVE_7_1'; did you mean 'kAudioChannelLayoutTag_AAC_7_1'?
        layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   kAudioChannelLayoutTag_AAC_7_1
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudioTypes.h:1251:5: note: 'kAudioChannelLayoutTag_AAC_7_1' declared here
    kAudioChannelLayoutTag_AAC_7_1                  = kAudioChannelLayoutTag_MPEG_7_1_B,   // C Lc Rc L R Ls Rs Lfe
    ^
2 errors generated.
make: *** [build/SDL_coreaudio.lo] Error 1
四ツ山伊吹四ツ山伊吹

原因

エラーメッセージで指摘されているように、macOS Mojave 10.14 に適用される Command Line Tools SDK が kAudioChannelLayoutTag_WAVE_6_1kAudioChannelLayoutTag_WAVE_7_1 をサポートしていないため。

四ツ山伊吹四ツ山伊吹

対応方針

ソースコードの該当箇所は以下に示すスイッチ文となっている▼

https://github.com/libsdl-org/SDL/blob/fa24d868ac2f8fd558e4e914c9863411245db8fd/src/audio/coreaudio/SDL_coreaudio.m#L883-L892

これへの応急的な対応としては、kAudioChannelLayoutTag_WAVE_6_1 を参照する case 7: と、kAudioChannelLayoutTag_WAVE_7_1 を参照する case 8: の場合について、未対応として default へ流してしまえばいい。

Homebrew の枠組みの中でこれをやるには、

  • src/audio/coreaudio/SDL_coreaudio.m に対して --debug オプションを指定することでインストール過程で利用者が割り込んで、手作業でパッチをあてる
  • core formulae の Formula/s/sdl2.rb__END__ 以降に差分を記述しておく
四ツ山伊吹四ツ山伊吹

git パッケージ

Formula/g/git.rb のこの段階で失敗する▼

Formula/g/git.rb
    # Install the netrc credential helper
    cd "contrib/credential/netrc" do
      system "make", "test"
      git_core.install "git-credential-netrc"
    end
四ツ山伊吹四ツ山伊吹

原因

Git v2.48.0 にて入った変更のうち、

* Drop support for older libcURL and Perl.

(via Git v2.48 Release Notes)

これで、macOS Mojave 10.14 に収録されている /usr/bin/perl が対応されなくなったことによる。

四ツ山伊吹四ツ山伊吹

対応

git のインストール過程で、Homebrew が古い /usr/bin/perl にかわって、最新の /usr/local/bin/perl を見つけられるようにしてあげる。

四ツ山伊吹四ツ山伊吹

netpbm パッケージ

状況

$ brew upgrade --verbose 
==> Upgrading 1 outdated package:
netpbm 11.02.12 -> 11.02.13
[...]
==> make USERGUIDE=/private/tmp/netpbm-20250304-45566-peuzic/userguide -f /private/tmp/netpbm-20250304-45566-peuzic/buildtools/manpage.mk manpages
Converting /private/tmp/netpbm-20250304-45566-peuzic/userguide/411toppm.html to 411toppm.1
make: python3: No such file or directory
make: *** [411toppm.1] Error 1
[...]
四ツ山伊吹四ツ山伊吹

エラーの発生箇所とその原因

$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/Formula/n/netpbm.rb
    mkdir buildpath/"netpbmdoc" do
      system "make", *make_args, "manpages"
      [man1, man3, man5].map(&:mkpath)
      system "make", "MANDIR=#{man}", *make_args, "installman"
    end
$ echo $PATH
/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/pkgconf/bin:/usr/local/opt/jpeg-turbo/bin:/usr/local/opt/jasper/bin:/usr/local/opt/libpng/bin:/usr/local/opt/xz/bin:/usr/local/opt/lz4/bin:/usr/local/opt/zstd/bin:/usr/local/opt/libtiff/bin:/usr/bin:/bin:/usr/sbin:/sbin

python3PATH が通っておらず、Make が外部コマンドとして認識できないことが原因か。

四ツ山伊吹四ツ山伊吹

解決策

python3PATH を通す。

$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/Formula/n/netpbm.rb
diff --git a/Formula/n/netpbm.rb b/Formula/n/netpbm.rb
index 648e135304a..afca1983d78 100644
--- a/Formula/n/netpbm.rb
+++ b/Formula/n/netpbm.rb
@@ -51,6 +51,7 @@ class Netpbm < Formula
   end
 
   def install
+    ENV["PATH"] = "#{ENV["HOMEBREW_PREFIX"]}/bin:".concat(ENV["PATH"])
     cp "config.mk.in", "config.mk"
 
     inreplace "config.mk" do |s|
四ツ山伊吹四ツ山伊吹

exiftool パッケージ

状況

折りたたみ
$ brew upgrade --verbose exiftool
==> Upgrading 1 outdated package:
exiftool 13.10 -> 13.25
[...]
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/shigeto/Library/Caches/Homebrew/downloads/cab15b40c2c3a8518b68761ecb79ecafccca2f1bf1f0189419df425d5d6d1ffb--FFI-CheckLib-0.31.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-76wak4
mv $TMPDIR/homebrew-unpack-20250319-36241-76wak4/FFI-CheckLib-0.31 $TMPDIR/exiftool--FFICheckLib-20250319-36241-1ajrnn/FFI-CheckLib-0.31
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Checking if your kit is complete...
Looks good
Writing Makefile for FFI::CheckLib
Writing MYMETA.yml and MYMETA.json
==> make install
cp lib/FFI/CheckLib.pm blib/lib/FFI/CheckLib.pm
Manifying blib/man3/FFI::CheckLib.3pm
Appending installation info to $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/darwin-thread-multi-2level/perllocal.pod
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/FFI/CheckLib.pm
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/man/man3/FFI::CheckLib.3pm
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/e2bf8e14ae91f111d7848a17930db42caff4d4de63ae3a34d31712bdf3cbafb7--File-Which-1.27.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-w5i3n6
mv $TMPDIR/homebrew-unpack-20250319-36241-w5i3n6/File-Which-1.27 $TMPDIR/exiftool--FileWhich-20250319-36241-unm2lh/File-Which-1.27
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Checking if your kit is complete...
Looks good
Writing Makefile for File::Which
Writing MYMETA.yml and MYMETA.json
==> make install
cp lib/File/Which.pm blib/lib/File/Which.pm
Manifying blib/man3/File::Which.3pm
Appending installation info to $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/darwin-thread-multi-2level/perllocal.pod
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/File/Which.pm
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/man/man3/File::Which.3pm
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/cda2d3e0714f4a985bbf78868124724269ac99eb4761a08e63890ca74ae0b2d0--Capture-Tiny-0.48.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-lbsoj
mv $TMPDIR/homebrew-unpack-20250319-36241-lbsoj/Capture-Tiny-0.48 $TMPDIR/exiftool--CaptureTiny-20250319-36241-mvkpk2/Capture-Tiny-0.48
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Checking if your kit is complete...
Looks good
Writing Makefile for Capture::Tiny
Writing MYMETA.yml and MYMETA.json
==> make install
cp lib/Capture/Tiny.pm blib/lib/Capture/Tiny.pm
Manifying blib/man3/Capture::Tiny.3pm
Appending installation info to $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/darwin-thread-multi-2level/perllocal.pod
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/Capture/Tiny.pm
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/man/man3/Capture::Tiny.3pm
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/88bb4e74a0ffc09e349212cafe7ae40ea1cd9585a31a5600bc982d5b6060ba0d--File-chdir-0.1011.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-9tydn6
mv $TMPDIR/homebrew-unpack-20250319-36241-9tydn6/File-chdir-0.1011 $TMPDIR/exiftool--Filechdir-20250319-36241-2ifk2b/File-chdir-0.1011
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Checking if your kit is complete...
Looks good
Writing Makefile for File::chdir
Writing MYMETA.yml and MYMETA.json
==> make install
cp lib/File/chdir.pm blib/lib/File/chdir.pm
Manifying blib/man3/File::chdir.3pm
Appending installation info to $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/darwin-thread-multi-2level/perllocal.pod
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/File/chdir.pm
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/man/man3/File::chdir.3pm
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/b199d10ce78024010a58cd5d885005087af903709f2cf0b83f45e18a5822821e--Path-Tiny-0.144.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-iog595
mv $TMPDIR/homebrew-unpack-20250319-36241-iog595/Path-Tiny-0.144 $TMPDIR/exiftool--PathTiny-20250319-36241-ll8cbc/Path-Tiny-0.144
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Checking if your kit is complete...
Looks good
Writing Makefile for Path::Tiny
Writing MYMETA.yml and MYMETA.json
==> make install
cp lib/Path/Tiny.pm blib/lib/Path/Tiny.pm
Manifying blib/man3/Path::Tiny.3pm
Appending installation info to $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/darwin-thread-multi-2level/perllocal.pod
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/lib/perl5/Path/Tiny.pm
Installing $HOMEBREW_CELLAR/exiftool/13.25/libexec/man/man3/Path::Tiny.3pm
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/4fa43858528f2243e61409938aae2fa327abd8f5d4ec4f3fabc5e86320327fe0--Alien-Build-2.84.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-36241-2uiwij
mv $TMPDIR/homebrew-unpack-20250319-36241-2uiwij/Alien-Build-2.84 $TMPDIR/exiftool--AlienBuild-20250319-36241-x2y4p3/Alien-Build-2.84
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
Can't locate object method "new" via package "ExtUtils::ParseXS" at ./inc/probebad.pl line 31.
Compilation failed in require at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 8.
[...]
四ツ山伊吹四ツ山伊吹

エラーの原因

$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/Formula/e/exiftool.rb
    resources.each do |r|
      r.stage do
        system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
        if r.name == "IO::Compress::Brotli"
          ENV.deparallelize { system "make", "install" }
        else
          system "make", "install"
        end
      end
    end

先ほど示したコンソール出力からは、ExifTool が要求する各 Perl モジュールのビルド過程において、Hombebrew が Alien::Build モジュールのビルドに失敗している様子がわかる。ExifTool 自身のビルドにはまだ至っていない。

これは、macOS Mojave(バージョン10.14)に附属する perl (/usr/bin/perl) のバージョンが古すぎるため。

四ツ山伊吹四ツ山伊吹

さらなるエラー

先ほどの、Alien::Build モジュールのビルドに起因するエラーは解決できている。今度は IO::Compress::Brotli モジュールのビルドの最中にエラーが発生した。

折りたたみ
[...]
/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/2b27a6e8a0e9f7c1f869c0e9288fe6fc4926bb3c0edce77042d389b393d2b85e--IO-Compress-Brotli-0.019.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-40671-bqgmxj
mv $TMPDIR/homebrew-unpack-20250319-40671-bqgmxj/IO-Compress-Brotli-0.019 $TMPDIR/exiftool--IOCompressBrotli-20250319-40671-ypc9hh/IO-Compress-Brotli-0.019
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
WARNING: EXTRALIBS is not a known parameter.
Checking if your kit is complete...
Looks good
'EXTRALIBS' is not a known MakeMaker parameter name.
Generating a Unix-style Makefile
Writing Makefile for IO::Compress::Brotli
Writing MYMETA.yml and MYMETA.json
==> make install/usr/bin/env $HOMEBREW_OPT/libarchive/bin/tar --extract --no-same-owner --file $HOME/Library/Caches/Homebrew/downloads/2b27a6e8a0e9f7c1f869c0e9288fe6fc4926bb3c0edce77042d389b393d2b85e--IO-Compress-Brotli-0.019.tar.gz --directory $TMPDIR/homebrew-unpack-20250319-40671-bqgmxj
mv $TMPDIR/homebrew-unpack-20250319-40671-bqgmxj/IO-Compress-Brotli-0.019 $TMPDIR/exiftool--IOCompressBrotli-20250319-40671-ypc9hh/IO-Compress-Brotli-0.019
==> perl Makefile.PL INSTALL_BASE=$HOMEBREW_CELLAR/exiftool/13.25/libexec
WARNING: EXTRALIBS is not a known parameter.
Checking if your kit is complete...
Looks good
'EXTRALIBS' is not a known MakeMaker parameter name.
Generating a Unix-style Makefile
Writing Makefile for IO::Compress::Brotli
Writing MYMETA.yml and MYMETA.json
==> make install
[...]
cd brotli && "$HOMEBREW_PREFIX/bin/cmake" -DCMAKE_MAKE_PROGRAM=make -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed . && make
-- The C compiler identification is AppleClang 10.0.1.10010046
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: $HOMEBREW_PREFIX/Homebrew/Library/Homebrew/shims/mac/super/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type is 'Release'
-- Performing Test BROTLI_EMSCRIPTEN
-- Performing Test BROTLI_EMSCRIPTEN - Failed
-- Compiler is not EMSCRIPTEN
-- Looking for log2
-- Looking for log2 - found
-- Configuring done (1.4s)
-- Generating done (0.6s)
-- Build files have been written to: /tmp/exiftool--IOCompressBrotli-20250319-40671-ypc9hh/IO-Compress-Brotli-0.019/brotli
[...]
[ 94%] Linking C static library libbrotlienc.a
[ 94%] Built target brotlienc
[ 97%] Building C object CMakeFiles/brotli.dir/c/tools/brotli.c.o
[100%] Linking C executable brotli
[100%] Built target brotli
Running Mkbootstrap for Brotli ()
chmod 644 "Brotli.bs"
"$HOMEBREW_CELLAR/perl/5.40.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Brotli.bs blib/arch/auto/IO/Compress/Brotli/Brotli.bs 644
"$HOMEBREW_CELLAR/perl/5.40.1/bin/perl" "$HOMEBREW_OPT/perl/lib/perl5/5.40/ExtUtils/xsubpp"  -typemap '$HOMEBREW_OPT/perl/lib/perl5/5.40/ExtUtils/typemap' -typemap '$TMPDIR/exiftool--IOCompressBrotli-20250319-40671-ypc9hh/IO-Compress-Brotli-0.019/typemap'  Brotli.xs > Brotli.xsc
mv Brotli.xsc Brotli.c
cc -c  -Ibrotli/c/include -fno-common -DPERL_DARWIN -mmacosx-version-min=10.14 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I$HOMEBREW_PREFIX/include -Wno-error=implicit-function-declaration -O3   -DVERSION=\"0.019\" -DXS_VERSION=\"0.019\"  "-I$HOMEBREW_OPT/perl/lib/perl5/5.40/darwin-thread-multi-2level/CORE"   Brotli.c
Brotli.xs:2:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
         ^~~~~~~~~~
1 error generated.
make: *** [Brotli.o] Error 1
四ツ山伊吹四ツ山伊吹

エラーの原因

IO::Compress::Brotli モジュールのビルド過程における make install が呼び出す cc のバージョンが古い。

四ツ山伊吹四ツ山伊吹

解決策

CC= で新しい clang を使ってもらう

$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/Formula/e/exiftool.rb
@@ -89,7 +91,7 @@ class Exiftool < Formula
       r.stage do
         system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
         if r.name == "IO::Compress::Brotli"
-          ENV.deparallelize { system "make", "install" }
+          ENV.deparallelize { system "make", "install", "CC=/usr/local/opt/llvm@15/bin/clang" }
         else
           system "make", "install"
         end
四ツ山伊吹四ツ山伊吹

icu4c@77 パッケージ

状況

==> Upgrading tesseract
  5.5.0 -> 5.5.0_1 
[...]
==> ./configure --disable-samples --disable-tests --enable-static --with-library-bits=64 --disable-debug --disable-dependency-tracking --prefix=$HOMEBREW_CELLAR/icu4c@77/77.1 --libdir=$HOMEBREW_CELLAR/icu4c@77/77.1/lib
[...]
==> make
[...]
measunit_extra.cpp:577:13: error: call to 'abs' is ambiguous
        if (abs(double_result - int_result) > kTolerance) {
            ^~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:132:6: note: candidate function
int      abs(int) __pure2;
         ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                           ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                           ^
1 error generated.
*** Failed compilation command follows: ----------------------------------------------------------
clang++ -std=gnu++11 -DU_ALL_IMPLEMENTATION -DU_ATTRIBUTE_DEPRECATED= -DU_I18N_IMPLEMENTATION -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=1 -I. -I../common -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++17 -fvisibility=hidden -fno-common -c -MMD -MT measunit_extra.d measunit_extra.o measunit_extra.ao -o measunit_extra.ao measunit_extra.cpp
--- ( rebuild with "/Library/Developer/CommandLineTools/usr/bin/make VERBOSE=1 all" to show all parameters ) --------
make[1]: *** [measunit_extra.ao] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all-recursive] Error 2
ログインするとコメントできます