Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building with GIMP3-RC2 #140

Closed
guiodic opened this issue Jan 10, 2025 · 10 comments · Fixed by #142
Closed

Error building with GIMP3-RC2 #140

guiodic opened this issue Jan 10, 2025 · 10 comments · Fixed by #142

Comments

@guiodic
Copy link

guiodic commented Jan 10, 2025

exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_pie=true -D python.bytecompile=1 --prefix /usr builddir resynthesizer
The Meson build system
Version: 1.6.1
Source dir: /home/guido/tmp/gimp3-plugin-resynthesizer-git/src/resynthesizer
Build dir: /home/guido/tmp/gimp3-plugin-resynthesizer-git/src/builddir
Build type: native build
Project name: resynthesizer
Project version: 3.0.0
C compiler for the host machine: ccache cc (gcc 14.2.1 "cc (GCC) 14.2.1 20240910")
C linker for the host machine: cc ld.bfd 2.43.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Configuring resynth-config.h using configuration
Library m found: YES
Found pkg-config: YES (/usr/bin/pkg-config) 2.3.0
Run-time dependency glib-2.0 found: YES 2.82.4
Run-time dependency gimp-3.0 found: YES 3.0.0-RC2+git
Program msgfmt found: YES (/usr/bin/msgfmt)
Program msginit found: YES (/usr/bin/msginit)
Program msgmerge found: YES (/usr/bin/msgmerge)
Program xgettext found: YES (/usr/bin/xgettext)
Build targets in project: 9

resynthesizer 3.0.0

    Installed plugin names: plugin-heal-selection
                            plugin-heal-transparency
                            plugin-map-style
                            plugin-render-texture
                            plugin-resynth-enlarge
                            plugin-resynth-fill-pattern
                            plugin-resynth-sharpen
                            plugin-uncrop
                            plugin-resynth-controls

  User defined options
    auto_features         : enabled
    b_pie                 : true
    buildtype             : plain
    libexecdir            : lib
    prefix                : /usr
    python.bytecompile    : 1
    sbindir               : bin
    wrap_mode             : nodownload

Found ninja-1.12.1 at /usr/bin/ninja
INFO: autodetecting backend as ninja                                                              
INFO: calculating backend command to run: /usr/bin/ninja -C /home/guido/tmp/gimp3-plugin-resynthesizer-git/src/builddir
ninja: Entering directory `/home/guido/tmp/gimp3-plugin-resynthesizer-git/src/builddir'
[1/15] Compiling C object lib/liblibresynthesizer-3.0.a.p/progress.c.o
In file included from ../resynthesizer/lib/progress.h:12,
                 from ../resynthesizer/lib/progress.c:12:
../resynthesizer/lib/passes.h:68:1: warning: ‘prepare_repetition_parameters’ defined but not used [-Wunused-function]
   68 | prepare_repetition_parameters(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2/15] Compiling C object lib/liblibresynthesizer-3.0.a.p/engine.c.o
In file included from ../resynthesizer/lib/engine.c:521:
../resynthesizer/lib/passes.h:55:1: warning: ‘estimatePixelsToSynth’ defined but not used [-Wunused-function]
   55 | estimatePixelsToSynth(TRepetionParameters repetition_params)
      | ^~~~~~~~~~~~~~~~~~~~~
[7/15] Compiling C object enginePlugin/resynthesizer.p/plugin.c.o
../resynthesizer/enginePlugin/plugin.c: In function ‘resynthesizer_run’:
../resynthesizer/enginePlugin/plugin.c:264:26: warning: unused variable ‘drawable’ [-Wunused-variable]
  264 |   GimpDrawable          *drawable;
      |                          ^~~~~~~~
[14/15] Compiling C object enginePlugin/resynthesizer.p/drawable.c.o
FAILED: enginePlugin/resynthesizer.p/drawable.c.o 
ccache cc -IenginePlugin/resynthesizer.p -IenginePlugin -I../resynthesizer/enginePlugin -Ilib -I../resynthesizer/lib -I/usr/include/gimp-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gegl-0.4 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gio-unix-2.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIE -DWITH_GZFILEOP -pthread '-DG_LOG_DOMAIN="Resynthesizer"' -DGIMP_COMPILATION -MD -MQ enginePlugin/resynthesizer.p/drawable.c.o -MF enginePlugin/resynthesizer.p/drawable.c.o.d -o enginePlugin/resynthesizer.p/drawable.c.o -c ../resynthesizer/enginePlugin/drawable.c
../resynthesizer/enginePlugin/drawable.c: In function ‘get_selection’:
../resynthesizer/enginePlugin/drawable.c:60:55: error: passing argument 1 of ‘gimp_item_get_image’ from incompatible pointer type [-Wincompatible-pointer-types]
   60 |   return gimp_image_get_selection(gimp_item_get_image(d));
      |                                                       ^
      |                                                       |
      |                                                       GimpDrawable * {aka struct _GimpDrawable *}
In file included from /usr/include/gimp-3.0/libgimp/gimp_pdb_headers.h:66,
                 from /usr/include/gimp-3.0/libgimp/gimp.h:76,
                 from ../resynthesizer/enginePlugin/drawable.c:8:
/usr/include/gimp-3.0/libgimp/gimpitem_pdb.h:44:66: note: expected ‘GimpItem *’ {aka ‘struct _GimpItem *’} but argument is of type ‘GimpDrawable *’ {aka ‘struct _GimpDrawable *’}
   44 | GimpImage*    gimp_item_get_image           (GimpItem           *item);
      |                                              ~~~~~~~~~~~~~~~~~~~~^~~~
../resynthesizer/enginePlugin/drawable.c:60:10: error: returning ‘GimpSelection *’ {aka ‘struct _GimpSelection *’} from a function with incompatible return type ‘GimpDrawable *’ {aka ‘struct _GimpDrawable *’} [-Wincompatible-pointer-types]
   60 |   return gimp_image_get_selection(gimp_item_get_image(d));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

@bootchk
Copy link
Owner

bootchk commented Jan 10, 2025

Thanks.

GimpDrawable is a subclass of GimpItem. Using GObject classes, you often need to cast.
An upcast, casting a subclass to a superclass when calling a method of the superclass.

I think gimp_item_get_image( (GimpItem*) d) would fix it.

I think it compiled without error and worked before, when compiled not checking for incompatible pointer types.
Maybe you are using a newer compiler version than the last time it was built.

I could be wrong, this is just my initial diagnosis.
It might take me a few days to actually try.

@mcepl
Copy link

mcepl commented Jan 17, 2025

With this change on resynthesizer3 branch:

--- a/enginePlugin/drawable.c
+++ b/enginePlugin/drawable.c
@@ -57,7 +57,7 @@ get_selection(GimpDrawable * d)
   // selection is a new drawable derived from image of a drawable
   // TODO this is not right for v3 ??
   // return gimp_image_get_selection(gimp_item_get_image(d->drawable_id));
-  return gimp_image_get_selection(gimp_item_get_image(d));
+  return gimp_image_get_selection(gimp_item_get_image((GimpItem*)d));
 }
 
 gboolean

I get this error while building:

[   20s] cc -IenginePlugin/resynthesizer.p -IenginePlugin -I../enginePlugin -Ilib -I../lib -I/usr/include/gimp-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gegl-0.4 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gio-unix-2.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -DOPENSSL_LOAD_CONF -pthread '-DG_LOG_DOMAIN="Resynthesizer"' -DGIMP_COMPILATION -MD -MQ enginePlugin/resynthesizer.p/drawable.c.o -MF enginePlugin/resynthesizer.p/drawable.c.o.d -o enginePlugin/resynthesizer.p/drawable.c.o -c ../enginePlugin/drawable.c
[   20s] ../enginePlugin/drawable.c: In function ‘get_selection’:
[   20s] ../enginePlugin/drawable.c:60:10: error: returning ‘GimpSelection *’ {aka ‘struct _GimpSelection *’} from a function with incompatible return type ‘GimpDrawable *’ {aka ‘struct _GimpDrawable *’} [-Wincompatible-pointer-types]
[   20s]    60 |   return gimp_image_get_selection(gimp_item_get_image((GimpItem*)d));
[   20s]       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Full build log with all versions of packages used and steps taken to reproduce.

@bootchk
Copy link
Owner

bootchk commented Jan 18, 2025

Probably a similar fix as earlier in the thread.

Cast the result (GimpDrawable*)

A selection is a mask, a pixmap where every pixel is an 8-bit degree of selection.
I believe it is a subclass of GimpDrawable, which loosely speaking is a generic pixmap,
specialized by a subclass to hold certain format of pixel.
Something that draw methods work on.

I would guess that the class GimpSelection is a relatively recent change to GIMP.

@mcepl
Copy link

mcepl commented Jan 18, 2025

OK, that helped. Now, I have only a problem with meson install. Even thought I specify libdir in my meson setup:

[   22s] + /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 \
  --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include \
  --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info \
  --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var \
  --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-suse-linux

meson installs into /usr/lib/x86_64-linux-gnu instead of /usr/lib64:

[   24s] + DESTDIR=/home/abuild/rpmbuild/BUILDROOT/gimp-plugin-resynthesizer-20240821.12a967d-0.x86_64
[   24s] + /usr/bin/meson install -C x86_64-suse-linux --no-rebuild
[   24s] Installing enginePlugin/resynthesizer to /home/abuild/rpmbuild/BUILDROOT/gimp-plugin-resynthesizer-20240821.12a967d-0.x86_64/usr/lib/x86_64-linux-gnu/gimp/2.99/plug-ins/resynthesizer

Complete build log

Should I open a new ticket?

@bootchk
Copy link
Owner

bootchk commented Jan 19, 2025

Yes please open a new ticket.
Since this ticket is about compile time errors and the new issue is about meson?

I usually avoid messing with the prefix, instead let meson decide where to find/install many things, from platform standard places.

This builds a library and installs it in the usual place for libraries. The engine plugin uses the library. The engine plugin executable is installed where GIMP app expects to find it.

Not sure about meson... is libdir telling where libraries might be found, or should be installed?

Also, what is the platform? I recall a path like that on Ubuntu, which I think is slightly different from other distributions re the "standard" for directory structure.

I have started to build the branch. Again, for the first time in a long time. But , for now, away from my build computer.

@bootchk
Copy link
Owner

bootchk commented Jan 19, 2025

The build seems to stop at the step: install the .scm scripts.

One problem is it references the dir ../gimp/2.0/... but that should be 3.0 if building with GIMP3.0rc1 or later.
That is the destination.

The scripts should be installed in the user's configuration directory for GIMP.
In the subdir /plug-ins.
Each script in its own directory, named the same as the script, less the suffix .scm.
Since the scripts are now independently interpreted (they have a shebang, newish in GIMP 3).

(Alternately, they could be installed in /scripts, the "old-style".
I can explain more if needed.)

I don't know why "x86-64" is part of the path.

I don't know the causes yet, and unable to test myself until back at my dev computer.

@bootchk
Copy link
Owner

bootchk commented Jan 19, 2025

The cause is that the top resynthesizer/meson.build incorrectly
defines the meson variable gimpplugindir.
It is "hardcoded" for Ubuntu and GIMP 2.99, when I first wrote these build files.

The build file should do something more general and sophisticated:
find where GIMP is installed, and fabricate a similar path to the user's config directory.
For example, if the GIMP app's system-wide (for all user's) config directory is /usr/lib/share/GIMP/3.0/.config/...
then a similar path to the current user's similar config dir for GIMP: /home//.config/GIMP/3.0/plug-ins.
Don't take those examples as correct, I am just guessing and giving an overview.

You can probably hardcode a path that works for you.

If you find a more general fix, please submit an MR.

A more general fix requires more knowledge of meson, how to declare in meson the path to a user's config directory,
for the GIMP app.

@mcepl
Copy link

mcepl commented Jan 21, 2025

I have opened #141, and I will continue the discussion there. In terms of pure building of binaries, I think, we are done here.

@mcepl mcepl mentioned this issue Jan 21, 2025
@bootchk
Copy link
Owner

bootchk commented Jan 21, 2025

Thank you SO much.

I was able to build the resynthesizer3 branch on Ubuntu 24.04 and its clang compiler with warnings where you cited errors.
What compiler is your Opensuse build using, where what formerly were warnings are now elevated to errors?
Just curious.

Anyway, thanks for fixing and I will merge soon.

I also am not sure the install of the .scm scripts is correct, or that the scripts themselves are correct. I will work on that.

Also, I think your patch installs a built resynthesizer to the directories for all users?
Which I am OK with.
But it means that if a user upgrades their GIMP, they lose their resynthesizer install?
An install of resynthesizer should survive an upgrade of GIMP.
At least minor upgrades, until they upgrade to GIMP 4.
That is the intent anyway.
I need to think about it more.
Most users will not be building resynthesizer, so not too important a question.

Is your role as a maintainer of the resynthesizer package on OpenSuse.
I suppose a builder in that role wants to install in the "system" directories, for all users.

@bootchk
Copy link
Owner

bootchk commented Jan 22, 2025

Fixed by MR #142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants