Homebrew package config

Hello,

I am using Bluefin-DX and am trying to install some packages with homebrew, and I have some issues with “paths”. The only thing special about my system is that I have two users “localuser” and “myuser”. The former is the user created at installation, the latter I use daily via Active Directory integration. The only reason I mention this is because I had to change ownership of /home/linuxbrew to myuser, so this is slightly “off” to the core setup.

Anyway, not had any issues until now. I’m trying to install manim locally – EDIT: if anyone ever looks for this I documented Installing manim on Bluefin-DX here – and this needs some packages to compile, and here are the issues:

  1. The first thing I noticed is that I need to run export PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig for packages installed by brew to be picked up. Should this not be set by default by Bluefin-DX? I would expect deverlopers that run “brew install ” to then expect it to be found by pkg-config? Or is it better to guard against this and leave it to the user to explicitly control?
  2. I’ve ran “brew install cairo” but the xproto.pc file has not been properly installed and is not found (see below). It’s in the Cellar only. Is this a brew bug?
❯ pkg-config --cflags-only-I cairo
Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'x11', not found
Package 'kbproto', required by 'x11', not found
Package 'xextproto', required by 'xext', not found
Package 'xproto', required by 'xrender', not found
Package 'renderproto', required by 'xrender', not found
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found

❯ find /home/linuxbrew/.linuxbrew -name 'xproto.pc'
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/share/pkgconfig/xproto.pc

❯ brew list xorgproto
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/include/GL/ (5 files)
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/include/X11/ (124 files)
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/sbom.spdx.json
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/share/doc/ (68 files)
/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/share/pkgconfig/ (29 files)

It would seem wrong for me to append /home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/share/pkgconfig/ just for this, when everything else gets put into the top-level /home/linuxbrew/.linuxbrew/lib/pkgconfig – what if the particular version is replaced by a newer one in the Cellar? Why was this particular file not copied there? I’m forced to work like this:

❯ export PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/share/pkgconfig

❯ pkg-config --cflags-only-I cairo
-I/home/linuxbrew/.linuxbrew/Cellar/cairo/1.18.2/include/cairo -I/home/linuxbrew/.linuxbrew/Cellar/fontconfig/2.16.0/include -I/home/linuxbrew/.linuxbrew/Cellar/expat/2.6.4/include -I/home/linuxbrew/.linuxbrew/opt/freetype/include/freetype2 -I/home/linuxbrew/.linuxbrew/opt/bzip2/include -I/home/linuxbrew/.linuxbrew/opt/libpng/include/libpng16 -I/home/linuxbrew/.linuxbrew/opt/zlib/include -I/home/linuxbrew/.linuxbrew/Cellar/libxext/1.3.6/include -I/home/linuxbrew/.linuxbrew/Cellar/xorgproto/2024.1/include -I/home/linuxbrew/.linuxbrew/Cellar/libxrender/0.9.12/include -I/home/linuxbrew/.linuxbrew/Cellar/libx11/1.8.11/include -I/home/linuxbrew/.linuxbrew/Cellar/libxcb/1.17.0/include -I/home/linuxbrew/.linuxbrew/Cellar/libxau/1.0.12/include -I/home/linuxbrew/.linuxbrew/Cellar/libxdmcp/1.1.5/include -I/home/linuxbrew/.linuxbrew/Cellar/pixman/0.44.2/include/pixman-1

I do prefer to work with containers which helps me avoid this stuff, but do people actually use homebew in Bluefin-DX and how do they go about fixing these? I’m wondering if I’m missing some “source environment script by DX” due to the localuser/myuser thing, but I have verified that /etc/profile.d/brew.sh has ran and my shellenv has:

❯ env | grep BREW
HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew
HOMEBREW_CELLAR=/home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew
BREW_BASH_COMPLETION=1

Would like to here about others’ experience with DX on this.

There appears to be an error in our brew config that is affecting some people but not others, we’re still investigating: Brew: command not found on Blufin

EDIT: Just to confirm does the rest of your brew config work? Does brew doctor return an error?

So, while the command did locate some stale symbolic links, those are not related to my issues. Brew works fine for the most part. It did clean up some software I removed (this seems to be a relic from me doing brew install gcc and then removing it) but my main question has to do with PKG_CONFIG _PATH.

Mind you, I have always worked with Linux, so I don’t know what the expectation from a Mac OS perspective is. I guess for (1) it could be “expected” to have to have the user do it manually. But I would also expect all .pc files to be collected (via symlinks if needed) into the one common location (rather than having to specify it as per (2) above). The latter might actually be a packaging issue (the package does not contain the instruction to publish the package config file to the central location?)

I guess half of it is that I am not all that familiar with brew… Hence asking others (hopefully someone that moved from a Mac to Linux) about how things are “supposed” to work…

❯ brew doctor
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: Broken symlinks were found. Remove them with `brew cleanup`:
  /home/linuxbrew/.linuxbrew/lib/libatomic.so.1
  /home/linuxbrew/.linuxbrew/lib/libgcc_s.so.1
  /home/linuxbrew/.linuxbrew/lib/libgomp.so.1
  /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6
  /home/linuxbrew/.linuxbrew/lib/ruby/gems/3.4.0/bin/bundle
  /home/linuxbrew/.linuxbrew/lib/ruby/gems/3.4.0/bin/bundler

❯ brew cleanup
Pruned 6 symbolic links and 12 directories from /home/linuxbrew/.linuxbrew
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4... (5,001 files, 44.3MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.1... (2,382 files, 47MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.2... (2,391 files, 47MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3... (1,566 files, 38MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4... (1,589 files, 38.2MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1... (1,589 files, 38.2MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5... (1,596 files, 38.3MB)
Removing: /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6... (1,598 files, 38.3MB)
==> This operation has freed approximately 329.7MB of disk space.

Looking at this answer on superuser.com regarding macos, it would appear that both of the above occur on Macs as well. The users describe “find” commands to collect locations of package config files across the “cellar” and form a proper PKG_CONFIG_PATH.

I am surprised that this seems to be “normal”, but it seems that this is indeed the case…

EDIT: I have added this to my own shell profile

❯ BREW_PKG_CONFIG=$( find /home/linuxbrew/.linuxbrew -name 'pkgconfig' -type d | grep -v "Library/Homebrew/os/mac" | tr '\n' ':' )

This allows me to turn on “brew libraries” with:

~ 
❯ PKG_CONFIG_PATH=$BREW_PKG_CONFIG pkg-config --list-all

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.