Pre-compiled GIMP plug-in for OSX ready for testing

As explained in this other post, I am setting up an infrastructure on GitHub/TravisCI to compile and package some commonly used GIMP plug-ins.

The first thing I have worked on is a G’MIC GIMP plug-in for OSX, and after two weeks of struggling with the library dependencies I have finally succeeded to package a GMIC-Qt plug-in that seems to work properly with the official GIMP DMG.

As stated in the other post, the installation of the plug-in is rather simple. All one needs to do is download this archive and extract the contents in one of the following folders:

  • $HOME/Library/Application Support/GIMP/2.10/plug-ins if GIMP is installed in its default location (/Applications/GIMP-2.10.app)
  • in @GIMP_APP@/Contents/Resources/lib/gimp/2.0/plug-ins in the other cases, where @GIMP_APP@ must be replaced by the path to your GIMP app bundle.

It would be great if OSX users could try the plug-in and let me know wether it works or not for them…

@KaRo if I am not wrong you have been maintaining the OSX version of the G’MIC plugin in the past. Would you be interested to collaborate on this? Everything is available on GitHub: GitHub - aferrero2707/gimp-plugins-collection

EDIT: @David_Tschumperle I forgot to mention that I had to apply this patch to the plug-in sources in order to correctly find the additional libraries and frameworks, needed by G’MIC and not included in the GIMP bundle. The patch allows to properly detect the absolute path of the gmic_gimp_qt executable and set the QT_PLUGIN_PATH environment variable accordingly.

1 Like

That’s interesting thank you. Would it be possible you submit a pull request to the gmic-qt project on Github ? I 'm sure Sébastien (the main developer of G’MIC-Qt) would appreciate it.
Also thanks for the amazing work. I cannot test but this looks really promising :slight_smile:

1 Like

Surely I can do it. However, the folder which gets added to the QT_PLUGIN_PATH is currently very much specific to the way I am packaging the OSX plug-in. It will be up to you and Sébastien to decide if it can be taken as “the official way to go”…

Anyway, I will prepare a pull request a bit later today.

Hi, just tried your package with original. Very good, congratulations!

I never reached (and tried to reach) that point.

Still I will look into your scripts and possibly try to build some sort of bundle of gmic CLI similar to your approach for the plugin version. There are perhaps some users of it on Mac like me.

Still actually I am using MacPorts for Gimp and gmic. There is for bundles always the problem of updates…

1 Like

Glad to hear it works! It involved a bit of hacking of DYLIB loading commands, so it was not granted to work from day 0…

True. The plug-in uses a lot of libraries from the GIMP bundle, so it depends on how often the GIMP bundle is updated.

Thanks for checking!

I have built the plugin with the MacPort Libraries and had than the problem with updates in MacPorts, newer libraries compared to libraries in the Gimp bundle! I could not read from your script how you link the libraries. If you use the brew packages you might run into the same problems, Gimp builds are typically much older. I am not so keen to redirect the link library path to the Gimp bundle at build time. Maybe you have found a way?

For the CLI I think I could try to copy the necessary libraries into a folder, but what about dependencies in those libraries? Do you check them all recursively?

Yes, I found it, and that’s what took most of the time…

I actually found two very useful programs:

  • optool which allows to manipulate the DYLIB LOAD commands in the MacOS libraries
  • macdylibbundler which allows to recursively collect the run-time dependencies and patch the library paths

I have modified the first tool to also change the version information of loaded libraries. This way, I can compile the plug-in against the libraries provided by homebrew, but then let the executable link at run-time to the libraries contained in the GIMP bundle. The point is that the plug-in only uses symbols from BABL/GEGL/GIMP, so binary API compatibility is only required for those libraries. In other words, linking to a newer version of gdk_pixbuf is not a problem because the plug-in does not use gdk_pixbuf functions directly. When running, the plug-in will link to the BABL/GEGL/GIMP libraries in the GIMP bundle, and will happily use the older version of gdk_pixbuf available there.

I hope this rant is sufficiently clear… at some point I want to write a blog post to better explain my findings, which might be useful for other plug-ins as well (my next item on the list is the amazing “liquid rescale” plug-in).

The places where I use those “magic” tools are here and here. The rest is a lot of quite complicated and boring gymnastics with otool -L and install_name_tool

Thank you for the hints. I’ll see!

I think your solution is really good, what about putting it into the download page? Eg with the command to install ( wget -O - https://github.com/aferrero2707/gimp-plugins-collection/releases/download/continuous/GMIC-Gimp-2.10.6-OSX.tgz | tar -xzC ~/Library/Application\ Support/GIMP/2.10/plug-ins/ -) ?

For the cli I think I will try your macdylibbundler, not in near future but…

1 Like

Just tested the plugin with the new Gimp (2.10.8) from gimp.org on MacOS Mojave! SUCCESS!

1 Like

Excellent! This means that the build machinery work properly! Over the next days I will try to include more plugins…

1 Like

The version I used is still from Nov 6. Maybe a rebuilt would be good (for testing the automatic build machine)! At least in CImg are git changes…

@KaRo @David_Tschumperle

I have just finished improving my Travis CI scripts. Now the building/packaging procedure is fully automated: a daily cron job compares the GMIC and GMIC-Qt commit hash of the latest build with respect to the HEAD version of the corresponding repositories, and triggers a re-build whenever some newer commit is present in at least one of the two repositories.

Hence, a new MacOS plug-in package will be uploaded at most 24h after new commits are pushed to the GMIC repositories. The URL of the up-to-date package is always this one: https://github.com/aferrero2707/gimp-plugins-collection/releases/download/continuous/GMIC-Gimp-2.10-OSX.tgz

2 Likes

That’s awesome Andrea, thanks a lot !
I’ll update the G’MIC web page to link to this URL.

Really good, thank you too, large improvement for Mac user!
Still it might be good to consider as third repo CImg,for changes, in fact it is quite central for gmic.

… and tested the 141118 version against Gimp 2.10.8

David, please specify in the Download page that the links is for the Gimp 2.10 plugin.

I think you can remove the link to my page…

1 Like

You are absolutely right, I have added a check for it as well…

1 Like

David, maybe the link to partha.com should not have been removed!

Andrea:
What about gmic-cli? With the same mechanism gmic-gimp built could be activated, possibly not with 24 hours delay but 48?