Skip to content

Commit 1001924

Browse files
author
Scaffold Bot
committed
fix(demo-01): repair scratch-static build (alpine 3.21 for clang19 + add static-musl preset)
1 parent d5ec754 commit 1001924

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

examples/demo-01-image-strategy/CMakePresets.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
"CMAKE_CXX_FLAGS_RELEASE": "-O3 -DNDEBUG -fno-plt"
4141
}
4242
},
43+
{
44+
"name": "static-musl",
45+
"inherits": "_base",
46+
"displayName": "Static musl build with clang + lld, thin LTO (scratch runtime)",
47+
"cacheVariables": {
48+
"CMAKE_C_COMPILER": "clang",
49+
"CMAKE_CXX_COMPILER": "clang++",
50+
"CMAKE_EXE_LINKER_FLAGS": "-static -fuse-ld=lld -flto=thin",
51+
"CMAKE_CXX_FLAGS_RELEASE": "-O3 -DNDEBUG -flto=thin"
52+
}
53+
},
4354
{
4455
"name": "pgo-generate",
4556
"inherits": "_base",
@@ -66,6 +77,7 @@
6677
{ "name": "release", "configurePreset": "release" },
6778
{ "name": "release-static", "configurePreset": "release-static" },
6879
{ "name": "release-static-libstdcxx", "configurePreset": "release-static-libstdcxx" },
80+
{ "name": "static-musl", "configurePreset": "static-musl" },
6981
{ "name": "pgo-generate", "configurePreset": "pgo-generate" },
7082
{ "name": "pgo-use", "configurePreset": "pgo-use" }
7183
]

examples/demo-01-image-strategy/Containerfile.scratch-static

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
# Build:
2121
# podman build -f Containerfile.scratch-static -t demo-01-scratch-static .
2222

23-
FROM docker.io/alpine:3.20 AS build
23+
# alpine 3.21 is the first release carrying clang19/lld19 (3.20 shipped
24+
# clang17); the toolchain label below pins the intent to clang 19.
25+
FROM docker.io/alpine:3.21 AS build
2426

2527
# `libstdc++-static` is the actual archive (libstdc++.a) we link with -static.
2628
# It's separate from g++ on Alpine and isn't pulled by build-base. If the

0 commit comments

Comments
 (0)