Skip to content

Commit 1985ddb

Browse files
committed
installsrc: disable AOT for the install-from-source build
Native AOT links the published binary with clang. Leaving it on for a source install would force every distro to install a C toolchain just to build a local copy, which is why the install-from-source validation fails across the board with "gcc or clang is missing". Installing from source does not need a native binary, so turn AOT off for it alone: set PublishAot=false in the environment for the build (the executable project honours an externally supplied value, and the nested publish inherits it through the packaging scripts). With AOT off, layout.sh's existing self-contained, single-file publish produces a portable binary that needs only the .NET SDK to build and bundles its own runtime to run - so it launches even on the distros where the SDK was installed to a non-standard location. The shipped packages set nothing and still default to AOT. This is a deliberate stopgap that leaves the rest of the install-from-source flow as-is; a later commit reworks install-from-source handling altogether. Assisted-by: Claude Opus 4.8 Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 2c3ebd0 commit 1985ddb

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/linux/Packaging.Linux/install-from-source.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,9 @@ if [ -z "$DOTNET_ROOT" ]; then
259259
fi
260260

261261
cd "$toplevel_path"
262-
$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix
262+
# Build a non-AOT binary so installing from source needs only the .NET SDK,
263+
# not a C toolchain (clang + zlib) to link a native build. PublishAot is read
264+
# from the environment by Git-Credential-Manager.csproj and inherited by the
265+
# nested publish.
266+
$sudo_cmd env "PATH=$PATH" PublishAot=false $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix
263267
add_to_PATH "$installPrefix/bin"

src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
<IsTestProject>false</IsTestProject>
1111
<LangVersion>latest</LangVersion>
1212
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
13-
<PublishAot>true</PublishAot>
13+
<!-- Produce a native AOT build by default. Building from source can set
14+
PublishAot=false in the environment to opt out, so installing locally
15+
doesn't require a C toolchain (clang + zlib) just to link. -->
16+
<PublishAot Condition="'$(PublishAot)' == ''">true</PublishAot>
1417
</PropertyGroup>
1518

1619
<ItemGroup>

0 commit comments

Comments
 (0)