The Computer Oracle

Homebrew packages in PKG_CONFIG_PATH

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dream Voyager Looping

--

Chapters
00:00 Homebrew Packages In Pkg_config_path
00:29 Accepted Answer Score 17
02:00 Answer 2 Score 0
02:16 Thank you

--

Full question
https://superuser.com/questions/623807/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #homebrew

#avk47



ACCEPTED ANSWER

Score 17


Convert the find to a static list colon : separated PKG_CONFIG_PATH list to reduce launch time.

Step 1. Run pkg-config --list-all to determine what packages are already know by

pkg-config --list-all
# tidy tidy - tidy - HTML syntax checker
# tesseract tesseract - An OCR Engine
# …

Step 2. Run find to determine the pkgconfig directories that contain *.pc files.

### long form `find`
find /usr/local/Cellar -name 'pkgconfig' -type d | grep lib/pkgconfig | tr '\n' ':' | sed s/.$//
find /usr/local/Cellar -name 'pkgconfig' -type d | grep share/pkgconfig | tr '\n' ':' | sed s/.$//
# - or -
find /usr/local/Cellar -name 'pkgconfig' -type d | grep pkgconfig | tr '\n' ':' | sed s/.$//
### short form `find`
find / -name "pkgconfig" -print
# /usr/local/Cellar/abc/0.1.5/lib/pkgconfig:…/usr/local/Cellar/xyz/2.6/lib/pkgconfig

Step 3. Add the paths libraries of interest, that are not already discoverable by pkg-config, to PKG_CONFIG_PATH.

Option: use a /usr/local/Cellar/… path which will need to be updated with each version number change.

export PKG_CONFIG_PATH=/usr/local/Cellar/abc/0.1.5/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/abc/0.1.5/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/my/build/from/source/mmmm/0.1.5/lib/pkgconfig

Options: When the Cellar is linked (typically) into /usr/local/opt/… then a version independent path can be found and used.

sudo find / -name "uvw" -print
# /usr/local/Cellar/uvw
# /usr/local/opt/uvw
ls -l /usr/local/opt/uvw
# /usr/local/opt/uvw@ -> ../Cellar/uvw/4.2_1

Set these:

export PKG_CONFIG_PATH=/usr/local/opt/uvw/share/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/xyz/lib/pkgconfig

Note: Apple ARM and Apple Intel have different homebrew Cellar locations.

  • Apple ARM: /opt/homebrew/Cellar
  • Apple Intel: /usr/local/Cellar



ANSWER 2

Score 0


I had a similar issue in Mac Mojave as /usr/include is gone under Xcode 10, and you have to install a separate package to get it back.

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

source: https://github.com/r-lib/xml2/issues/232