How to complie example in libmypaint?

I try everything i can, but still cannot compile the example in libmypaint.
At the beginning, there is no Gegl under gi.repository. To solve that problem, i installed Gegl, and then my Gtk is missing either! After i try to install Gtk, my Ubuntu crash.
Please tell me how to install the dependencies and compile gegl.py and minimal.cc. SOS

Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from gi.repository import Gtk
Traceback (most recent call last):
File “”, line 890, in _find_spec
AttributeError: ‘DynamicImporter’ object has no attribute ‘find_spec’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python3/dist-packages/gi/importer.py”, line 127, in find_module
‘introspection typelib not found’ % namespace)
ImportError: cannot import name Gtk, introspection typelib not found

cmake_minimum_required(VERSION 2.6)
project(TestExample)

set(TestExample_VERSION_MAJOR 1)
set(TestExample_VERSION_MINOR 0)

include_directories(
    "/home/l/libmypaint",
    "/usr/local/include/libmypaint-2.0",
    "/usr/include/glib-2.0",
    "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
    "/usr/include/json-c"
)
add_executable(TestExample minimal.c)
target_link_libraries(TestExample m)
target_link_libraries(TestExample json-c)
target_link_libraries(TestExample pango-1.0)
target_link_libraries(TestExample glib-2.0)
target_link_libraries(TestExample girepository-1.0)

make
[ 50%] Linking C executable TestExample
CMakeFiles/TestExample.dir/minimal.c.o: In function `mypaint_brush_get_type':
minimal.c:(.text+0x2f95): undefined reference to `g_boxed_type_register_static'
CMakeFiles/TestExample.dir/minimal.c.o: In function `mypaint_surface_get_type':
minimal.c:(.text+0x2fc9): undefined reference to `g_boxed_type_register_static'
CMakeFiles/TestExample.dir/minimal.c.o: In function `mypaint_fixed_tiled_surface_get_type':
minimal.c:(.text+0x2ffd): undefined reference to `g_boxed_type_register_static'
CMakeFiles/TestExample.dir/minimal.c.o: In function `mypaint_rectangle_get_type':
minimal.c:(.text+0x3031): undefined reference to `g_boxed_type_register_static'
collect2: error: ld returned 1 exit status
CMakeFiles/TestExample.dir/build.make:94: recipe for target 'TestExample' failed
make[2]: *** [TestExample] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/TestExample.dir/all' failed
make[1]: *** [CMakeFiles/TestExample.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2