-
-
Notifications
You must be signed in to change notification settings - Fork 0
Don't bundle alsa lib #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,16 @@ if [ -e "${ROOT}/etc/crypto-policies/back-ends/gnutls.config" ]; then | |
| fi | ||
|
|
||
|
|
||
| # ALSA (libasound.so.2) is deliberately never bundled (see MiscDeploy::HandleAlsa): its plugin modules, config, and hardware UCM profiles are versioned together by the running distro, and bundling a build-time snapshot instead breaks device access on a mismatched host. | ||
| # But the bundled ld-linux has had "/lib", "/usr", and "/etc" patched out of its own compiled-in strings (see DeployInterpreter) so it can no longer fall back to the default system library directories or /etc/ld.so.cache to find anything not explicitly rpath'd within the AppDir. | ||
| # Preloading the host's copy by its exact absolute path satisfies that one SONAME directly for the whole process, without reopening host-library search (and the ABI mismatches that guards against) for anything else that *is* bundled. | ||
| for ALSA_LIB in /usr/lib/x86_64-linux-gnu/libasound.so.2 /usr/lib/aarch64-linux-gnu/libasound.so.2 /usr/lib64/libasound.so.2 /usr/lib/libasound.so.2 /lib/x86_64-linux-gnu/libasound.so.2; do | ||
| if [ -e "${ALSA_LIB}" ]; then | ||
| export LD_PRELOAD="${LD_PRELOAD:+${LD_PRELOAD}:}${ALSA_LIB}" | ||
| break | ||
| fi | ||
| done | ||
|
Comment on lines
+75
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '--- data/apprun.sh ---\n'
nl -ba data/apprun.sh | sed -n '1,160p'
printf '\n--- src/dependencywalker.h ---\n'
nl -ba src/dependencywalker.h | sed -n '1,140p'
printf '\n--- src/miscdeploy.cpp ---\n'
nl -ba src/miscdeploy.cpp | sed -n '1,260p'
printf '\n--- src/miscdeploy.h ---\n'
nl -ba src/miscdeploy.h | sed -n '1,120p'
printf '\n--- README.md ---\n'
nl -ba README.md | sed -n '1,120p'
printf '\n--- ALSA search ---\n'
rg -n "libasound|ALSA|alsa-lib|AppRun|LD_PRELOAD" data src README.mdRepository: jonaski/appimagetools Length of output: 250 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- data/apprun.sh ---'
nl -ba data/apprun.sh | sed -n '1,160p'
echo
echo '--- src/dependencywalker.h ---'
nl -ba src/dependencywalker.h | sed -n '1,140p'
echo
echo '--- src/miscdeploy.cpp ---'
nl -ba src/miscdeploy.cpp | sed -n '1,260p'
echo
echo '--- src/miscdeploy.h ---'
nl -ba src/miscdeploy.h | sed -n '1,120p'
echo
echo '--- README.md ---'
nl -ba README.md | sed -n '1,120p'
echo
echo '--- ALSA search ---'
rg -n "libasound|ALSA|alsa-lib|AppRun|LD_PRELOAD" data src README.mdRepository: jonaski/appimagetools Length of output: 222 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- data/apprun.sh ---'
sed -n '1,160p' data/apprun.sh | cat -n
echo
echo '--- src/dependencywalker.h ---'
sed -n '1,140p' src/dependencywalker.h | cat -n
echo
echo '--- src/miscdeploy.cpp ---'
sed -n '1,260p' src/miscdeploy.cpp | cat -n
echo
echo '--- src/miscdeploy.h ---'
sed -n '1,120p' src/miscdeploy.h | cat -n
echo
echo '--- README.md ---'
sed -n '1,120p' README.md | cat -n
echo
echo '--- ALSA search ---'
rg -n "libasound|ALSA|alsa-lib|AppRun|LD_PRELOAD" data src README.mdRepository: jonaski/appimagetools Length of output: 50379 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- arch/support search ---'
rg -n "x86_64|aarch64|armhf|arm64|riscv64|ppc64le|supported architectures|architecture" README.md src data | head -n 200
echo
echo '--- libasound search ---'
rg -n "libasound|ALSA" src data README.md
echo
echo '--- AppRun template source ---'
sed -n '40,90p' src/appimagedeploy.cpp | cat -nRepository: jonaski/appimagetools Length of output: 7088
📍 Affects 5 files
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| # Set GStreamer paths | ||
| GST_PLUGIN_CORE_ELEMENTS="$(find "${ROOT}" -name "libgstcoreelements.so" -type f 2>/dev/null | head -1)" | ||
|
|
@@ -109,6 +119,7 @@ echo "GDK_PIXBUF_MODULEDIR: ${GDK_PIXBUF_MODULEDIR}" | |
| echo "GDK_PIXBUF_MODULE_FILE: ${GDK_PIXBUF_MODULE_FILE}" | ||
| echo "SSL_CERT_FILE: ${SSL_CERT_FILE}" | ||
| echo "GNUTLS_SYSTEM_PRIORITY_FILE: ${GNUTLS_SYSTEM_PRIORITY_FILE}" | ||
| echo "LD_PRELOAD: ${LD_PRELOAD}" | ||
| echo "GST_PLUGIN_PATH: ${GST_PLUGIN_PATH}" | ||
| echo "GST_PLUGIN_SYSTEM_PATH: ${GST_PLUGIN_SYSTEM_PATH}" | ||
| echo "GST_PLUGIN_SCANNER: ${GST_PLUGIN_SCANNER}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,9 @@ class DependencyWalker { | |
| // With $QTDIR/$QT_ROOT_DIR added ahead of everything but rpath so a custom Qt build's own libraries are preferred over a same-named system copy. Returns an empty string if not found. | ||
| QString FindLibrary(const QString &filename); | ||
|
|
||
| // Removes every already-registered ELF whose filename starts with `filename_prefix` from all_elfs(), so it is never copied into the AppDir. library_locations() is left untouched - a stale search directory is harmless. For libraries that must always be resolved against the running system rather than bundled (e.g. ALSA): once removed here, the dynamic linker falls through the AppDir rpath (now empty for this name) to the host's own copy at runtime, same as for any other unbundled system library. | ||
| void RemoveElfsByFilenamePrefix(const QString &filename_prefix); | ||
|
|
||
|
Comment on lines
+52
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Document the preload requirement. 🤖 Prompt for AI Agents |
||
| private: | ||
| void EnsureDefaultLibraryLocations(); | ||
| void AppendLib(const QString &path); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ bool HandleGdk(DependencyWalker &dependency_walker, const AppDir &appdir, QStrin | |
| // Returns false and sets error_message on failure. | ||
| bool DeployGtkDirectory(DependencyWalker &dependency_walker, const AppDir &appdir, const int gtk_version, QString &error_message); | ||
|
|
||
| // Bundles the alsa-lib plugin directory if libasound is a dependency. Best-effort: only warns if not found. | ||
| // Removes libasound.so* from the dependency set if present, so ALSA is always resolved against the running system's alsa-lib rather than bundled: its plugin modules, /usr/share/alsa config, and hardware UCM profiles are versioned together by the host and bundling them breaks device access on any host whose alsa-lib/UCM data doesn't exactly match the build host's (see miscdeploy.cpp for the failure mode this avoids). | ||
| void HandleAlsa(DependencyWalker &dependency_walker); | ||
|
Comment on lines
+45
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== files ==\n'
git ls-files | rg '(^|/)(src/miscdeploy\.h|src/miscdeploy\.cpp|README|readme|AppRun|app-run|desktop).*'
printf '\n== outline miscdeploy.h ==\n'
ast-grep outline src/miscdeploy.h --view expanded || true
printf '\n== outline miscdeploy.cpp ==\n'
ast-grep outline src/miscdeploy.cpp --view expanded || true
printf '\n== relevant text search ==\n'
rg -n --hidden -S 'HandleAlsa|libasound|ALSA|AppRun|preload|LD_LIBRARY_PATH|rpath|run.*system|bundled' src README* .github 2>/dev/null || trueRepository: jonaski/appimagetools Length of output: 19964 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,140p' src/miscdeploy.h
printf '\n---\n'
sed -n '1,260p' src/miscdeploy.cppRepository: jonaski/appimagetools Length of output: 15967 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show the exact implementation around ALSA handling.
sed -n '1,220p' src/miscdeploy.h
printf '\n--- miscdeploy.cpp ---\n'
sed -n '1,260p' src/miscdeploy.cpp
printf '\n--- matches for AppRun / library resolution ---\n'
rg -n -S 'AppRun|LD_LIBRARY_PATH|libasound|ALSA|HandleAlsa|dependency_walker|bundled' . --glob '!**/.git/**' --glob '!**/node_modules/**' || trueRepository: jonaski/appimagetools Length of output: 43840 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '60,90p' data/apprun.sh
printf '\n---\n'
sed -n '28,38p' README.mdRepository: jonaski/appimagetools Length of output: 3833 Qualify the ALSA runtime contract. 🤖 Prompt for AI Agents |
||
|
|
||
| // Bundles the gio/modules directory (and its giomodule.cache, which unlike loaders.cache/immodules.cache holds no absolute paths so needs no patching) if libgio-2.0 is a dependency, so bundled GIO can still load its extra modules (gsettings backends, TLS backend, proxy resolvers, volume monitors) via GIO_EXTRA_MODULES. Best-effort: only warns if not found. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: jonaski/appimagetools
Length of output: 220
🏁 Script executed:
Repository: jonaski/appimagetools
Length of output: 243
🏁 Script executed:
Repository: jonaski/appimagetools
Length of output: 13645
Avoid claiming unconditional ALSA resolution —
data/apprun.shonly preloadslibasound.so.2from a fixed set of paths, so hosts that install ALSA elsewhere won’t get that guarantee.🤖 Prompt for AI Agents