Build failures on Alpine Linux
robert-scheck opened this issue · comments
Trying to build rpki-client 6.7p1 for Alpine Linux leads to:
main.c: In function 'proc_rsync':
main.c:652:26: error: 'WAIT_ANY' undeclared (first use in this function)
652 | while ((pid = waitpid(WAIT_ANY, &st, WNOHANG)) > 0) {
| ^~~~~~~~
main.c:652:26: note: each undeclared identifier is reported only once for each function it appears in
According to https://git.alpinelinux.org/aports/tree/main/openvswitch/0002-fix-wait-any.patch?id=37504e4898503d315252c439ab6bb250a198d2e2, this can be solved by putting
#ifndef WAIT_ANY
#define WAIT_ANY (-1)
#endif
into the code. However, then the build fails like this:
tal.c: In function 'tal_parse_buffer':
tal.c:113:15: error: implicit declaration of function 'b64_pton' [-Werror=implicit-function-declaration]
113 | if ((b64sz = b64_pton(buf, b64, sz)) < 0)
| ^~~~~~~~
cc1: some warnings being treated as errors
Or, when adding -Wno-error=implicit-function-declaration
, like this:
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: rpki_client-tal.o: in function `tal_parse_buffer':
tal.c:(.text+0x33b): undefined reference to `b64_pton'
collect2: error: ld returned 1 exit status
And yes, ./configure
made this assuming already:
…
checking for library containing __b64_pton... no
checking for __b64_pton... no
…
Using b64_pton()
from
- https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/base64.h
- https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/base64.c
did the trick as it seems.
We plan to use the -lcrypto base64 decode API instead of pulling more code into compat.
So b64_pton() will be replaced soon.
The WAIT_PID define is something we may need to add somewhere in the compat include headers.