mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix(linux): auto-detect and handle .relr.dyn sections for AppImage builds
Modern Linux distributions (Arch, Fedora 39+, Ubuntu 24.04+) compile libraries with .relr.dyn ELF sections. The bundled strip binary in linuxdeploy cannot process these sections, causing AppImage builds to fail. This commit: - Adds hasRelrDynSections() to proactively detect modern toolchains - Automatically disables stripping (NO_STRIP=1) when detected - Fixes error output to properly display as string - Adds documentation explaining the issue and workaround Fixes #4642 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b35ee41073
commit
3d46f4867d
2 changed files with 44 additions and 1 deletions
|
|
@ -145,3 +145,16 @@ sudo pacman -S base-devel
|
|||
```
|
||||
|
||||
Alternatively, run `wails3 task setup:docker` and the build system will use Docker automatically.
|
||||
|
||||
### AppImage strip compatibility {#appimage-strip-compatibility}
|
||||
|
||||
On modern Linux distributions (Arch Linux, Fedora 39+, Ubuntu 24.04+), system libraries are compiled with `.relr.dyn` ELF sections for more efficient relocations. The `linuxdeploy` tool used to create AppImages bundles an older `strip` binary that cannot process these modern sections.
|
||||
|
||||
Wails automatically detects this situation by checking system GTK libraries before building the AppImage. When detected, stripping is disabled (`NO_STRIP=1`) to ensure compatibility.
|
||||
|
||||
**What this means:**
|
||||
- AppImages will be slightly larger (~20-40%) on affected systems
|
||||
- The application functionality is not affected
|
||||
- This is handled automatically—no action required
|
||||
|
||||
If you need smaller AppImages on modern systems, you can install a newer `strip` binary and configure `linuxdeploy` to use it instead of its bundled version.
|
||||
|
|
|
|||
|
|
@ -190,9 +190,17 @@ func generateAppImage(options *GenerateAppImageOptions) error {
|
|||
|
||||
cmd := fmt.Sprintf("%s --appimage-extract-and-run --appdir %s --output appimage --plugin gtk", linuxdeployAppImage, appDir)
|
||||
s.SETENV("DEPLOY_GTK_VERSION", DeployGtkVersion)
|
||||
|
||||
// Check if system libraries use .relr.dyn sections (modern toolchains)
|
||||
// If so, disable stripping as linuxdeploy's bundled strip can't handle them
|
||||
if hasRelrDynSections() {
|
||||
term.Infof("Detected modern toolchain (.relr.dyn sections), disabling stripping for compatibility. See: https://v3.wails.io/guides/build/linux#appimage-strip-compatibility")
|
||||
s.SETENV("NO_STRIP", "1")
|
||||
}
|
||||
|
||||
output, err := s.EXEC(cmd)
|
||||
if err != nil {
|
||||
println(output)
|
||||
fmt.Println(string(output))
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -248,3 +256,25 @@ func findGTKFiles(files []string) ([]string, error) {
|
|||
}
|
||||
return found, nil
|
||||
}
|
||||
|
||||
// hasRelrDynSections checks if system libraries use .relr.dyn sections
|
||||
// which are incompatible with linuxdeploy's bundled strip binary.
|
||||
// This is common on modern Linux distributions (Arch, Fedora 39+, Ubuntu 24.04+).
|
||||
func hasRelrDynSections() bool {
|
||||
// Check common GTK library that will be bundled
|
||||
testLibs := []string{
|
||||
"/usr/lib/libgtk-3.so.0",
|
||||
"/usr/lib64/libgtk-3.so.0",
|
||||
"/usr/lib/x86_64-linux-gnu/libgtk-3.so.0",
|
||||
}
|
||||
|
||||
for _, lib := range testLibs {
|
||||
if _, err := os.Stat(lib); err == nil {
|
||||
output, err := s.EXEC(fmt.Sprintf("readelf -S %s", lib))
|
||||
if err == nil && strings.Contains(string(output), ".relr.dyn") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue