Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from autotools to meson #4642

Open
rusty-snake opened this issue Oct 26, 2021 · 13 comments
Open

Switch from autotools to meson #4642

rusty-snake opened this issue Oct 26, 2021 · 13 comments
Labels
enhancement New feature request

Comments

@rusty-snake
Copy link
Collaborator

This came up in #4633 (comment). I like the idea. Meson is faster and has an simpler and less error-prone syntax. Is this something we want to do?

CMake would be a second alternative.

@topimiettinen
Copy link
Collaborator

+1
I'm still learning Meson but it seems so much better than autoconf + configure + Make. There are also bonus stuff like support for clang scan-build, integrated tests and test coverage analysis.

@rusty-snake
Copy link
Collaborator Author

rusty-snake commented Oct 29, 2021

@kmk3
Copy link
Collaborator

kmk3 commented Oct 31, 2021

Switch from autotools to meson

@rusty-snake commented on Oct 26:

This came up in #4633
(comment)
.
I like the idea. Meson is faster

and has an simpler and less error-prone syntax.

I find the core of the syntax of autotools and make to be rather simple. In
the case of make there are some terse operator-looking internal macros (e.g.:
$<) that are easy to forget, but usually only a few of them are used and IMO
they aren't overused in this repo anyway.

I'll post a make guide later in a new thread to show what I mean.

Is this something we want to do?

CMake would be a second alternative.

I think it would be a great loss to break building with the traditional/more
portable build tools (I'll expand on this later).

The benefits of supporting alternative build systems isn't very clear either.
As for the speed, what are the workflows in question and the benchmark results?
Was make tested with something like -j$(nproc)?

@rusty-snake
Copy link
Collaborator Author

rusty-snake commented Oct 31, 2021

I find the core of the syntax of autotools and make to be rather simple.

The syntax of Makefiles is simple but

  1. it is not always intuitive to read, example: $(subst test-,,$@) vs. 'foobar'.replace("test-", "")
  2. can be very detailed
  3. maintaining (dist)clean and uninstall targets is often forgotten
  4. configure.ac is ugly

I'll post a make guide later in a new thread to show what I mean.

👍

Suggestion: https://github.com/netblue30/firejail/discussions/categories/show-and-tell

I think it would be a great loss to break building with the traditional/more
portable build tools (I'll expand on this later).

Two things to add (before you expand this)

  1. We can keep autotools (i.e. you can choose which one you use)
  2. IMHO portability isn't a problem. I wouldn't say meson has high requirements and we do not need to support legacy systems on which firejail doesn't work.
  • autotools is portable to legacy systems while meson is portable to windows and cross compile. IMHO we don't care about both.

As for the speed, what are the workflows in question and the benchmark results?
Was make tested with something like -j$(nproc)?

https://mesonbuild.com/Simple-comparison.html

@rusty-snake
Copy link
Collaborator Author

rusty-snake commented Oct 31, 2021

The benefits of supporting alternative build systems isn't very clear either.

I know not all are strong arguments / arguments for meson or against autotools in general


$ make distclean; LC_ALL=C date && (./configure && make) >/dev/null && LC_ALL=C date
Sun Oct 31 22:29:47 CET 2021
Sun Oct 31 22:30:02 CET 2021
=> 15sec
$ make distclean; LC_ALL=C date && (./configure && make -j"$(nproc)") >/dev/null && LC_ALL=C date
Sun Oct 31 22:31:25 CET 2021
Sun Oct 31 22:31:32 CET 2021
=> 7sec
$ rm -rf _builddir; LC_ALL=C date && (meson _builddir && ninja -C _builddir) >/dev/null && LC_ALL=C date
Sun Oct 31 22:32:32 CET 2021
Sun Oct 31 22:32:38 CET 2021
=> 6sec
$ make distclean; LC_ALL=C date && (./configure && make && touch src/firejail/main.c && make) >/dev/null && LC_ALL=C date
Sun Oct 31 22:39:08 CET 2021
Sun Oct 31 22:39:25 CET 2021
=> 17sec
$ make distclean; LC_ALL=C date && (./configure && make -j"$(nproc)" && touch src/firejail/main.c && make -j"$(nproc)") >/dev/null && LC_ALL=C date
Sun Oct 31 22:42:36 CET 2021
Sun Oct 31 22:42:44 CET 2021
=> 8sec
$ rm -rf _builddir; LC_ALL=C date && (meson _builddir && ninja -C _builddir && touch src/firejail/main.c && ninja -C _builddir) >/dev/null && LC_ALL=C date
Sun Oct 31 22:44:20 CET 2021
Sun Oct 31 22:44:27 CET 2021
=> 7sec

==> firejail is to small to see a big difference (if you type make -j4<ENTER>; meson: nin<TAB><ENTER>; reality: <UP><ENTER>)

@matu3ba
Copy link
Contributor

matu3ba commented Oct 31, 2021

Also: + Automatic generation of pkg-config for code reusage in third-party projects.

  1. How much maintenance will this save vs (experience) how to debug broken build stuff, ie the typical features vs bugs + debugging tradeoff. Are there any experience reports on this kind of stuff for meson?
  2. Who from the maintainers has how much knowledge in (fixing stuff in) meson?

Personally I would prefer a low-level build library, since that reduces code to a minimum, while sharing testing with most projects. But unfortunately the only project that attempts this (and a pile of other stuff) is a few years from stable.

@rusty-snake rusty-snake added the enhancement New feature request label Nov 2, 2021
@reinerh
Copy link
Collaborator

reinerh commented Nov 2, 2021

We currently also have a lot of redundancy in our Makefile.in files (and some are not even in sync with others). And they are "buggy", as the object targets miss stuff like CPPFLAGS, the linking targets miss CFLAGS etc... common.mk.in is also a bit of a mess.
I think in our current build system there is already a lof of room for improvement (maybe using automake would there a bit).

I don't have much experience with meson, but from what I heard/read it's one of the better build systems. (Personally I find it only a bit annoying that it's needed to list all source files (afaik), instead of letting it use all sources in the directory.)

But I'm fine with using either of them.

@rusty-snake
Copy link
Collaborator Author

Personally I find it only a bit annoying that it's needed to list all source files (afaik), instead of letting it use all sources in the directory.

https://mesonbuild.com/FAQ.html#why-cant-i-specify-target-files-with-a-wildcard
https://mesonbuild.com/FAQ.html#but-i-really-want-to-use-wildcards

kmk3 added a commit to kmk3/firejail that referenced this issue Nov 16, 2021
Added on commit 1379851 ("Baseline firejail 0.9.28", 2015-08-08).  See
also commit ad6bb83 ("consolidate makefiles", 2018-03-31).

It is not used anywhere.  And it looks like it has never been used
anywhere:

    $ git log --oneline -Gpthread.h 1379851..master
    $

Issue mentioned by @rusty-snake:
netblue30#4642 (comment)
reinerh pushed a commit that referenced this issue Nov 17, 2021
Added on commit 1379851 ("Baseline firejail 0.9.28", 2015-08-08).  See
also commit ad6bb83 ("consolidate makefiles", 2018-03-31).

It is not used anywhere.  And it looks like it has never been used
anywhere:

    $ git log --oneline -Gpthread.h 1379851..master
    $

Issue mentioned by @rusty-snake:
#4642 (comment)
@amano-kenji
Copy link
Contributor

Meson seems far simpler than cmake.

@eli-schwartz
Copy link

I think it would be a great loss to break building with the traditional/more
portable build tools (I'll expand on this later).

I had a recent discussion with a sourceware project maintainer about build systems... it included this rather insightful comment about why autotools is a highly preferable build system:

I only prefer autotools because bzip2 is used on such ancient systems. There are not many other projects it is still advantageous to have some ancient pre-unix-wars setup to run on :)

This isn't really a problem with projects that only support Linux. Of course, neither is it relevant that Meson, unlike autotools, has good support for Windows.

Since portability doesn't actually matter in the slightest, maybe the real issue is about build system requirements? autotools famously has none, which is another way of saying that it requires make but assumes you have it already (Linux will always have the other POSIX shell tools needed to run ./configure). Meson requires python, which is... common, and should always be trivial to get, but may not be preinstalled in minimal environments, and may require 50mb of disk space if you don't have it.

If that is the concern here, you may be interested in https://sr.ht/~lattis/muon/, a c99 reimplementation of Meson with good coverage for the core Meson functionality, which bootstraps with sh and a c99 compiler plus samurai (that itself bootstraps with make) and can compile down to a single statically linked prebuilt binary with an internal copy of samurai (ninja-compatible build tool which Meson uses instead of make) thrown in for good measure... all weighing in at 4.5 mb.

@amano-kenji
Copy link
Contributor

amano-kenji commented Jun 12, 2022

Firejail targets desktop linux market. You can expect desktop machines to have at least 4GB RAM and 128GB storage space.

If you can't run firefox on your machine, you are not a target market.

If your computing environment is limited, then you don't need to worry about sandboxing.

@eli-schwartz
Copy link

In my experience the concern usually tends to be less about "unable" and more "don't want to".

It's not all that unreasonable of an opinion. Most users will get it from a distro package, and distros almost always build in stripped down environments.
Also, some people may just not have any personal use for python. "Why install a large programming language stack if you don't need it" is a common refrain. If it's something you don't have already, it's also something you need to download, and bandwidth is, in many parts of the world, a big issue, far bigger than disk space or computing power.

This is why options are nice. Not everyone has to care about this, but if you do... then python isn't your only option to build stuff with Meson.

@amano-kenji
Copy link
Contributor

amano-kenji commented Jun 12, 2022

Python is a build dependency. Binary distro users don't need to install python.

distros almost always build in stripped down environments.

"Stripped down" in disto build environment means self-imposed sandboxes. Not artificial resource constraints like restrictions on RAM size. Build machines tend to have a lot of RAM because they need to build chromium and firefox every few weeks.

You don't need to worry about installing python if you are not using source-based distros like gentoo linux. If you are on gentoo, you should have more than 32GB RAM and 256GB storage space anyway.

My build machine has enough power to browse the internet and watch youtube videos while building chromium browser. Firefox build routinely consumes 16GB RAM while I'm browsing the internet and watching videos.

power

Deficient machines aren't fit to be build machines. Use a binary distro if your computer is weak.

topimiettinen added a commit to topimiettinen/firejail that referenced this issue Apr 14, 2024
Rebased and updated from netblue30#4656 by rusty-snake.

Closes: netblue30#4642
topimiettinen added a commit to topimiettinen/firejail that referenced this issue Apr 14, 2024
Rebased and updated from netblue30#4656 by rusty-snake.

Closes: netblue30#4642
topimiettinen added a commit to topimiettinen/firejail that referenced this issue Apr 14, 2024
Rebased and updated from netblue30#4656 by rusty-snake.

Closes: netblue30#4642
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants