4

I tried to install meld on my iMac running OS/X 10.13.1 High Sierra.

brew cask install meld

and homebrew completed without error, but when I tried to run it I saw

$ meld check1ping.sh check2pings.sh
frozen: ImportError
Cannot import: GTK+
dlopen(/Applications/Meld.app/Contents/Resources/lib/python2.7/gi/_gi.so, 2): Symbol not found: _inflateValidate
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib
  Expected in: /Applications/Meld.app/Contents/Frameworks/libz.1.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib

I note the questions How do I fix melds 'Cannot import: GTK+' error caused by missing 'gi.repository'? and Meld error "Cannot import: GTK+; No module named repository" but this problem seems to be different.

I found this page which suggests that /Applications/Meld.app/Contents/Frameworks/libz.1.dylib is out of date. This is what I saw in /Applications/Meld.app/Contents/Frameworks:

-rwxr-xr-x  1 myusername  staff   127692  4 May  2016 libz.1.2.8.dylib
lrwxr-xr-x  1 myusername  staff       16 16 Nov 15:24 libz.1.dylib -> libz.1.2.8.dylib

Looking for a replacement, I found:

lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.1.3.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.11.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.5.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.8.dylib -> libz.1.dylib
-rwxr-xr-x  1 root  wheel  186432 25 Oct 17:37 /usr/lib/libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.dylib -> libz.1.dylib

and when I replaced the libz.1.dylib in my meld app with this one, everything magically worked.

My question is: how do I fix homebrew so that it picks up the correct version of the library, so future users don't have this problem?

I see that brew cask cannot build from source and always installs from a binary, so I'm a bit surprised that it seems to have the wrong library version. I found the meld ruby file but am none the wiser. I know nothing about specifying brew or cask builds, I'm afraid.

Thanks!

emrys57
  • 6,679
  • 3
  • 39
  • 49
  • This is now fixed. I have realized that while to update casks you use `brew update`, not `brew cask update`, to _upgrade_ casks you have to run `brew cask upgrade`, not just `brew upgrade`. – user31389 Jan 19 '18 at 15:17
  • 1
    Hey, thanks very much for all the hard work! I'm glad I'm not the only one who can't work these *()&(*%&^*! things. If you care to add any sort of answer I will gladly tick it for you. – emrys57 Jan 19 '18 at 16:35

2 Answers2

3

Not sure if this qualifies as an answer, but here goes. First, thanks for identifying the cause of the problem, as it is one that affected me too after upgrading to MacOS High Sierra. I am not a homebrew expert, so this "answer" just formalises what you found...

unlink /Applications/Meld.app/Contents/Frameworks/libz.1.dylib
ln -s /usr/lib/libz.1.dylib /Applications/Meld.app/Contents/Frameworks/libz.1.dylib

The first line removes the symbolic link to the Meld's local libz.1.dylib (127692 bytes, dated 4 May 2016) which seemed to be at version 1.2.8. The next line recreates that symbolic link, but pointing to the global (GTK+) libz.1.dylib (186432 bytes, dated 25 October 2017), possibly version 1.2.11.

Hopefully the homebrew Meld cask maintainer will introduce a proper fix, but in the meantime, running those two commands in a terminal fixes this particular Meld problem so that Meld can run under MacOS High Sierra.

rugplots
  • 187
  • 2
  • 10
  • Yes, that's more-or-less what I did too, thanks for the explanation. What I'd actually like to understand is how the precompiled app, which I thought notionally comes complete, ended up with an incompatible library. And how to get someone from homebrew-caskroom to fix it. – emrys57 Nov 20 '17 at 19:04
2

This is now fixed upstream. All you need to do is to update the Meld cask.

Updating is a bit counterintuitive. To update the list of available casks you use brew update, not brew cask update, but to upgrade casks to the new version you use brew cask upgrade, not just brew upgrade.

So the correct sequence to update all installed casks is:

brew update
brew cask upgrade
user31389
  • 340
  • 5
  • 10