musl libc support
Warnings are bad! - Found one in your library deep within another:
#17 120.2 In file included from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/rabit/include/rabit/internal/socket.h:38,
#17 120.2 from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/src/collective/loop.cc:15:
#17 120.2 /usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
#17 120.2 1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
#17 120.2 | ^~~~~~~
#17 120.2 In file included from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/rabit/include/rabit/internal/socket.h:38,
#17 120.2 from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/src/collective/socket.cc:14:
#17 120.2 /usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
#17 120.2 1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
#17 120.2 | ^~~~~~~
#17 120.2 In file included from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/rabit/include/rabit/internal/socket.h:38,
#17 120.2 from /tmp/wd/postgresml/pgml-extension/target/debug/build/xgboost-sys-a1e545b7b843ddb4/out/xgboost/src/collective/tracker.cc:4:
#17 120.2 /usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
#17 120.2 1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
#17 120.2 | ^~~~~~~
EDIT0: Another one, resolved it same way they did https://github.com/gperftools/gperftools/issues/693' ; a simple #define mmap64 mmap
EDIT1: To replicate, here's a Dockerfile:
FROM alpine
RUN apk add --no-cache cmake gcc g++ make musl-dev
WORKDIR /src/xgboost
COPY . .
RUN cmake -S . -B build && \
cmake --build build
Thank you for the replies. Looking closer, I think the musl folks are right and there's no need to make specialization for musl. Please see the inlined comments for the proposed changes.
@trivialfis Yes that is correct; if you use poll.h and mmap then you won't need this PR. As for the mmap fallout, you can also check the other direction, if mmap64 is available then _LARGEFILE64_SOURCE is defined or more correctly #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS >= 64 then you can use that symbol. See also: https://pubs.opengroup.org/onlinepubs/009695399/utilities/c99.html#tag_04_12_13_03
Otherwise sure you can just switch to mmap over mmap64 for everyone. It's your call*.
*pun intended?
Yes that is correct; if you use poll.h and mmap then you won't need this PR
Sounds great! That should make things much simpler. Would you like to help make the fix?
As for the mmap fallout, you can also check the other direction
I don't think that's necessary, users of 32-bit platforms can reduce the batch size to be smaller than 2 GB.
@trivialfis Sure thing done in #10767