gmic-community icon indicating copy to clipboard operation
gmic-community copied to clipboard

Extract_foreground error

Open magowjzeta opened this issue 7 months ago • 7 comments

When I use the "extract foreground (interactive)" function, I get the following result:

*** Error in ./fx_extract_foreground/*foreach/*substitute/x_segment/ *** Command 'x_segment': No display available.

I'm on linux ubuntu studio 24.04, Gimp installed in flatpak (version 3.0.2) and g'mic in flatpak as well (G'MIC org.gimp.GIMP.Plugin.GMic 3.5.2 3 system).

I also have g'mic installed from .deb and if I launch it from the console it works correctly...

magowjzeta avatar Apr 20 '25 13:04 magowjzeta

That's because your G'MIC plug-in has been compiled without display support. It has been disabled by the flatpak maintainer who compiled G'MIC. I suggest you report your issue to him, as we cannot do anything from our side (the binaries we provide on our website enables display capabilities for G'MIC, by default).

dtschump avatar Apr 22 '25 08:04 dtschump

OK, then. Sorry to have bothered you for nothing, and thanks for the information. I'll pass the bug on to the flatpak maintainer.

magowjzeta avatar Apr 22 '25 08:04 magowjzeta

No problem :) Feel free to post the link to the issue here, as I'm interested by their feedback!

dtschump avatar Apr 22 '25 08:04 dtschump

I'll take care of that in the afternoon, and I'll post you their reply. ;-)

magowjzeta avatar Apr 22 '25 08:04 magowjzeta

That's because your G'MIC plug-in has been compiled without display support. It has been disabled by the flatpak maintainer who compiled G'MIC.

How as it been disabled since the only option deliberately passed to cmake are

                "-DGMIC_QT_HOST=gimp3",
                "-DENABLE_SYSTEM_GMIC=OFF",
                "-DCMAKE_BUILD_TYPE=Release"

If you mean there should be an opt-in, maybe that's an incorrect default.

Otherwise please explain "display support" given that the Qt UI does appear properly.

hfiguiere avatar Apr 25 '25 02:04 hfiguiere

G'MIC display support is not related to Qt, as Qt is used only by the G'MIC-Qt plug-in. G'MIC itself (I mean the libgmic library) is able to open windows and manage user events, but for this, it does not use Qt, but lower-level display libraries as X11 (on Unix), or GDI32 (on Windows). A SDL3 port is currently being made, but it's not complete to date.

In the gmic_qt.pro file, you can see the flags set to manage this :

win32 {
  DEFINES += _IS_WINDOWS_
  DEFINES += cimg_display=2
  LIBS += -mwindows -lpthread -DPSAPI_VERSION=1 -lpsapi -lgdi32 -Wl,--stack,16777216
  message( Windows/GDI32 platform )
}

unix:!macx {
  DEFINES += _IS_UNIX_
  equals( SDL3, "on") { # SDL3
    DEFINES += cimg_display=3
    PKGCONFIG += sdl3
    message( Unix/SDL3 platform )
  } else { # (X11)
    DEFINES += cimg_display=1
    PKGCONFIG += x11
    message( Unix/X11 platform )
  }
}

I'm not sure you use gmic_qt.pro to compile the flatpak version of G'MIC-Qt, or if you use the CMakeLists.txt file (I've never used the latter, so it may happen that the flags are incorrectly defined by default for this one, in which case this needs a fix, but I don't know how to do that). It happens that a few filters of G'MIC-Qt use the G'MIC display capability (as Extract foreground, as mentionned by OP), so this feature must be enabled when compiling the G'MIC part for these filters to work (basically when compiling file gmic.cpp during the G'MIC-Qt compilation process). We also allows the display support to be disabled ( cimg_display=0) when compiling, so that G'MIC (in particular the CLI tool gmic ) can still be compiled and used on, e.g. servers and architectures like that.

I hope my explanations are clear. Thanks Hubert.

dtschump avatar Apr 25 '25 05:04 dtschump

It's not a compilation problem. It's just an assumption problem. It expect X11. GIMP 3.0 runs on top of Wayland. If I disable Wayland (on the flatpak) the specific problem is gone.

BTW it's not built using qmake. It's built using CMake.

hfiguiere avatar Apr 25 '25 17:04 hfiguiere