Missing libmypaint.pc: how to fix it

Continuing the discussion from Testers wanted: perspective mode (early stages):

Since the libmypaint split-out, you may get an error like the following when compiling MyPaint with SCons.

Package libmypaint was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmypaint.pc
to the PKG_CONFIG_PATH environment variable
No package ‘libmypaint’ found**

It’s really difficult to see, in all the SCons clutter, but it means that pkg-config file for libmypaint was missing. Here’s what the full attempt looks like:

bleke@Nemesis:~/dev/mypaint$ scons
scons: Reading SConscript files ...
building for 'python2.7' (use scons python_binary=xxx to change)
using 'python2.7-config' (use scons python_config=xxx to change)
Delete(["libmypaint-tests.so", "libmypaint-tests.so", "libmypaint.so", "libmypaintlib.so", "libmypaint.a", "libmypaint-tests.a", "lib/_mypaintlib.so"])
Package libmypaint was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmypaint.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmypaint' found
OSError: 'pkg-config cflags libs libmypaint ' exited 1:
File "/home/bleke/dev/mypaint/SConstruct", line 228:
SConscript('./SConscript')
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return SConscript(self.fs, *files, **substkw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec file in call_stack[-1].globals
File "/home/bleke/dev/mypaint/SConscript", line 13:
mypaintlib = SConscript('lib/SConscript')
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return SConscript(self.fs, *files, **substkw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec file in call_stack[-1].globals
File "/home/bleke/dev/mypaint/lib/SConscript", line 82:
parse_pkg_config(env, "libmypaint")
File "/home/bleke/dev/mypaint/lib/SConscript", line 39:
env.ParseConfig(cmd)
File "/usr/lib/scons/SCons/Environment.py", line 1576:
return function(self, self.backtick(command))
File "/usr/lib/scons/SCons/Environment.py", line 594:
raise OSError("'%s' exited %d" % (command, status))

But I installed libmypaint!

It can look as if you’ve installed libmypaint, but appearances can be deceptive. Debian or Ubuntu-derived systems always need the dev package too.

bleke@Nemesis:~/dev/mypaint$ dpkg -l libmypaint
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================-===================-===================-================================================================
ii libmypaint 1.2.94-0x0~ppa~ae76 amd64 libmypaint - MyPaint brush engine library

A little side note: the version number above was also never released by us. Please do not use it. It’s from some unofficial PPA where they make up version numbers. That’s sloppy practice, especially for libs, and it will break things. The GIMP maintainers do not endorse the PPA in question either. I don’t want to link directly to the repository, but here’s how to get rid of what it installs:

$ sudo apt purge '*libmypaint*'

Ubuntu or Ubuntu-derived systems

If you are doing development work on MyPaint master or recent branches, you need to build against libmypaint from our official PPA* instead, or build and install your own libmypaint. The latest development package for libfoo is normally named libfoo-dev.

$ sudo apt-add-repository ppa:achadwick/mypaint-testing
$ sudo apt-get update
$ sudo apt-get install libmypaint-dev

Our PPA always contains the libmypaint you should be using for building MyPaint master or GIMP, and it will also contain either the latest release of MyPaint, or betas for the next release.

Sometimes these two aims conflict (e.g. v1.2.1 debug release in development, vs. 1.3.0-alpha in master), in which case so will the packages :slight_smile:

* More like “this PPA wot I made back when I wasn’t a real MyPaint developer” really.

Other Debian-like systems

Our PPA packaging is maintained in our libmypaint.deb repository. Follow the instructions in the README to get it built. It’ll work just fine on Debian testing/unstable as of May 2016, and for that it also makes a separate -dbgsyms package.

OSX, or other Linux

Please make and maintain builds for your system, and add a link to the Packaging page on our wiki so that people can find it.

But I’m on Windows

Windows users working with MSYS2 have two builds available: a build of the latest git with debugging symbols, and a build of the latest release without debugging symbols. You have to build them yourself with makepkg-mingw right now. This doubling-up is due to a quirk of Arch-like systems which generally don’t have separate debug symbol packages, and where dev stuff typically all goes into the main package.

Thanks! I compiled the failed version from yesterday again with the correct libmypaint library and got that error message again when I tried to run the binary file:

File "./mypaint", line 29
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file

But getting a new clone from github solved that issue. I now have a working perspective mode branch.