Error compiling GIMP on Ubuntu 17.10

Hi folks!

I am following this tutorial using Ubuntu 17.10: Building GIMP for artists and photographers. When I try to compile GIMP using the following code:

cd $SRC_DIR/gimp
./autogen.sh --prefix=$PREFIX --with-gimpdir=$HOME/code/gimpdefault/install/config --disable-gtk-doc

I get the following error:

WARNING: GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
         against using this version of the compiler (previous and
         further versions are fine).
         See https://bugzilla.gnome.org/show_bug.cgi?id=787222

Error: GIMP configuration failed.

  - Error: missing dependency libmypaint >= 1.3.0

See the file 'INSTALL' for more help.

Configure failed or did not finish!

Any idea what to do to solve this problem?

ps: I have used “export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules” since this is a Ubuntu (debian-based) system. I have also installed libmypaint by doing:

cd $SRC_DIR/libmypaint
./autogen.sh --prefix=$PREFIX
./configure --prefix=$PREFIX
make -j3 && make -j3 install

Did you build libmypaint first?

yes, I did it by doing:

cd $SRC_DIR/libmypaint
./autogen.sh --prefix=$PREFIX
./configure --prefix=$PREFIX
make -j3 && make -j3 install

It seemed to have been successfully compiled. How do I check that?

Hi @SheetM, Note that he looks for libmypaint with a version number >= 1.3.0.
Which one did you obtain? Issue this command to find out:

dpkg -s libmypaint

/Claes in Lund, Sweden

Thanks Claes,

Just to clarify further, here is the instructions I have been running:

# Set up some folders
mkdir $HOME/code
mkdir $HOME/code/gimpdefault
mkdir $HOME/code/gimpdefault/build
mkdir $HOME/code/gimpdefault/install
mkdir $HOME/code/gimpdefault/install/share
mkdir $HOME/code/gimpdefault/install/share/aclocal
touch $HOME/code/gimpdefault/install/share/aclocal/gimp-2.0.m4

# Clone the software — add to this list as needed on your system.
cd $HOME/code/gimpdefault/build
git clone git://git.gnome.org/glib
git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://github.com/mypaint/libmypaint.git
git clone git://git.gnome.org/gimp

# Set up the prefix
PREFIX=$HOME/code/gimpdefault/install
export PATH=$PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=$PREFIX/share:$XDG_DATA_DIRS
export ACLOCAL_FLAGS="-I $PREFIX/share/aclocal"
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules
export SRC_DIR=$HOME/code/gimpdefault/build

# Build and install glib/babl/GEGL/libmypaint/GIMP in the
# prefix — add to this list as needed on your system.

cd $SRC_DIR/glib
./autogen.sh --prefix=$PREFIX
make -j3 && make -j3 install

cd $SRC_DIR/babl
./autogen.sh --prefix=$PREFIX --disable-docs
make -j3 && make -j3 install

cd $SRC_DIR/gegl
./autogen.sh --prefix=$PREFIX --enable-gtk-doc-html=no --enable-workshop
make -j3 && make -j3 install

cd $SRC_DIR/libmypaint
./autogen.sh --prefix=$PREFIX
./configure --prefix=$PREFIX
make -j3 && make -j3 install

cd $SRC_DIR/gimp
./autogen.sh --prefix=$PREFIX --with-gimpdir=$HOME/code/gimpdefault/install/config --disable-gtk-doc
make -j3 && make -j3 install

when I get to the lines

cd $SRC_DIR/gimp
./autogen.sh --prefix=$PREFIX --with-gimpdir=$HOME/code/gimpdefault/install/config --disable-gtk-doc

I get the error:

WARNING: GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
         against using this version of the compiler (previous and
         further versions are fine).
         See https://bugzilla.gnome.org/show_bug.cgi?id=787222

Error: GIMP configuration failed.

  - Error: missing dependency libmypaint >= 1.3.0

See the file 'INSTALL' for more help.

Configure failed or did not finish!

If I do ‘dpkg -s libmypaint’ I get:

dpkg-query: package 'libmypaint' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

and the same for glib, babl and gegl. For example, for babl I get:

dpkg-query: package 'babl' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

However, it is weird as I successfully compiled GLIB, GEGL, BABL and LIBMYPAINT without any errors…
Any idea of what could be going wrong?

We should ping @Elle to see if her build instructions are up to date (not that this is the problem, but better to remove uncertainty). I can try building it on another machine shortly to test with you, but it’ll be a little later today.

This is the first problem. You just can’t compile GIMP from git using gcc 7.2.0 - the problem is well-documented in the linked-to bug report.

If memory serves me correctly - and someone please correct me if I’m wrong - dpkg searches for files that are installed by a debian-based package manager. The package manager has no way of knowing what is installed in the GIMP prefix. The point of installing in a prefix is to avoid having the packages installed in the prefix interfere with packages installed by the package manager. So it’s good that dpkg doesn’t find the software that is installed in the prefix.

The only thing that might cause a problem in the instructions in my article is libmypaint. The workaround is to reset the libmypaint git code back to a particular commit, which was before one of the functions that GIMP uses was changed in libmypaint, but not in GIMP-2.9. GIMP needs the equivalent of libmypaint 1.3.

To reset libmypaint from git back to the correct “last good commit for GIMP-2.9”, first uninstall libmypaint from the prefix, and then run this command in the libmypaint build folder:

git reset --hard c196a86886fce9b3c9980a4412f4ce3847855493

At this point the command “git log” run in the libmypaint folder should show this:

commit c196a86886fce9b3c9980a4412f4ce3847855493 (HEAD -> master)
Merge: 4213d8c 1bc955b
Author: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date:   Tue May 23 00:17:18 2017 -0400

    Merge pull request #84 from QuLogic/build-cleanup

    Build cleanup

Then reinstall libmypaint starting from ./autogen.sh

Maybe something has changed upstream in libmypaint to make the above libmypaint workaround unnecessary, but I sort of think not. Right now I’m using libmypaint 1.3 from gentoo portage instead of building it myself. But when I was building it from git, the only way that I know of to get GIMP to work with libmypaint from git was to reset libmypaint back to the above commit.

2 Likes

Thanks Elle for the detailed answer.

It is a shame that Ubuntu 17.10 comes with GCC 7.2.0 pre-installed. My next step is to install a different version of gcc! Then I will check if I still get the same type of problem with libmypaint.

Ouch! Is there a backport repository somewhere?

To note, GIMP from git should be still checking for at least v1.3.0. From the wiki page:

git clone https://github.com/mypaint/libmypaint.git
cd libmypaint/
git checkout v1.3.0
sudo apt-get install libjson-c-dev
./autogen.sh && ./configure --prefix=$INSTALL_PREFIX && make && make install
1 Like

@patdavid - thanks! I’ll try to update my “how to build” page in the next day or two.

Er… If my eyes do not deceive me: SheetM’s lines are not related to @Elle 's Gimp version, but the regular run of The Gimp.

Have fun!
Claes in Lund, Sweden

Well, there are several articles on my website on building and updating GIMP, and most of them are about building default GIMP :slight_smile:

1 Like

I am not sure… Doesn’t seem too easy to do. Now maybe the best alternative is to downgrade to Ubuntu 17.04 or 16.04. And hope that gcc 7.2 is not installed with the updates!

My impression is that compiling gcc is not very easy to do. Would it be worth your while to file a bug report with Ubuntu, and point them to this gcc bug report?

Bug 82108 - [7 Regression] Wrong vectorized code generated for x86_64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82108

It might actually be easiest to switch your compiler from gcc to clang for now (until the bug fix is available in the repos). You should be able to just install clang from the package repos and then set export CC=clang to get clang instead of gcc.

Thanks Michael Henning, I have managed to build a GIMP binary using clang 4.0.1 using

CC=clang

and the trick by patdavid also solved my problem with libmypaint:

git clone https://github.com/mypaint/libmypaint.git
cd libmypaint/
git checkout v1.3.0

Now, when I try to execute the binary, it displays:

Liblcms2 version mismatch!

GIMP was compiled against LittleCMS version 2.8, but the
LittleCMS version found at runtime is only 2.7.

Somehow you or your software packager managed
to install a LittleCMS that is older than what GIMP was
built against.

Please make sure that the installed LittleCMS version
is at least 2.8 and that headers and library match.

I have downloaded liblcms2-2 version 2.8 from:

then went to the folder and did:
./configure
make
sudo make install

but still no luck. Any ideas how to get around this?

thanks

After establishing the prefix and installing lcms 2.8 in the prefix folder, did you recompile babl/GEGL/libmypaint/GIMP starting from ./autogen.sh?

I’m not sure if everything from babl forward needs to be recompiled. But better to be on the safe side as babl/GEGL/libmypaint compile fairly quickly, and GIMP does not.

I have downloaded it to $PREFIX/lcms2-2.8 and then run

./configure
make
sudo make install

After that I ran:

cd $SRC_DIR/glib
./autogen.sh --prefix=$PREFIX
make -j3 && make -j3 install

cd $SRC_DIR/babl
./autogen.sh --prefix=$PREFIX --disable-docs
make -j3 && make -j3 install

cd $SRC_DIR/gegl
./autogen.sh --prefix=$PREFIX --enable-gtk-doc-html=no --enable-workshop
make -j3 && make -j3 install

cd $SRC_DIR/libmypaint
./autogen.sh --prefix=$PREFIX
./configure --prefix=$PREFIX
make -j3 && make -j3 install

cd $SRC_DIR/gimp
./autogen.sh --prefix=$PREFIX --with-gimpdir=$HOME/code/gimpdefault/install/config --disable-gtk-doc
make -j3 && make -j3 install

but it is still displaying the error:

Liblcms2 version mismatch!

GIMP was compiled against LittleCMS version 2.8, but the
LittleCMS version found at runtime is only 2.7.

Somehow you or your software packager managed
to install a LittleCMS that is older than what GIMP was
built against.

Please make sure that the installed LittleCMS version
is at least 2.8 and that headers and library match.

what am I doing wrong?

Cheers

Hmm, why use “sudo” to install lcms in the prefix? This seems like not a good idea. Did lcms actually install in the prefix? Or maybe in /usr/local? I don’t know where lcms defaults to for the install prefix if one isn’t specified.

Try “make uninstall && make clean” for lcms-2.8. And then use ./autogen.sh --prefix=$PREFIX when installing lcms, and check to make sure it’s really installed in the prefix.

Also try uninstalling and cleaning and maybe even “git clean -xdf” for babl/GEGL/GIMP, before running the ./autogen.sh command to reinstall, after making sure lcms really is installed in the prefix.