Re: Building with musl in CI and the build farm
Wolfgang Walther <walther@technowledgy.de>
From: walther@technowledgy.de
To: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-03-31T13:34:23Z
Lists: pgsql-bugs, pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow "make check"-style testing to work with musl C library.
- d82605bcd666 14.12 landed
- 8a92b70c11ba 17.0 landed
- 7651fd387697 16.3 landed
- 7124e7d528a8 12.19 landed
- 3c3f4fd741d0 15.7 landed
- 243e9953281f 13.15 landed
-
Fix compiler warnings on MSYS2
- 8c6d30f21139 13.0 cited
Attachments
- 0001-Build-SanityCheck-against-musl.patch (text/x-patch) patch 0001
About building one of the CI tasks with musl: Andres Freund: > I'd rather adapt one of the existing tasks, to avoid increasing CI costs unduly. I looked into this and I think the only task that could be changed is the SanityCheck. This is because this builds without any additional features enabled. I guess that makes sense, because otherwise those dependencies would first have to be built with musl-gcc as well. > FWIW, except for one small issue, building postgres against musl works on debian and the tests pass if I install first. After the fix for LD_LIBRARY_PATH this now works as expected without installing first. I confirmed it works on debian with CC=musl-gcc. > The small problem mentioned above is that on debian linux/fs.h isn't available > when building with musl, which in turn causes src/bin/pg_upgrade/file.c to > fail to compile. According to [1], this can be worked around by linking some folders: ln -s /usr/include/linux /usr/include/x86_64-linux-musl/ ln -s /usr/include/asm-generic /usr/include/x86_64-linux-musl/ ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/x86_64-linux-musl/ Please find a patch to use musl-gcc in SanityCheck attached. Logs from the CI run are in [2]. It has this in the configure phase: [13:19:52.712] Using 'CC' from environment with value: 'ccache musl-gcc' [13:19:52.712] C compiler for the host machine: ccache musl-gcc (gcc 10.2.1 "cc (Debian 10.2.1-6) 10.2.1 20210110") [13:19:52.712] C linker for the host machine: musl-gcc ld.bfd 2.35.2 [13:19:52.712] Using 'CC' from environment with value: 'ccache musl-gcc' So meson picks up musl-gcc properly. I also double checked that without the links above, the build does indeed fail with the linux/fs.h error. I assume the installation of musl-tools should be done in the pg-vm-images repo instead of the additional script here? Best, Wolfgang [1]: https://debian-bugs-dist.debian.narkive.com/VlFkLigg/bug-789789-musl-fails-to-compile-stuff-that-depends-on-kernel-headers [2]: https://cirrus-ci.com/task/5741892590108672