pdns icon indicating copy to clipboard operation
pdns copied to clipboard

Work to be done to move to Meson build by default

Open omoerbeek opened this issue 11 months ago • 16 comments

Timeline: the goal is to have this done end of Q2 2025.

We (that is I) will start with distr tarball for recursor, and we'll use the experience with that case for the other products. We should not be too hesitant to add (new) build dependencies, especially for tools that are very common, like python (already used by Meson itself), flex or bison.

In the meantime the other task (mostly in CI itself) can also be tackled.

When we have all subtasks below done, and all three products have branched, we wil be free to start to deprecate autotools and at one point maybe even remove them.

  • Basic build for a developer
    • [X] auth
    • [x] dnsdist (there is a not yet merged PR)
    • [X] rec
  • Unit test build and run from Meson
    • [X] auth
    • [x] dnsdist
    • [X] rec
  • Docs build
    • [x] auth
    • [x] dnsdist
    • [x] rec
  • CI build and test all
    • [X] auth
    • [x] dnsdist
    • [X] rec
  • CI Use results of Meson "build and test all" for unit tests
    • [X] auth
    • [x] dnsdist
    • [X] rec
  • CI Use results of Meson "build and test all" for regression tests
    • [x] auth
    • [x] dnsdist
    • [x] rec
  • Dist tarball (there are differences between Meson approach and autotools approach, see discussion below)
    • [ ] auth
    • [x] dnsdist
    • [x] rec
  • CI package building
    • [ ] auth
    • [x] dnsdist
    • [x] rec (issue: meson does not produce systemd unit files from pdns-recursor.service.in yet)
  • [ ] CI Docs Build and publishing
  • [ ] Inventory of potential third party issues?

omoerbeek avatar Jan 17 '25 10:01 omoerbeek

  • Dist tarball (there are conflicts between Meson approach and autotools approach, Meson wants all files in git, no "pre-generate" step)

This is not precisely accurate. You can create files in the dist tarball using meson.add_dist_script().

Unifying this between from-git builds and from-dist-tarball builds could perhaps use a bit of polish from the meson side. You can run ninja targets for e.g. built sources you want to be functional even without generator tools installed (manpages, doxygen, flex/bison...) from the dist script and copy the built results into the dist staging root, and then use an if/else to see if the file exists in the source tree and directly use it -- I've wanted to provide methods for automatically handling this for a while but never gotten around to it.

eli-schwartz avatar Jan 21 '25 04:01 eli-schwartz

This is not precisely accurate. You can create files in the dist tarball using meson.add_dist_script().

Thanks, I understood earlier that there was no such facility. One of the goals is to have some files pregenerated in the dist tarball, to make life easier (because of less build dependencies) for package builders.

omoerbeek avatar Jan 21 '25 05:01 omoerbeek

Excellent, you should be good to go then with a bit of work. Feel free to ping me for review.

eli-schwartz avatar Jan 21 '25 06:01 eli-schwartz

I wonder if https://mesonbuild.com/Creating-releases.html should include a note about meson.add_dist_script().

jsoref avatar Jan 21 '25 12:01 jsoref

I wonder if https://mesonbuild.com/Creating-releases.html should include a note about meson.add_dist_script().

I'd say so, as it suggests there's no way to do extra work before creating the tarball and https://mesonbuild.com/Creating-releases.html#autotools-dist-vs-meson-dist also gives no clue you could.

omoerbeek avatar Jan 21 '25 12:01 omoerbeek

There is an error when building recursor in CI with meson on Debian 11:

[169/174] clang++-13  -o rec_control rec_control.p/rec_control.cc.o -fsanitize=address,undefined --coverage -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -fstack-clash-protection -fstack-protector-strong -fcf-protection=full -Werror=string-plus-int -Wp,-D_GLIBCXX_ASSERTIONS '-Wl,-rpath,$ORIGIN/settings/rust' -Wl,-rpath-link,/__w/pdns/pdns/pdns/recursordist/pdns-recursor-0.0.0-git1/settings/rust -Wl,--start-group librec-common.a settings/rust/libsettings.a ext/json11/libjson11.a ext/yahttp/yahttp/libyahttp.a librec-dnslabeltext.a /usr/lib/x86_64-linux-gnu/libboost_context.so.1.74.0 -pthread /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libluajit-5.1.so -Wl,--end-group
FAILED: rec_control 
clang++-13  -o rec_control rec_control.p/rec_control.cc.o -fsanitize=address,undefined --coverage -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -fstack-clash-protection -fstack-protector-strong -fcf-protection=full -Werror=string-plus-int -Wp,-D_GLIBCXX_ASSERTIONS '-Wl,-rpath,$ORIGIN/settings/rust' -Wl,-rpath-link,/__w/pdns/pdns/pdns/recursordist/pdns-recursor-0.0.0-git1/settings/rust -Wl,--start-group librec-common.a settings/rust/libsettings.a ext/json11/libjson11.a ext/yahttp/yahttp/libyahttp.a librec-dnslabeltext.a /usr/lib/x86_64-linux-gnu/libboost_context.so.1.74.0 -pthread /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libluajit-5.1.so -Wl,--end-group
/usr/bin/ld: /usr/bin/ld: DWARF error: could not find variable specification at offset 9280
librec-common.a.p/credentials.cc.o: in function `dns_random_uint32()':
/__w/pdns/pdns/pdns/recursordist/pdns-recursor-0.0.0-git1/../dns_random.hh:36: undefined reference to `arc4random'

For the build-and-test-all workflow, building auth with meson on Debian 11 is skipped (#14674). I am wondering if we should do the same for recursor.

Here is the run: https://github.com/PowerDNS/pdns/actions/runs/12938843578/job/36089893572

romeroalx avatar Jan 24 '25 11:01 romeroalx

I'll check if there's a quick fix, if not disabling is OK.

omoerbeek avatar Jan 24 '25 11:01 omoerbeek

  • #15085 should fix the debian11/recursor issue (and not break others)

omoerbeek avatar Jan 24 '25 14:01 omoerbeek

  • And for auth: #15086

omoerbeek avatar Jan 24 '25 14:01 omoerbeek

I wonder if https://mesonbuild.com/Creating-releases.html should include a note about meson.add_dist_script().

I'd say so, as it suggests there's no way to do extra work before creating the tarball and https://mesonbuild.com/Creating-releases.html#autotools-dist-vs-meson-dist also gives no clue you could.

Yes please, that's a silly oversight and it should definitely be amended to steer people in the right direction. Can one of you submit a PR to discuss this scenario in the docs?

eli-schwartz avatar Jan 26 '25 19:01 eli-schwartz

@romeroalx can you try a meson build for auth and rec on debian11, to verify the merged fixes work? Thanks!

omoerbeek avatar Jan 28 '25 15:01 omoerbeek

@romeroalx can you try a meson build for auth and rec on debian11, to verify the merged fixes work? Thanks!

Hi Otto, yes, I did test both on debian-11, and worked well:

Thank you for the fixes

romeroalx avatar Jan 28 '25 15:01 romeroalx

@romeroalx can you try a meson build for auth and rec on debian11, to verify the merged fixes work? Thanks!

Hi Otto, yes, I did test both on debian-11, and worked well:

* Rec: https://github.com/romeroalx/pdns/actions/runs/12983817913/job/36205682043

* Auth: https://github.com/romeroalx/pdns/actions/runs/12983817913/job/36205682444

Thank you for the fixes

Cool, then the meson build for debian11 can be re-enabled for auth I think.

omoerbeek avatar Jan 28 '25 15:01 omoerbeek

@romeroalx can you try a meson build for auth and rec on debian11, to verify the merged fixes work? Thanks!

Hi Otto, yes, I did test both on debian-11, and worked well:

* Rec: https://github.com/romeroalx/pdns/actions/runs/12983817913/job/36205682043

* Auth: https://github.com/romeroalx/pdns/actions/runs/12983817913/job/36205682444

Thank you for the fixes

Cool, then the meson build for debian11 can be re-enabled for auth I think.

Yes! I will create the PR. I'm checking an error on debian-11 when building dnsdist, but related to the yaml configuration.

Thank you!

romeroalx avatar Jan 28 '25 15:01 romeroalx

For auth, we have decided to

  1. rename the binaries back to match the autotools names
  2. switch to meson for everything like rec and dnsdist have
  3. think about binary names later, separate from the meson switch

Habbie avatar Sep 02 '25 12:09 Habbie

For dnsdist I just encountered https://github.com/PowerDNS/pdns/issues/16249

hhoffstaette avatar Oct 11 '25 16:10 hhoffstaette