Skip to content

Commit 8b25976

Browse files
committed
🐛 Fix build on alpine
1 parent d04a9e7 commit 8b25976

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM alpine:3 AS builder
2+
ARG GIT_LOGIN
3+
RUN set -xe \
4+
&& apk add --no-cache --purge -uU git cmake clang20 make openssl-libs-static openssl-dev liburing-dev linux-headers compiler-rt \
5+
&& rm -rf /var/cache/apk/* /tmp/*
6+
COPY / /src
7+
RUN mkdir /build \
8+
&& CXX=/usr/bin/clang++-20 CC=/usr/bin/clang-20 cmake -S /src -B /build \
9+
-DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=ON -DCMAKE_BUILD_TYPE=Release
10+
RUN cmake --build /build -j
11+
12+
FROM alpine:3
13+
RUN set -xe \
14+
&& apk add --no-cache --purge -uU liburing libstdc++ openssl \
15+
&& rm -rf /var/cache/apk/* /tmp/*
16+
COPY --from=builder /build/asyncpp_io-test /opt/asyncpp_io-test
17+
CMD [ "/opt/asyncpp_io-test" ]

src/io_engine_generic_unix.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
#include <sys/types.h>
1212
#include <unistd.h>
1313

14+
// Fixes for MUSL Libc that lacks *64_t types
15+
#ifndef __GLIBC__
16+
#define off64_t off_t
17+
#define stat64 stat
18+
#define fstat64 fstat
19+
#define fseeko64 fseeko
20+
#define ftello64 ftello
21+
#endif
22+
1423
namespace asyncpp::io::detail {
1524

1625
io_engine::socket_handle_t io_engine_generic_unix::socket_create(address_type domain, socket_type type) {

src/io_engine_uring.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace asyncpp::io::detail {
1010
#include <cstring>
1111
#include <mutex>
1212

13-
#include <asm/unistd_64.h>
1413
#include <fcntl.h>
1514
#include <liburing.h>
1615
#include <netinet/in.h>

0 commit comments

Comments
 (0)