[发现一个问题]macos 下使用 docker 编译 linux+amd64 架构的 csharp 程序,在运行时发生 coredump
Posted on 2026-07-16 20:37 ahfuzhang 阅读(12) 评论(0) 收藏 举报作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!
编译参数如下:
build_release:
docker run -it --rm \
--platform linux/amd64 \
-m 2048m \
-v "./":/src/ \
-w /src/server/csharp_backend/ \
ahfuzhang/csharp-dbg-all-in-one:dotnet10 \
bash -lc -x ' \
dotnet restore csharp_backend.csproj -r linux-x64 && \
dotnet clean csharp_backend.csproj -r linux-x64 -c Release && \
dotnet publish csharp_backend.csproj \
-r linux-x64 \
-p:DefineConstants=UNIX \
-p:AllowUnsafeBlocks=true \
-p:PublishAot=true \
-p:StripSymbols=false \
-p:StaticLinkedRuntime=true \
-p:StaticExecutable=true \
-p:PositionIndependentExecutable=false \
-p:InvariantGlobalization=true \
-p:OptimizationPreference=Size \
-p:CppCompilerAndLinker=clang \
-p:EventSourceSupport=true \
-p:PublishReadyToRun=true \
-p:EmbedAllSources=true \
--self-contained true \
-c Release \
-o /src/build/Release/linux/amd64/'
编译成独立二进制后,运行在 k8s 环境中发生 coredump.
因为容器环境中缺少调试器,暂时未找到 coredump 的原因。

浙公网安备 33010602011771号