Skip to content

Build fixes: host portability, and 16 KB page alignment for the sink module - #1

Merged
joshuatam merged 4 commits into
GameNative:mainfrom
Zum0DePapaya:fix/build-portability-and-16kb-alignment
Aug 10, 2026
Merged

Build fixes: host portability, and 16 KB page alignment for the sink module#1
joshuatam merged 4 commits into
GameNative:mainfrom
Zum0DePapaya:fix/build-portability-and-16kb-alignment

Conversation

@Zum0DePapaya

Copy link
Copy Markdown

Four small build-script fixes. Three are host-portability issues that stop a fresh clone from building anywhere but the maintainer's machine; one is a page-alignment bug in the artifact that actually ships.

Discussed in the GameNative Discord #code-changes thread beforehand.

1. Derive the automake version from the host

main-build.sh patched the vendored libtool / libsndfileaclocal.m4 files with sed -i 's/1.15/1.18/g', which assumes automake 1.18 is installed. On any other host autoreconf then demands a version that isn't present and the build stops. Now derived from automake --version.

2. Seed .tarball-version so a fresh clone can configure

configure.ac derives the package version through ./git-version-gen, which needs either a reachable git tag or a .tarball-version file. The pulseaudio fork carries no tags and .tarball-version is gitignored, so on a fresh clone git-version-gen returns empty and configure.ac:34 aborts with git-version-gen failed.

Seeded with 13.0 only when absent. bootstrap.sh then rewrites it to 13.0-rebootstrapped, which is the exact version string the currently shipped binaries report — so this reproduces the existing artifacts rather than changing them.

3. 16 KB page-size linker flags for the module build

main-build.sh exports -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384 globally, and pulseaudio-module/CMakeLists.txt sets them too — but pulseaudio-module/build.sh invokes clang directly without them, and create-asset.sh copies from build64/, i.e. build.sh's output. So the module that actually ships is the one built without the flags.

Measured on the current pulseaudio-gamenative-20260612.tzst:

0x4000 modules/module-native-protocol-unix.so
0x4000 modules/libprotocol-native.so
0x1000 modules/module-aaudio-sink.so <- only this one

libpulsecore-13.0.so and the rest of jniLibs are 0x4000 as well. On a device booted with 16 KB pages the loader cannot map a 4 KB-aligned library, so dlopen of the sink module would fail; because the daemon runs with --fail=false it would stay up with no sink at all, which presents as "no audio on the pulseaudio driver" rather than an obvious crash.

Worth noting this isn't covered by Play's 16 KB compliance check, which scans lib/**/*.so inside the APK — all 27 of those are already correctly aligned. This module ships compressed inside assets/*.tzst and is extracted and dlopen'd at runtime, so the scanner never sees it.

Caveat: I don't have a 16 KB-page device, so I have not observed the dlopen failure in the field. What is verified is that building the module both ways from identical source gives 0x1000 without the flags and 0x4000 with them.

4. Use $HOME for the NDK path in the module build

pulseaudio-module/build.sh hardcoded /home/joshua/Android/Sdk/ndk/... while main-build.sh next to it already resolves the same NDK through $HOME. Without this, the module build fails immediately with aarch64-linux-android26-clang: No such file or directory for anyone else — including anyone trying to verify fix 3.


Verification

On Ubuntu 24.04 with NDK r27d (27.3.13750724), from a clean clone with only these four commits applied:

  • main-build.sh -a arm64 completes, banner reports pulseaudio 13.0-rebootstrapped
  • pulseaudio-module/build.sh produces module-aaudio-sink.so at LOAD align 0x4000
  • The build reproduces the shipped artifacts byte-for-byte: pactl, libprotocol-native.so and module-native-protocol-unix.so from the .tzst, plus libpulsecore-13.0.so, libsndfile.so and libltdl.so from jniLibs

Only libpulse.so / libpulseaudio.so / libpulsecommon-13.0.so differ, purely because they embed the build prefix path — confirmed by building at two different prefix lengths and seeing the size delta scale accordingly.

No functional change to the built binaries beyond the alignment of the sink module. ac_cv_func_mkfifo=no is deliberately left untouched here — that's a separate discussion.

Zum0DePapayaand others added 4 commits August 10, 2026 02:47
main-build.sh patched the vendored libtool/libsndfile aclocal.m4 files with
`sed -i 's/1.15/1.18/g'`, which only works on a host that has automake 1.18
installed. On anything else autoreconf then demands a version that isn't
there and the build stops.
Derive the version from `automake --version` instead, so the tree builds
regardless of which automake the host provides. Verified on Ubuntu 24.04
(automake 1.16.5).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
configure.ac derives the package version through ./git-version-gen, which
needs either a reachable git tag or a .tarball-version file. The pulseaudio
fork carries no tags and .tarball-version is listed in .gitignore, so on a
fresh clone git-version-gen returns an empty string and configure.ac:34
aborts with "git-version-gen failed".
Seed the file with 13.0 when it is absent. bootstrap.sh then rewrites it to
13.0-rebootstrapped, which is the version string the currently shipped
binaries report, so this reproduces the existing artifacts rather than
changing them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
main-build.sh exports -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384
globally, and pulseaudio-module/CMakeLists.txt sets them too, but
pulseaudio-module/build.sh invokes clang directly without them. create-asset.sh
copies from build64/, i.e. build.sh's output, so the module that actually ships
is the one built without the flags.
The result is that module-aaudio-sink.so has PT_LOAD alignment 0x1000 while
every other binary in the same asset (pactl, libprotocol-native.so,
module-native-protocol-unix.so) and the jniLibs (libpulsecore-13.0.so) are all
0x4000. On a device booted with 16 KB pages the loader cannot map a 4 KB
aligned library, so dlopen of the sink module would fail; with
--fail=false the daemon stays up but has no sink at all.
This is not covered by Play's 16 KB compliance check, which scans lib/**/*.so
inside the APK. The module ships compressed inside assets/*.tzst and is
extracted and dlopen'd at runtime, so the scanner never sees it.
Building the module both ways from identical source gives 0x1000 without the
flags and 0x4000 with them. Not tested on real 16 KB hardware.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pulseaudio-module/build.sh hardcodes /home/joshua/Android/Sdk/ndk/... while
main-build.sh, sitting next to it, already resolves the same NDK through
$HOME. On any other machine the module build fails immediately with
"aarch64-linux-android26-clang: No such file or directory".
Use $HOME so both scripts agree and the module can be rebuilt by anyone with
the NDK installed at the documented location.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joshuatam
joshuatam merged commit 80205be into GameNative:mainAug 10, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Zum0DePapaya@joshuatam