Homebrew claims cairo depends on Python - homebrew

When uninstalling the python#3.9 package, Homebrew complains that the cairo package depends on it. This is unlikely to be true:
brew uses python#3.9
lists several packages but not cairo, and
brew deps --tree cairo
shows a tree without any python#*.* in it. On the other hand,
brew uses --installed python#3.9
does list the cairo package, and commands like brew missing and brew doctor create a warning about the missing dependency python#3.9.
I don't know whether the cairo package (see its formula here) somehow depends on python#3.9, but I guess it does not, and the behavior is weird. What's going on and how can it be fixed?

I think I've found what causes the problem, inspired by a comment on an old issue on Homebrew's Github repository:
brew uses --installed uses the dependency resolution information from your installed formulae whereas brew uses alone does not.
Indeed, whereas the formula doesn't contain a dependency on python#3.9, the installed package does: on my system, the file /opt/homebrew/Cellar/cairo/1.16.0_5/INSTALL_RECEIPT.json has a key runtime_dependencies that includes this element:
{
"full_name": "python#3.9",
"version": "3.9.9",
"declared_directly": false
}
In a further comment, the developer explains:
When built from source some things pick up dependencies opportunistically i.e. they link against stuff without us trying to make them do so. The other thing where this kicks in is if you've built a formula with a particular, non-default option. We now store these links in the formula itself and use it for certain commands so you get a result that's correct for your system (i.e. brew uses --installed doesn't miss results that will break things if uninstalled).
This may not be a complete explanation (I'm pretty sure I installed cairo from a binary 'bottle' without any non-standard options), but it does suggest the general area where the issue may have arisen.
The next thing to find out is how to resolve the issue. I don't know whether there's an official workaround, but the options seem to be
Manually remove that part from INSTALL_RECEIPT.json
Uninstall the cairo package while suppressing warnings and removal of dependent packages, and then reinstall it.
I chose 1. and it seems (so far) to work.

Related

ghostview no longer works after homebrew upgrade of ghostscript

I recently did an update/upgrade with homebrew, and now gv no longer opens any of my .ps files. The Ghostscript error window that comes up says "Unknown device: x11 Error: PostScript interpreter failed in main window".
If I try gs --help, it doesn't list x11 under available devices, and the Default output device is "bbox". I tried uninstalling and reinstalling through homebrew. I tried to reinstall adding "--with-x11" but that throws the error "invalid option: --with-x11" - apparently that's no longer allowed. I've upgraded my command line code through the app store, and tried all of this again - nothing changed. I'm on High Sierra 10.13.3, using Homebrew 2.0.6, ghostscript 9.26_1, and gv 3.7.4.
I'm not a Mac developer so I'm not completely familiar with Homebrew, but it does sound like the package has been built wiithout X11 support. The fact that --help doesn't list the device is pretty clear.
I do notice from the website that in the last 30 days there have been 2 downloads of --with-x11. So possibly they've removed X11 support recently.
The only other thing I can suggest (assuming you are comfortable with compiling yourself) is to get the sources from www.ghostscript.com, untar the source tarball, then in a terminal window, from the 'ghostpdl' directory, execute ./autogen.sh, then when that is complete, execute 'make'.
Assuming you have autotools, gcc and the X11 development package, that should build a version of Ghostscript which includes X support. Looking at the Homebrew forumla, and assuming this has worked for you in the past, I think you should be able to build Ghostscript that way.
You might want to add --disable-cups --disable-compile-inits --disable-gtk --disablefontconfig --without-libidn to the ./autogen.sh command line to mimic the Homebrew formula. I'm not sure why they disable CUPS, but whatever.
Other than that, this isn't really a Ghostscript question as such, you would need to contact whoever handles the Homebrew Ghostscript distribution, which isn't any of the Ghostscript development team.
For those searching for a solution, I've put together a custom Homebrew tap that allows you to easily install GV (commonly called Ghostview, but really a derivative of it):
brew install johnhcc/gs-x11/gv
This will automatically install a version of Ghostscript with X11 enabled in the process (it is a dependency). You can optionally install the dependency by itself, it you want:
brew install johnhcc/gs-x11/ghostscript-x11
The main page is here:
https://github.com/johnhcc/homebrew-gs-x11

Where does Homebrew install fontconfig's fonts.conf?

I'm getting an error (when I run Python) that there are some obsolete entries in my Homebrew-installed fontconfig's fonts.conf, but don't know where to look for it. (I've checked the expected locations, but can't find it there.)
Where does Homebrew install fontconfig's fonts.conf?
According to this post (about a fonts.conf warning from Octave):
https://superuser.com/questions/1120758/fontconfig-warning-on-osx-when-running-octave
Homebrew places fonts.conf here: /usr/local/etc/fonts/fonts.conf
I use Homebrew, and indeed there is a fonts.conf there, but it dates from 2014 (3 years ago), despite me having just updated/upgraded brew's fontconfig (which regenerates the font cache). A search of /usr/local indicates the related files that brew does update when you do brew upgrade fontconfig are:
/usr/local/etc/fonts/fonts.conf.default
/usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf.default
I did a search of my System drive, and I also found a recent fonts.conf here: /opt/X11/lib/X11/fontconfig. That might be from XQuartz; I'm not sure.
Like you, when running Python (using matplotlib in an IPython session), I got a Fontconfig warning. The specific warning I got was: "blank doesn't take any effect anymore. please remove it from your fonts.conf." Having seen that brew didn't touch that old fonts.conf, I simply renamed it to hide it. The warning went away, and so far there have been no adverse effects. I'm guessing matplotlib is now getting its font info from one of the other files.

How can I make Homebrew and CocoAspell coexist?

After much searching on the Internet, I have never seen a satisfactory answer or explanation to the following problem. I would like to use CocoAspell for system-wide spell-checking on OS X 10.9 (plugs into TexShop, TextMate, etc.), but every time I install it, brew doctor starts throwing the following warnings:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libaspell.15.1.4.dylib
/usr/local/lib/libpspell.15.1.4.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libaspell.la
/usr/local/lib/libpspell.la
Internet searches have shown that these warnings never seem to lead to any errors, but it seems to me that there must be some way to suppress them. Partly, I like to see the Your system is ready to brew notification, but I'd also like to avoid some sort of "boy crying wolf" situation, where I become accustomed to brew doctor throwing errors.
Is there a way to either:
Install CocoAspell in another location, such that brew doesn't see it
Hide the offending dylib and .la files from brew doctor
Or enable the CocoAspell preference pane/program to access libraries installed by a brewed version of aspell
Uninstalling CocoAspell and trashing the offending files results in a clean bill of health, and performing brew install aspell results in a working version of aspell, but this doesn't help me with any of the GUI applications I prefer for LaTeX editing.
Uninstall cocoAspell completely if you installed it before.
Install aspell with homebrew or any other package manager. Don't forget the dictionaries you need. I wanted English and Czech, so I used
brew install aspell --with-lang-cs --with-lang-en
Install only the preference pane of cocoAspell. Click on "Customize" before installing and only select the "Spelling" option.
Create the directory /Library/Application Support/cocoAspell/
Make a symlink in the directory to make the preference pane aware of the available dictionaries (as the administrator):
cd /Library/Application\ Support/cocoAspell/
ln -s /usr/local/lib/aspell-0.60 Dictionaries
Make sure that /usr/local/lib/aspell-0.60 is the correct path.
The cocoAspell pref pane now shows the installed dictionaries.
Add the offending files to the white_list in doctor.rb. Mine was in /usr/local/Library/Homebrew/cmd/doctor.rb
If your's isn't there, find it with
locate doctor.rb
Look for white_list in side of def check_for_stray_dylibs, mine was on line 105. It should probably look like this.
white_list = {
"libfuse.2.dylib" => "MacFuse",
"libfuse_ino64.2.dylib" => "MacFuse",
"/usr/local/lib/libTrAPI.dylib" => "TrAPI"
}
An alternative is to install Homebrew somewhere other than /usr/local (that is, create ~/.homebrew, or /Tools/homebrew; then sudo chmod $USER /Tools/homebrew, untar Homebrew there, and add /Tools/homebrew/bin to your $PATH). That way, /usr/local is reserved for things you're installed there by some other means, rather than using Homebrew; for example the situation you describe here. Homebrew still occasionally whines about it, but you can usually ignore it.
I use Homebrew as my principal OS X package manager; I don't let it anywhere near /usr/local.
Note that this advice is the direct opposite of Homebrew's insistent dogma, which I myself find unpersuasive.

OpenCV debug install through Homebrew

I would like to to build and install OpenCV in debug mode on my Mac. I prefer do do this in Homebrew since Homebrew manages everything else in my /usr/local and is able to properly uninstall.
I have edited the Homebrew formula to add -DCMAKE_BUILD_TYPE=DEBUG to the cmake command-line.
But the main challenge now is to keep the source around after the build, or perhaps, copy the source first to a permanent location and do the build from there. I believe this is necessary to be able step into OpenCV in Xcode debugger.
Is there a simple way to do this in Homebrew? If not, are there any examples of custom formulas that do this sort of thing? I'm not very familiar with Ruby so any sample code would be helpful.

Are there multiple branches of Glib?

I'm trying to build Firefox from source and I'm getting hung up on some of the requirements.
I'm trying to build libIDL, which requires glib. I got glib built and installed to /usr/local, but when I try and configure libIDL, I get a failure at:
checking for LIBIDL... configure: error: Package requirements (glib-2.0 >= 2.4.0) were not met:
No package 'glib-2.0' found
I used the very latest version of glib that I can find, ftp://ftp.gtk.org/pub/glib/2.20/glib-2.20.3.tar.gz
However, I've also been searching around and am seeing references to libglib-2.0 such as at http://packages.debian.org/search?keywords=libglib2.0-dev
Are there 2 divergent branches of Glib, like a v1 and v2?
You need to install glib-devel in order to have the glib headers exist on your system. Without the headers, autoconf will mark the library as missing.
You installed glib from source which should have worked. The actual problem was most likely with the paths you chose to install into. The autoconf script may not be looking for glib where you installed it, or it may be looking into another directory first and finding an old version.

Resources