After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782871 - Add Meson as a build system
Add Meson as a build system
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: build
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-05-20 16:14 UTC by Emmanuele Bassi (:ebassi)
Modified: 2017-05-22 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Emmanuele Bassi (:ebassi) 2017-05-20 16:14:34 UTC
Meson[1] is getting traction as a build system in GNOME. GTK+ master is using it in parallel to Autotools, and I'm in the process of porting other dependencies of GTK+ to it.

The advantages are:

 - faster build times
 - easier learning curve
 - reproducibility
 - portability

I've pushed a 1:1 port to the the wip/meson branch of the ATK Git repository for testing. The idea would be to keep Meson in parallel with Autotools for a certain amount of time, then drop Autotools.

[1]: http://mesonbuild.com
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2017-05-22 07:25:00 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #0)
> Meson[1] is getting traction as a build system in GNOME. GTK+ master is
> using it in parallel to Autotools, and I'm in the process of porting other
> dependencies of GTK+ to it.
> 
> The advantages are:
> 
>  - faster build times
>  - easier learning curve
>  - reproducibility
>  - portability
> 
> I've pushed a 1:1 port to the the wip/meson branch of the ATK Git repository
> for testing. The idea would be to keep Meson in parallel with Autotools for
> a certain amount of time, then drop Autotools.
> 
> [1]: http://mesonbuild.com

Thanks for this work. The patches on that branch are not only interesting for getting meson build (that itself is a good reason) but do some needed cleaning/update on some parts.

Skimming the patches, they make sense. But when building them (using autotools) I get this error:

  GISCAN   Atk-1.0.gir
./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__INT_INT_STRING'
./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__DOUBLE_STRING'
./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__STRING_BOOLEAN'
./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__INT_INT'

I also tried to compile it with meson:
[jhbuild-infapi00]@ataulfo:~/source/atk$ meson build
The Meson build system
Version: 0.41.0.dev1
Source dir: /home/infapi00/mesa/source/atk
Build dir: /home/infapi00/mesa/source/atk/build
Build type: native build
Project name: atk
Native c compiler: ccache cc (gcc 6.2.0)
Appending CFLAGS from environment: '-Wall -g3 -O0 -ggdb3'
Appending LDFLAGS from environment: '-L/home/infapi00/mesa/install/lib '
Build machine cpu family: x86_64
Build machine cpu: x86_64
Compiler for c supports argument -fvisibility=hidden: YES
Compiler for c supports argument -Wl,-Bsymbolic: YES
Compiler for c supports argument -Wl,-z,relro: YES
Compiler for c supports argument -Wl,-z,now: YES
Checking for function "bind_textdomain_codeset": YES
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Native dependency gobject-2.0 found: YES 2.50.2
Configuring atk.pc using configuration
Configuring config.h using configuration
Configuring atkversion.h using configuration
Program glib-genmarshal found: YES (/usr/bin/glib-genmarshal)
Native dependency glib-2.0 found: YES 2.50.2
Program glib-mkenums found: YES (/usr/bin/glib-mkenums)
Program g-ir-scanner found: YES (/usr/bin/g-ir-scanner)
Program g-ir-compiler found: YES (/usr/bin/g-ir-compiler)
Native dependency gobject-introspection-1.0 found: YES 1.50.0
Build targets in project: 15

But then the atk .so library seems empty. Probably Im just doing something wrong with meson (never used it before), or it is just that the port is not finished.

In any case, and again, thanks for this work.
Comment 2 Emmanuele Bassi (:ebassi) 2017-05-22 08:28:54 UTC
> ./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__INT_INT_STRING'

This is indeed a bug; atkutil.c was including atkmarshal.c directly, instead of compiling atkmarshal.c just like the rest of the source code. I've fixed the autotools build.

> But then the atk .so library seems empty.

Just calling `meson` is the equivalent of doing `autogen.sh && configure`; you need to build the project after that. The default backend is ninja, so:

  $ meson _build .
  $ ninja -C _build

will configure and build the project.
Comment 3 Emmanuele Bassi (:ebassi) 2017-05-22 08:30:39 UTC
As a side note: I've also ported at-spi2-atk to Meson:

  https://git.gnome.org/browse/at-spi2-atk/log/?h=wip/meson

and I'm finishing at-spi2-core as well.
Comment 4 Alejandro Piñeiro Iglesias (IRC: infapi00) 2017-05-22 09:48:15 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #2)
> > ./.libs/libatk-1.0.so: undefined reference to `atk_marshal_VOID__INT_INT_STRING'
> 
> This is indeed a bug; atkutil.c was including atkmarshal.c directly, instead
> of compiling atkmarshal.c just like the rest of the source code. I've fixed
> the autotools build.

Thanks. It builds it correctly now.

> > But then the atk .so library seems empty.
> 
> Just calling `meson` is the equivalent of doing `autogen.sh && configure`;
> you need to build the project after that. The default backend is ninja, so:
> 
>   $ meson _build .
>   $ ninja -C _build

Next time I would use 30 seconds to search this. Sorry for bothering you.

> will configure and build the project.

Just tested and seems to build correctly now. But:

  * Nitpick: it doesn't build the tests directory. This is optional, as they aren't formal tests, but just some small ones that were added while development. You can forget them, and I will try to get them building eventually.

  * Important: again, perhaps Im doing something wrong with meson. But I was not able to get the gtk-docs being built. I tried the following to enable the docs building:

   $ cd build
   $ mesonconf -D

and also to modify the default value on meson_options.txt
Comment 5 Emmanuele Bassi (:ebassi) 2017-05-22 10:08:50 UTC
(In reply to Alejandro Piñeiro Iglesias (IRC: infapi00) from comment #4)

>   * Nitpick: it doesn't build the tests directory. This is optional, as they
> aren't formal tests, but just some small ones that were added while
> development. You can forget them, and I will try to get them building
> eventually.

It does build them.

Just check under the `builddir/tests`, e.g.:

  $ meson _build .
  $ ninja -C _build
  $ ls _build/tests

You can just use:

  $ mesontest -C _build

to run them (mesontest is a wrapper so you can run valgrind or gdb around each test with automatic log redirection).

>   * Important: again, perhaps Im doing something wrong with meson. But I was
> not able to get the gtk-docs being built. I tried the following to enable
> the docs building:
> 
>    $ cd build
>    $ mesonconf -D
> 
> and also to modify the default value on meson_options.txt

Documentation is built at install time. You can explicitly build it by using:

  $ ninja -C _build atk-doc

if you don't want to install it.
Comment 6 Alejandro Piñeiro Iglesias (IRC: infapi00) 2017-05-22 10:49:07 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #5)

Well, in the end instead of a review it became a quick meson tutorial for dummies. Sorry for that.

As I mentioned, I skimmed the patches, and they looks lgtm. Not exactly a formal review, but feel free to push them on master when you became happy with your wip branch. 

> (In reply to Alejandro Piñeiro Iglesias (IRC: infapi00) from comment #4)
> 
> >   * Nitpick: it doesn't build the tests directory. This is optional, as they
> > aren't formal tests, but just some small ones that were added while
> > development. You can forget them, and I will try to get them building
> > eventually.
> 
> It does build them.
> 
> Just check under the `builddir/tests`, e.g.:
> 
>   $ meson _build .
>   $ ninja -C _build
>   $ ls _build/tests
> 
> You can just use:
> 
>   $ mesontest -C _build
> 
> to run them (mesontest is a wrapper so you can run valgrind or gdb around
> each test with automatic log redirection).
> 
> >   * Important: again, perhaps Im doing something wrong with meson. But I was
> > not able to get the gtk-docs being built. I tried the following to enable
> > the docs building:
> > 
> >    $ cd build
> >    $ mesonconf -D
> > 
> > and also to modify the default value on meson_options.txt
> 
> Documentation is built at install time. You can explicitly build it by using:
> 
>   $ ninja -C _build atk-doc
> 
> if you don't want to install it.
Comment 7 Emmanuele Bassi (:ebassi) 2017-05-22 13:20:12 UTC
Thanks, I've merged the wip/meson branch into master.

For any issue with regards to the build with Meson feel free to ask me.