-
Notifications
You must be signed in to change notification settings - Fork 117
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
Unable to build in alpine arm64 (musl-libc) #129
Comments
Notice I'm trying with the |
If you don't want to bother with qemu translation, the error still reproduces (and runs much faster) using native x86_64 alpine: FROM alpine as casync
RUN apk update && apk upgrade
RUN apk add build-base git
RUN apk add meson xz-dev curl-dev openssl-dev zstd-dev acl-dev fuse-dev linux-headers
RUN git clone --branch=v2 --depth=1 https://github.com/systemd/casync.git
WORKDIR /casync
RUN meson build -Dselinux=false -Dudev=false -Dman=false
RUN ninja -C build |
There is something strange going on here. I even tried adding edit: adding the include does help, but I get to other errors. I'll see if I can PR a fix. |
Ok, so the biggest issues are this code uses lots of gnu extensions and isn't portable to other libc implementations like musl. I was able to get it mostly compiling by adding the following to #ifndef strdupa
#define strdupa(s) strcpy(alloca(strlen(s) + 1), s)
#endif
#ifndef strndupa
#define strndupa(s, n) strncpy(alloca(strnlen(s, n) + 1), s, n)
#endif
#ifndef comparison_fn_t
typedef int (comparison_fn_t) (const void *, const void *);
#endif But I'm having a harder time implementing a replacement for |
Here's another related bug report where a project can't port to musl because of depending on |
We'd be happy to merge a patch that adds compatibility with musl, but I don't think any of the maintainers are going to develop it. It's outside of our scope of interest, sorry. |
Oh, and in general, it seems better to add missing interfaces like |
So, scandirat() and strdupa() really are something your libc should provide, please ask them to add this, both are genuinely useful, and in particular in the case of scandirat() are not easy to emulate safely. If this is fixed in your libc once, everybody benefits, including the folks hacking on apparmor for examples. In particular as doing scandirat() if you already have scandir() is trivial, but not if you don't... |
This is really problematic: you are doing stack allocation from within function parameters. This is not generally considered safe in C (because preparing function params themselves affect the stack), and only works on some archs/compilers. |
iirc mode_t is defined in sys/types.h and not in sys/stat.h |
Understood, thanks for the feedback. For now, I just wrote up a quick tiny set of tools that fits my needs. It's not as fancy as casync, but for my needs, it's almost as good. And it's a lot easier than trying to convince musl upstream to pull in functions they've already said they don't want to implement and then wait for alpine to update to said updated musl version once/if it's upstreamed. |
Thanks. I was reading the man page and must have misread which it said to use. |
Some include corrections, as suggested by systemd#129
Some include corrections, as suggested by systemd#129
Some include corrections, as suggested by systemd#129
This comment has been minimized.
This comment has been minimized.
…ted so far in musl and uclibc We use it just when listing tracepoint events, and for root, so just emit a warning about it to get users to ask the library maintainers to implement it, as suggested in this systemd ticket: systemd/casync#129 Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/lkml/ZCwv4z5Dh%2FdHUMG6@kernel.org/ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
I'm trying to build casync in an alpine docker container so I can use it in my alpine based embedded system. I'm having build issues I suspect are because this code hasn't been tested with musl-libc.
To reproduce, try to build the following:
I get the following errors:
The text was updated successfully, but these errors were encountered: