fix(appimage): wrong $ARCH used by linuxdeploy #36712

Problem:
In scripts/genappimage.sh running on arm64 host, the $ARCH will be set to
'arm64' before calling linuxdeploy, which cause linuxdeploy to generate
an 32bit ELF executable instead 64bit. See the issue for more details.

Solution:
Keep $ARCH unchanged, use $ARCH_OUTPUT in the output file name. On arm64
host, $ARCH_OUTPUT will be converted to 'arm64'.
This commit is contained in:
Siwen Yu
2025-11-28 01:33:12 +08:00
committed by GitHub
parent e4ce0c7270
commit 4daa8eb5ab

View File

@@ -11,7 +11,7 @@ if [ -z "$ARCH" ]; then
ARCH="$(arch)" ARCH="$(arch)"
export ARCH export ARCH
fi fi
ARCH_ORIGINAL=$ARCH ARCH_OUTPUT=$ARCH
TAG=$1 TAG=$1
@@ -77,29 +77,28 @@ chmod 755 AppRun
cd "$APP_BUILD_DIR" || exit # Get out of AppImage directory. cd "$APP_BUILD_DIR" || exit # Get out of AppImage directory.
# We want to be consistent, so always use arm64 over aarch64 # We want to be consistent, so always use arm64 over aarch64
if [[ "$ARCH" == 'aarch64' ]]; then if [[ "$ARCH_OUTPUT" == 'aarch64' ]]; then
ARCH="arm64" ARCH_OUTPUT="arm64"
export ARCH
fi fi
# Set the name of the file generated by appimage # Set the name of the file generated by appimage
export OUTPUT=nvim-linux-"$ARCH".appimage export OUTPUT=nvim-linux-"$ARCH_OUTPUT".appimage
# If it's a release generate the zsync file # If it's a release generate the zsync file
if [ -n "$TAG" ]; then if [ -n "$TAG" ]; then
export UPDATE_INFORMATION="gh-releases-zsync|neovim|neovim|$TAG|nvim-linux-$ARCH.appimage.zsync" export UPDATE_INFORMATION="gh-releases-zsync|neovim|neovim|$TAG|nvim-linux-$ARCH_OUTPUT.appimage.zsync"
fi fi
# Generate AppImage. # Generate AppImage.
# - Expects: $ARCH, $APP, $VERSION env vars # - Expects: $ARCH, $APP, $VERSION env vars
# - Expects: ./$APP.AppDir/ directory # - Expects: ./$APP.AppDir/ directory
# - Produces: ./nvim-linux-$ARCH.appimage # - Produces: ./nvim-linux-$ARCH_OUTPUT.appimage
./linuxdeploy-"$ARCH_ORIGINAL".AppImage --appdir $APP.AppDir -d "$ROOT_DIR"/runtime/nvim.desktop -i \ ./linuxdeploy-"$ARCH".AppImage --appdir $APP.AppDir -d "$ROOT_DIR"/runtime/nvim.desktop -i \
"$ROOT_DIR/runtime/nvim.png" --output appimage "$ROOT_DIR/runtime/nvim.png" --output appimage
# Moving the final executable to a different folder so it isn't in the # Moving the final executable to a different folder so it isn't in the
# way for a subsequent build. # way for a subsequent build.
mv "$ROOT_DIR"/build/nvim-linux-"$ARCH".appimage* "$ROOT_DIR"/build/bin mv "$ROOT_DIR"/build/nvim-linux-"$ARCH_OUTPUT".appimage* "$ROOT_DIR"/build/bin
echo 'genappimage.sh: finished' echo 'genappimage.sh: finished'