Error compiling G'Mic on linux

Hello,

I’m trying to compile G’Mic on ubuntu 18.04 amd64, but it fails.
I used the following, then make :
cmake … -DGMIC_QT_HOST=gimp -DGMIC_PATH=/home/fabien/Programmes/gmic/src -DCMAKE_BUILD_TYPE=Release

Result :
/home/fabien/Programmes/gmic/src/gmic.cpp: In static member function ‘static const cimg_library::CImg& gmic::decompress_stdlib()’:
/home/fabien/Programmes/gmic/src/gmic.cpp:2357:59: error: ‘data_gmic_stdlib’ was not declared in this scope
CImgList::get_unserialize(CImg(data_gmic_stdlib,1,size_data_gmic_stdlib,1,1,true))[0].
^~~~~~~~~~~~~~~~
/home/fabien/Programmes/gmic/src/gmic.cpp:2357:78: error: ‘size_data_gmic_stdlib’ was not declared in this scope
gList::get_unserialize(CImg(data_gmic_stdlib,1,size_data_gmic_stdlib,1,1,true))[0].
^~~~~~~~~~~~~~~~~~~~~
CMakeFiles/gmic_gimp_qt.dir/build.make:1642: recipe for target ‘CMakeFiles/gmic_gimp_qt.dir/home/fabien/Programmes/gmic/src/gmic.cpp.o’ failed
make[2]: *** [CMakeFiles/gmic_gimp_qt.dir/home/fabien/Programmes/gmic/src/gmic.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/gmic_gimp_qt.dir/all’ failed
make[1]: *** [CMakeFiles/gmic_gimp_qt.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

Do you have any idea what is wrong ?
Thanks for your help

Please check the content of the file gmic_stdlib.h . It should not be empty.
If it looks weird, try a make clean first in src/, and try again.

This using kubuntu 16.04

Very similar but just for the gmic_gimp plugin.

…/gmic/src/gmic.cpp:2357:78: error: ‘size_data_gmic_stdlib’ was not declared in this scope
CImgList::get_unserialize(CImg(data_gmic_stdlib,1,size_data_gmic_stdlib,1,1,true))[0].
^
Makefile:1669: recipe for target ‘.obj/gmic.o’ failed
make: *** [.obj/gmic.o] Error 1

clean installation, started off the usual way:
git clone https://github.com/dtschump/gmic.git
git clone https://github.com/c-koi/gmic-qt.git
make -C gmic/src CImg.h gmic_stdlib.h

gmic_stdlib.h file size is indeed zero

Was ok last Thursday when I compiled the fix for plug-in non-interactive mode issue.

Maybe the web site is temporarily down ?
I’ve just tested here with a fresh clone, and this is working as expected (from France).

Cleaned all out, repeated installation and works ok now.

Indeed it was empty. I re-cloned and retried. It passed the blocking point, but hit a new one a few moments after :

/home/fabien/Programmes/gmic-qt/src/Host/Gimp/host_gimp.cpp:25:10: fatal error: libgimp/gimp.h: Aucun fichier ou dossier de ce type
#include <libgimp/gimp.h>
^~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/gmic_gimp_qt.dir/build.make:1666: recipe for target ‘CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o’ failed
make[2]: *** [CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/gmic_gimp_qt.dir/all’ failed
make[1]: *** [CMakeFiles/gmic_gimp_qt.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

Steps followed :

git clone --depth=1 https://framagit.org/dtschump/gmic.git
git clone --depth=1 https://github.com/c-koi/gmic-qt.git
make -C gmic/src CImg.h gmic_stdlib.h
cd gmic-qt
mkdir build && cd build
cmake … -DGMIC_QT_HOST=gimp -DGMIC_PATH=/home/fabien/Programmes/gmic/src -DCMAKE_BUILD_TYPE=Release
make

I saw links in Readme are not the same as on the website, so I retried with these two, same result :
git clone https://github.com/dtschump/gmic.git
git clone https://github.com/c-koi/gmic-qt.git

Have you installed the libgimp2.0-dev package which contains the required header files to compile GIMP plug-ins ?

Have you installed the libgimp2.0-dev package ?

Yes, I have 2.99+om~4-0ubu18.04.3-ppa installed.

What does the following command display ?

$ pkg-config --cflags gimp-2.0

I had an issue recently with it, telling me gegl-0.3.pc was not here (but you don’t need it at all, it’s a known bug in the GIMP pkg-config file).

$ pkg-config --cflags gimp-2.0
Package gimp-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gimp-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gimp-2.0' found

I searched for the .pc file in the system, and then ran :

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/gimp/lib/pkgconfig

Now :

$ pkg-config --cflags gimp-2.0
-pthread -I/opt/gimp/include/gimp-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gegl-0.4 -I/usr/include/json-glib-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/babl-0.1

It’s weird there is no file from the ppa’s package.
But it still fails :

/home/fabien/Programmes/gmic-qt/src/Host/Gimp/host_gimp.cpp:25:10: fatal error: libgimp/gimp.h: Aucun fichier ou dossier de ce type
 #include <libgimp/gimp.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/gmic_gimp_qt.dir/build.make:1666: recipe for target 'CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o' failed
make[2]: *** [CMakeFiles/gmic_gimp_qt.dir/src/Host/Gimp/host_gimp.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/gmic_gimp_qt.dir/all' failed
make[1]: *** [CMakeFiles/gmic_gimp_qt.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

After a search I could find gimp.h file in the directory where I compiled gimp and in :
/usr/include/gimp-3.0/libgimp
/opt/gimp/include/gimp-2.0/libgimp

OK, nice !
You really need pkg-config to give you the correct path for the compilation, and then compiling the plug-in should be straightforward.

I ran

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/gimp/include/gimp-2.0/libgimp

but it still doen’t find it. Unless it has to be set from the cmake command ? If so, what is the option to add ?

I don’t know really. This is beyond my knowledge :slight_smile:
I personally use qmake instead of cmake to compile the plug-in, but I doubt this will make a difference, as both rely on the result of pkg-config to set the good compiler flags.