meson build system #41

Closed
opened 2024-03-14 22:52:58 +00:00 by rbt · 24 comments
Owner

Use the Meson build system.

Use the Meson build system.
rbt added the
release-blocker
devx
labels 2024-03-14 22:52:58 +00:00
rbt added this to the Meson migration project 2024-03-14 22:52:58 +00:00
Owner
@qyriad has been working on this: https://git.lix.systems/qyriad/lix/src/branch/maint/meson
qyriad self-assigned this 2024-03-15 03:34:11 +00:00
Owner

I've been chipping away at the different components of Lix, converting them to Meson; I have each of src/lib* building so far. It has been pretty straightforward, but I expect that the Perl bindings, docs, and tests will be where the real complexity will be

I've been chipping away at the different components of Lix, converting them to Meson; I have each of `src/lib*` building so far. It has been pretty straightforward, but I expect that the Perl bindings, docs, and tests will be where the real complexity will be
jade modified the project from Meson migration to Release engineering 2024-03-18 22:05:47 +00:00
jade modified the project from Release engineering to Meson migration 2024-03-18 22:05:52 +00:00
jade added this to the v2.90 milestone 2024-03-18 22:18:36 +00:00
Owner

https://gerrit.lix.systems/c/lix/+/580 is pushed to Gerrit, which implements building and installing binaries and headers with Meson. Tests and docs incoming.

https://gerrit.lix.systems/c/lix/+/580 is pushed to Gerrit, which implements building and installing binaries and headers with Meson. Tests and docs incoming.
Owner

Update: the Meson build on macOS specifically is ending up with references to Boost in the closure, which is something we don't want (we explicitly copy the boost libs we need into $out/lib to avoid this), and is also a significant enough difference from the old build results that it needs investigation, so that's what we're working on debugging now.

Update: the Meson build on macOS specifically is ending up with references to Boost in the closure, which is something we don't want (we explicitly copy the boost libs we need into `$out/lib` to avoid this), and is also a significant enough difference from the old build results that it needs investigation, so that's what we're working on debugging now.
Owner

Update: the Boost rpath references in $out/lib were apparently "normal" — at least in the sense that the libs were not built differently than they should have been.

The old build system makes the interesting move to, at install-time, re-link libraries using $out/lib as the new library search path.

Meson doesn't have any notion of "making link targets that depend on install targets to then be installed", and since getting Boost out of the rpath is something we specifically want for the derivation that builds Lix, we opted to just patch the Mach-O instead, something that the derivation was already doing for libnixutil.dylib anyway.

So anyway. Building and installing were successfully added in b4d07656ff.

We're almost done with running the test suites in Meson too 🎉

Update: the Boost rpath references in `$out/lib` were apparently "normal" — at least in the sense that the libs were not built differently than they should have been. The old build system makes the interesting move to, at install-time, [re-link libraries](https://git.lix.systems/lix-project/lix/src/commit/d3d7489571baeb651d3843dba3b638621694c174/mk/libraries.mk#L111-L118) using `$out/lib` as the new library search path. Meson doesn't have any notion of "making link targets that depend on install targets to then be installed", and since getting Boost out of the rpath is something we specifically want for the derivation that builds Lix, we opted to just [patch the Mach-O instead](https://git.lix.systems/lix-project/lix/src/commit/d3d7489571baeb651d3843dba3b638621694c174/package.nix#L263-L268), something that the derivation was *already doing* for libnixutil.dylib anyway. So anyway. Building and installing were successfully added in b4d07656ff2c43b1144eb97658b9528dd39418ce. We're almost done with running the test suites in Meson too 🎉
Member

Exciting!! Very nice work

Exciting!! Very nice work
Owner

@qyriad I just did some local tests and for some reason if I run .#hydraJobs.mesonBuild.x86_64-linux on my local machine, it actually starts building the existing Makefile based system instead; if I remove the overrideAttrs bit that appends the original Nix invocation's buildInputs it actually uses Meson. This does not happen on my Mac

@qyriad I just did some local tests and for some reason if I run `.#hydraJobs.mesonBuild.x86_64-linux` on my local machine, it actually starts building the existing Makefile based system instead; if I remove the `overrideAttrs` bit that appends the original Nix invocation's `buildInputs` it actually uses Meson. This does not happen on my Mac
Owner

What the fuck

What the fuck
Owner

@lunaphied your local machine is x86_64-linux, yes?

@lunaphied your local machine is x86_64-linux, yes?
Owner

Just git pulled a536438da..007e6b580 and now seeing this o.o

Just git pulled `a536438da..007e6b580` and now seeing this o.o
Owner

your local machine is x86_64-linux, yes?

The one I'm encountering this on is. I should also note that I encountered an inconsistency on aarch64-drawin, where when I added a Meson target identical to the existing hydraJob definitions but using the gccStdenv it used Clang anyway somehow, which does not happen with the equivalent for the Makefile based system

> your local machine is x86_64-linux, yes? The one I'm encountering this on is. I should also note that I encountered an inconsistency on aarch64-drawin, where when I added a Meson target identical to the existing hydraJob definitions but using the `gccStdenv` it used Clang anyway somehow, which does not happen with the equivalent for the Makefile based system
Owner

Reverting ad8a4b380e (cc @raito ) fixes this

…Somehow.

What.

Reverting ad8a4b380e83145c51b97fcd4a30038cf09e0ed1 (cc @raito ) fixes this …Somehow. What.
Owner

... what

... *what*
Owner

that's because linearizing the meson tests means that mesonBuild depends on build, and mesonBuildClang depens on mesonBuild. that's expected and only temporary to make ci not explode. you can remove the overrideAttrs in the meson hydra jobs for local tests.

that's because linearizing the meson tests means that mesonBuild depends on build, and mesonBuildClang depens on mesonBuild. that's expected and only temporary to make ci not explode. you can remove the overrideAttrs in the meson hydra jobs for local tests.
Owner

Right that would do that thank you

*Right that would do that* thank you
Owner

I don't think that's the issue since reverting an unrelated PR fixed it. Also this have just the same issue in CI no? or is it bypassed because of the way nix-eval-jobs works?

I don't think that's the issue since reverting an unrelated PR fixed it. Also this have just the same issue in CI no? or is it bypassed because of the way `nix-eval-jobs` works?
Owner

@lunaphied it does build with Meson, it just builds with Meson after it builds with Make

@lunaphied it does build with Meson, it just builds with Meson after it builds with Make
Owner

Ah okay. Very cursed. So the linked commit is unrelated?

Ah okay. Very cursed. So the linked commit is unrelated?
Owner

Yep

Yep
Owner

if you revert that commit and the source set before the revert is cached the dep needs not be built. ci doesn't run into this because it builds a dag and doesn't even start the meson build before the non-meson build has finished.

if you revert that commit and the source set before the revert is cached the dep needs not be built. ci doesn't run into this because it builds a dag and doesn't even start the meson build before the non-meson build has finished.
Owner

Yep, exactly. Thank you @pennae and sorry for the confusion

Yep, exactly. Thank you @pennae and sorry for the confusion
Owner

With the merge of https://gerrit.lix.systems/c/lix/+/836, I…think the buildsystem itself is done? Now we just need to verify that meson outputs everything correctly, update development documentation to include meson instructions, and flip the buildWithMeson ? false to true switch in package.nix?

@pennae @jade that sound about right?

With the merge of https://gerrit.lix.systems/c/lix/+/836, I…think the buildsystem itself is done? Now we just need to verify that meson outputs everything correctly, update development documentation to include meson instructions, and flip the `buildWithMeson ? false` to `true` switch in `package.nix`? @pennae @jade that sound about right?
Owner

sounds good. we made an attempt to verify that the meson binaries can be made bit-identical to the autoconf binaries with just some flag juggling, but that didn't lead anywhere. if anyfew with more patience for such nonsense wants to attempt we'd be very happy, otherwise we'll have to find the fuckups by testing :<

sounds good. we made an attempt to verify that the meson binaries can be made bit-identical to the autoconf binaries with just some flag juggling, but that didn't lead anywhere. if anyfew with more patience for such nonsense wants to attempt we'd be very happy, otherwise we'll have to find the fuckups by testing :<
Owner

As of b913a939b0, Meson is now the default buildsystem for Lix 🎉!

All that is left now is to remove the old buildsystem. I'm going to open a new issue for that.

As of b913a939b0aeccf979950f5dcb5089d565fee2a3, Meson is now the default buildsystem for Lix 🎉! All that is left now is to remove the old buildsystem. I'm going to open a new issue for that.
Sign in to join this conversation.
No milestone
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#41
No description provided.