libarchive can not be found using pkg-config despite a pc file being installed in package directory

December 04, 2023

libarchive can not be found using pkg-config despite a pc file being installed in package directory

Package was not found in the pkg-config

libarchive is not linked into the prefix by default. Follow the instructions that appear when you run brew install archive or brew info libarchive:

% brew info libarchive
[...]
==> Caveats
libarchive is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libarchive first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/libarchive/bin:$PATH"' >> ~/.zshrc

For compilers to find libarchive you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/libarchive/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/libarchive/include"

For pkg-config to find libarchive you may need to set:

Ref by : https://github.com/Homebrew/homebrew-core/issues/117642


Written by Manoj Bhardwaj who lives and works in Dharamshala Himachal Pradesh (India). My stackoverflow