-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow avro C to be built on musl based systems. #740
Conversation
The type `ssize_t` is defined in sys/types.h, and nowhere else in the musl standard C library, so it should be included for the compilation to succeed. This fixes several errors like: In file included from src/generic.c:29:0: src/generic.c: In function ‘avro_generic_value_new’: src/avro_generic_internal.h:63:39: error: ‘ssize_t’ undeclared (first use in this function); did you mean ‘size_t’? Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
It should be possible to test this with an Alpine container. I took a crack at it, but I wasn't able to successfully build avro. It's probably more to do with my own ignorance of the build system. |
@kojiromike indeed, there are a few required packages to be able to compile within Alpine:
I succeeded to build the C part with this Dockerfile (placed at the toplevel): FROM alpine:latest
WORKDIR /root
RUN apk update
RUN apk add bash gcc g++ make cmake jansson-dev musl-dev
COPY . .
WORKDIR /root/lang/c
RUN mkdir build && cd build && cmake .. && make Eventually running the same Dockerfile without the patch in this PR would not succeed |
Hello! This is the one-liner I used for musl:
I can confirm that it fails without the change in this PR, and succeeds with the change. I know for glibc (like the build process uses), we can do the equivalent:
I'm not sure about |
I tested a |
Hello @kojiromike and @RyanSkraba , is there anything needed to make this move forward ? Please let me know if I can do anything to help |
I was able to run this on alpine and confirm what Ryan said. However, I'm concerned that we don't have any automated test set up for TravisCI, so any future committer could accidentally break musl support again and not realize it. |
Oh, I forgot to mention: I checked uClibc with an 4 year old version of alpine (not super satisfactory or confident about it):
What do you think about merging this and creating a JIRA about improving the build with a "secondary" check on lang/c&musl? It would be consistent with the lang/csharp&windows check. Edit: I created https://issues.apache.org/jira/browse/AVRO-2660. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RyanSkraba Sounds good to me. Do you want to do the honors?
I'd like to practice, if that's OK :D I'm on it! |
Currently, the avro C library can not be built for Linux systems based on the musl standard C library, which is often used on embedded systems. See the full commit message for more details.
This PR has been tested against the following C libraries, on x86 and arm architectures:
Make sure you have checked all steps below.
Jira
Tests
Commits
Documentation