Repository: Homebrew/homebrew-core

Issue #117869: libarchive 3.6.2 has bugs
Created: 2022-12-11T11:11:10Z
brew gist-logs <formula> link OR brew config AND brew doctor output
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew

Warning: Suspicious https://github.com/Homebrew/homebrew-core git origin remote found.
The current git origin is:
  https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/homebrew-core
Verification

 I ran brew update and am still able to reproduce my issue.
 I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?
a cmake project using libarchive:
cmake
 pkg_check_modules(PKG_CONFIG_LIBARCHIVE libarchive)

What happened (include all command output)?
prefix=/usr/local/Cellar/libarchive/3.6.2
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.6.2
Cflags: -I${includedir}
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L${libdir} -larchive
Libs.private: -lexpat -llzma -lzstd -llz4 -lb2 -lbz2 -lz
Requires.private: iconv

Starting with 3.6.2 iconv is now in Requires.private, which breaks pkgconf because iconv doesn't install a .pc file.
-- Checking for module 'libarchive'
-- Package 'iconv', required by 'libarchive', not found

Reference:libarchive/libarchive#1766
What did you expect to happen?
cmake can successfully invoke pkg_check_modules(PKG_CONFIG_LIBARCHIVE libarchive)
Step-by-step reproduction instructions (by running brew commands)
brew install libarchive

Duplicate issue #120526: pkg-config for libarchive
Created: 2023-01-13T14:22:11Z
brew gist-logs <formula> link OR brew config AND brew doctor output
brew config


HOMEBREW_VERSION: 3.6.18
ORIGIN: https://github.com/Homebrew/brew
HEAD: 106af035578d5f8716ae9510c1f9ad8c19f73a79
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ab0f7adb1367bd263063c15cf2b14d290a1658e5
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 20
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 20-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.39.0 => /opt/homebrew/bin/git
Curl: 7.85.0 => /usr/bin/curl
macOS: 13.1-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: N/A
Rosetta 2: false


brew doctor

Your system is ready to brew.
Verification

 My "brew doctor output" says Your system is ready to brew. and am still able to reproduce my issue.
 I ran brew update and am still able to reproduce my issue.
 I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?
Running some build automation checks whether libarchive is installed using pkg-config --exists libarchive, and fails because pkg-config returns 1 even when I have updated the PKG_CONFIG_PATH environment variable to point to the libarchive.pc file as described in brew info libarchive.
What happened (include all command output)?
pkg-config appears to be able to see the package when queried with --modversion, but it returns 1 (false) when asked if the package exists using the --exists option.
What did you expect to happen?
I expect pkg-config to return 0 when the package is installed and the .pc file is on the PKG_CONFIG_PATH.
Step-by-step reproduction instructions (by running brew commands)
brew install libarchive
echo ' export PKG_CONFIG_PATH="/opt/homebrew/opt/libarchive/lib/pkgconfig"' >> ~/.zshrc
source ~/.zshrc


pkg-config --modversion libarchive
# 3.6.2

pkg-config --exists libarchive; echo $?
# 1
I've tried this on two separate Macs, both running Ventura 13.1 (22C65).

Closing comment (2023-01-13T15:49:15Z): I think that makes this related to #117869.  The work-around is good for me for now. Can I keep this issue open to track the bug?
The workaround from that issue (for those who need it and find this thread googling) is to remove Requires.private: iconv from /opt/homebrew/opt/libarchive/lib/pkgconfig/libarchive.pc. You might need to do chmod +w first.