GIMP 2.99.19 RC0 - pkgconfig is missing "-lgimpui-3.0 -lgimpwidgets-3.0" during meson build and install
Environment/Versions
- GIMP version: 2.99.19 RC0
- Package: git clone https://gitlab.gnome.org/GNOME/gimp.git , at PR latest 2024-02-28
- Operating System: Linux, 64bit, Mageia 9
Description of the bug
This problem likely does not affect gimp plug-ins built and included with gimp-2.99 since those plugins use variables like #include "libgimpui.h". This problem definitely affects externally built gimp plug-ins that need to use variables like #include <libgimpui.h>.
While attempting to first build a gimp-2.99 external gimp-fix-ca "plug-in" that uses preview, it ran into a problem and stopped at:
fix-ca.c: In function ‘fix_ca_help’:
fix-ca.c:1334:38: warning: unused parameter ‘help_id’ [-Wunused-parameter]
1334 | static void fix_ca_help(const gchar *help_id, gpointer help_data) {
| ~~~~~~~~~~~~~^~~~~~~
fix-ca.c:1334:56: warning: unused parameter ‘help_data’ [-Wunused-parameter]
1334 | static void fix_ca_help(const gchar *help_id, gpointer help_data) {
| ~~~~~~~~~^~~~~~~~~
CCLD fix-ca
/usr/bin/ld: fix-ca.o: in function `preview_update':
/mnt/a/boinc/gimp/0/fix-ca.c:563: undefined reference to `gimp_preview_get_position'
/usr/bin/ld: /mnt/a/boinc/gimp/0/fix-ca.c:564: undefined reference to `gimp_preview_get_size'
/usr/bin/ld: /mnt/a/boinc/gimp/0/fix-ca.c:604: undefined reference to `gimp_preview_draw_buffer'
This first problem was solved by artificially adding " -lgimpui-3.0"
Trying to build the external gimp-fix-ca plug-in again, it then stopped at:
fix-ca.c:1250:19: warning: conversion from ‘double’ to ‘gint’ {aka ‘int’} may change value [-Wfloat-conversion]
1250 | x_red_2 = floor (x_red_d);
| ^~~~~
fix-ca.c: In function ‘fix_ca_help’:
fix-ca.c:1334:38: warning: unused parameter ‘help_id’ [-Wunused-parameter]
1334 | static void fix_ca_help(const gchar *help_id, gpointer help_data) {
| ~~~~~~~~~~~~~^~~~~~~
fix-ca.c:1334:56: warning: unused parameter ‘help_data’ [-Wunused-parameter]
1334 | static void fix_ca_help(const gchar *help_id, gpointer help_data) {
| ~~~~~~~~~^~~~~~~~~
CCLD fix-ca
/usr/bin/ld: fix-ca.o: undefined reference to symbol 'gimp_dialog_new'
/usr/bin/ld: /usr/lib64/libgimpwidgets-3.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:529: fix-ca] Error 1
make[2]: Leaving directory '/mnt/a/boinc/gimp/0'
make[1]: *** [Makefile:582: all-recursive] Error 1
make[1]: Leaving directory '/mnt/a/boinc/gimp/0'
make: *** [Makefile:423: all] Error 2
[boinc@genesis 0 (master)]$
this problem was then solved by artificially adding " -lgimpwidgets-2.0".
The problem here is that gimp-2.99 development tools does not export the missing GIMP_LIBS "-lgimpui-3.0 -lgimpwidgets-3.0".
GIMP_LIBS = -lgimp-3.0 -lgimpbase-3.0 -lgimpcolor-3.0 -lgimpconfig-3.0 -lgimpmath-3.0 -lgdk_pixbuf-2.0 -lcairo -lgegl-0.4 -lgegl-npd-0.4 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lbabl-0.1
You can compare this with gimp-2.10 which does export both of them "-lgimpui-2.0 -lgimpwidgets-2.0".
GIMP_LIBS = -lglib-2.0 -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgegl-0.4 -lgegl-npd-0.4 -lm -lglib-2.0 -ljson-glib-1.0 -lbabl-0.1 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype
Reproduction
Is the bug reproducible? Yes, Always
Reproduction steps:
First build and install the latest gimp-2.99.19
- git clone https://gitlab.gnome.org/GNOME/gimp.git
- cp -pR gimp.git scratchpad
- cd scratchpad
- meson setup _build
- ninja -C _build
- sudo ninja -C _build install
- cd ..
Then build an external gimp plugin:
- You will need an external 3rd-party plugin. Please go to "https://github.com/JoesCat/gimp-fix-ca/tree/test-gimp--2.99" and download the branch test-gimp--2.99 - this is a sort-of work-in-progress that demonstrates the problem on gimp-2.99 (note the master branch runs okay on gimp-2.10 which you can use for comparing the flags and libs).
- If you do not have these, download autoconf, automake, gettext, so that you can build gimp-fix-ca. Then at the command line run:
- autoreconf -i
- automake (you might need to include --add-missing)
- ./configure (please check the output results, you should notice that pkgconfig did not provide the missing "-lgimpui-3.0 -lgimpwidgets-3.0".
- make (please note at this point, you should see a lot of errors with object file not finding links, as mentioned in first problem).
- let's now artificially include "-lgimpui-3.0" to fix the first problem.
- kwrite configure.ac (or use your preferred text editor, like gedit, notepad, ...etc).
- goto line 169 and remove the leading '#' by changing '#GIMP_LIBS="${GIMP_LIBS} -lgimpui-3.0"' to 'GIMP_LIBS="${GIMP_LIBS} -lgimpui-3.0"'.
- save configure.ac and then rebuild ./configure by doing this again...
- autoreconf -i
- automake
- ./configure (you will notice GIMP_LIBS now includes ' -lgimpui-3.0' at the end of the string.
- make (please note it fixed the first problem, but we still have the second problem left to fix).
- kwrite configure.ac
- goto line 170 and remove the leading '#' by changing '#GIMP_LIBS="${GIMP_LIBS} -lgimpwidgets-3.0"' to 'GIMP_LIBS="${GIMP_LIBS} -lgimpwidgets-3.0"'.
- save configure.ac and then rebuild ./configure by doing this again...
- autoreconf -i
- automake
- ./configure (you will notice GIMP_LIBS now includes ' -lgimpwidgets-3.0' at the end of the string.
- make (please note that it should build okay now)
- if you want to go ahead and install it, then go:
- sudo make install
- if you want to test gimp-fix-ca, you will need an RGB/RGBA type of picture and you can try...
- gimp-2.99 img-fix-ca/full-branches.jpg (or use any other picture you like)
- go to filters/color and you should see Chromatic Aberration added in the menu (you can click it if you want, but it will not run since the gimp widget stuff needs more work to get this to run properly on gimp-2.99).
- to remove gimp-fix-ca then go
- sudo make uninstall
…
Expected result: expect to autoreconf -i;automake;./configure;make without build errors
Actual result: due to the missing export of "-lgimpui-3.0 -lgimpwidgets-3.0", the above steps produce build errors.
Additional information
on webpage: https://github.com/JoesCat/gimp-fix-ca/tree/test-gimp--2.99
- The master branch contains a working gimp-2.10 version of gimp-fix-ca you can see for what the eventual build should be.
- The branch test-gimp--2.99 contains the work in progress for gimp-2.99 which currently fails at the two errors shown above.
- The gimp used at this time was gimp-2.99.19 with latest PRs for 2024-02-28.