Skip to content

Commit

Permalink
Update supported Alpine to 3.20
Browse files Browse the repository at this point in the history
This commit updates our CI to test using Alpine 3.20 for musl testing.
It also updates our release and nightly alpine ponyc images to be based
on Alpine 3.20.

Due to a change in the version of musl in Alpine 3.20, this required
a small patch LLVM 15 to compile. When we move to LLVM 16 or above,
the patch shouldn't be needed.
  • Loading branch information
SeanTAllen committed Dec 3, 2024
1 parent 0b8ac49 commit c28bd29
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .ci-dockerfiles/x86-64-unknown-linux-musl-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18
FROM alpine:3.20


RUN apk update \
Expand All @@ -19,7 +19,7 @@ RUN apk update \
gdb \
lldb \
py3-lldb \
&& pip install cloudsmith-cli
&& pip install --break-system-packages cloudsmith-cli

# add user pony in order to not run tests as root
RUN adduser -D -u 1001 -s /bin/sh -h /home/pony -g root pony
Expand Down
2 changes: 1 addition & 1 deletion .dockerfiles/latest/x86-64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18
FROM alpine:3.20

ENV PATH "/root/.local/share/ponyup/bin:$PATH"

Expand Down
2 changes: 1 addition & 1 deletion .dockerfiles/release/x86-64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18
FROM alpine:3.20

ENV PATH "/root/.local/share/ponyup/bin:$PATH"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
name: x86-64-unknown-linux-ubuntu20.04
triple-os: linux-ubuntu20.04
triple-vendor: unknown
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl
triple-os: linux-musl
triple-vendor: unknown
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu24.04-builder:20240425
name: x86-64 Linux glibc
debugger: lldb
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64 Linux musl
debugger: lldb

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
name: x86-64-unknown-linux-ubuntu20.04
triple-os: linux-ubuntu20.04
triple-vendor: unknown
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl
triple-os: linux-musl
triple-vendor: unknown
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/stress-test-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ jobs:
name: x86-64-unknown-linux-ubuntu24.04 [cd] [debug]
target: test-stress-with-cd-debug
debugger: lldb
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl [release]
target: test-stress-release
debugger: lldb
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl [debug]
target: test-stress-debug
debugger: lldb
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl [cd] [release]
target: test-stress-with-cd-release
debugger: lldb
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
name: x86-64-unknown-linux-musl [cd] [debug]
target: test-stress-with-cd-debug
debugger: lldb
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-lib-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu24.04-builder:20240425
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu22.04-builder:20230924
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu20.04-builder:20230830
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241202
- image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-musl-builder:20241203
- image: ghcr.io/ponylang/ponyc-ci-cross-arm:20240427
- image: ghcr.io/ponylang/ponyc-ci-cross-armhf:20240427
- image: ghcr.io/ponylang/ponyc-ci-cross-riscv64:20240427
Expand Down
3 changes: 3 additions & 0 deletions .release-notes/alpine-320.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Update Pony musl Docker images to Alpine 3.20

We've updated our `ponylang/ponyc:latest-alpine`, `ponylang/ponyc:release-alpine`, and `ponylang/ponyc:x.y.z-alpine` images to be based on Alpine 3.20. Previously, we were using Alpine 3.18 as the base.
11 changes: 5 additions & 6 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ install(TARGETS blake2
find_package(Git)

set(LLVM_DESIRED_HASH "8dfdcc7b7bf66834a761bd8de445840ef68e4d1a")
set(PATCHES_DESIRED_HASH "3e16c097794cb669a8f6a0bd7600b440205ac5c29a6135750c2e83263eb16a95")
set(PATCHES_DESIRED_HASH "99d46d25e96861de9847c055aeda1fef13fa0219524b2b7074c9acedb5f7a1c4")

if(GIT_FOUND)
if(EXISTS "${PROJECT_SOURCE_DIR}/../.git")
Expand Down Expand Up @@ -93,15 +93,14 @@ if(GIT_FOUND)
set(PATCHES_ACTUAL_HASH "needed_if_no_patches")
foreach (PATCH ${PONY_LLVM_PATCHES})
file(STRINGS ${PATCH} patch_file NEWLINE_CONSUME)
string(REPLACE "\n" " " patch_file ${patch_file})
string(SHA256 patch_file_hash ${patch_file})
# message("${PATCH}: '${patch_file_hash}'")
string(REPLACE "\n" " " patch_file "${patch_file}")
string(SHA256 patch_file_hash "${patch_file}")
string(CONCAT PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH} ${patch_file_hash})
# message("concat is '${PATCHES_ACTUAL_HASH}'")
endforeach()
string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
# message("Desired hash ${PATCHES_DESIRED_HASH}")
# message("Actual hash ${PATCHES_ACTUAL_HASH}")
#message("Desired hash ${PATCHES_DESIRED_HASH}")
#message("Actual hash ${PATCHES_ACTUAL_HASH}")
if(NOT PATCHES_ACTUAL_HASH MATCHES "${PATCHES_DESIRED_HASH}")
message(FATAL_ERROR "Patch hash actual '${PATCHES_ACTUAL_HASH}' does not match desired '${PATCHES_DESIRED_HASH}'")
endif()
Expand Down
87 changes: 87 additions & 0 deletions lib/llvm/patches/llvm15-musl-lseek64.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 7e657fd15..54cd1f0d6 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE )
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
endif()
-set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE")
-check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64)
-set(CMAKE_REQUIRED_DEFINITIONS "")
check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL)
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2)
@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
if( LLVM_USING_GLIBC )
add_definitions( -D_GNU_SOURCE )
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+ # enable 64bit off_t on 32bit systems using glibc
+ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
+ add_compile_definitions(_FILE_OFFSET_BITS=64)
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
+ endif()
endif()
# This check requires _GNU_SOURCE
if (NOT PURE_WINDOWS)
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 21ce3a94a..d551ebad5 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -128,9 +128,6 @@
/* Define to 1 if you have the <link.h> header file. */
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}

-/* Define to 1 if you have the `lseek64' function. */
-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64}
-
/* Define to 1 if you have the <mach/mach.h> header file. */
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}

diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 651949ad5..0bc71812c 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
flush();
#ifdef _WIN32
pos = ::_lseeki64(FD, off, SEEK_SET);
-#elif defined(HAVE_LSEEK64)
- pos = ::lseek64(FD, off, SEEK_SET);
#else
pos = ::lseek(FD, off, SEEK_SET);
#endif
diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 897364f00..e4f49e5e2 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -139,7 +139,6 @@ write_cmake_config("config") {
values += [
"HAVE_FUTIMENS=1",
"HAVE_LINK_H=1",
- "HAVE_LSEEK64=1",
"HAVE_MALLINFO=1",
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
]
@@ -147,7 +146,6 @@ write_cmake_config("config") {
values += [
"HAVE_FUTIMENS=",
"HAVE_LINK_H=",
- "HAVE_LSEEK64=",
"HAVE_MALLINFO=",
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=",
]
diff --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake
index 21ce3a94a..d551ebad5 100644
--- a/utils/bazel/llvm_configs/config.h.cmake
+++ b/utils/bazel/llvm_configs/config.h.cmake
@@ -128,9 +128,6 @@
/* Define to 1 if you have the <link.h> header file. */
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}

-/* Define to 1 if you have the `lseek64' function. */
-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64}
-
/* Define to 1 if you have the <mach/mach.h> header file. */
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}

6 changes: 3 additions & 3 deletions packages/files/file.pony
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use @_write[I32](fd: I32, buffer: Pointer[None], bytes_to_send: I32) if windows
use @writev[ISize](fd: I32, buffer: Pointer[None], num_to_send: I32)
if not windows
use @_lseeki64[I64](fd: I32, offset: I64, base: I32) if windows
use @lseek64[I64](fd: I32, offset: I64, base: I32) if linux
use @llseek[I64](fd: I32, offset: I64, base: I32) if linux
use @lseek[I64](fd: I32, offset: I64, base: I32) if not windows and not linux
use @FlushFileBuffers[Bool](file_handle: Pointer[None]) if windows
use @_get_osfhandle[Pointer[None]](fd: I32) if windows
Expand Down Expand Up @@ -442,7 +442,7 @@ class File
@_lseeki64(_fd, o, b)
else
ifdef linux then
@lseek64(_fd, o, b)
@llseek(_fd, o, b)
else
@lseek(_fd, o, b)
end
Expand Down Expand Up @@ -631,7 +631,7 @@ class File
@_lseeki64(_fd, offset, base)
else
ifdef linux then
@lseek64(_fd, offset, base)
@llseek(_fd, offset, base)
else
@lseek(_fd, offset, base)
end
Expand Down

0 comments on commit c28bd29

Please sign in to comment.