Repository navigation
Add Linux build target (x64 + arm64, shared library) - #7
Merged
Merged
Conversation
Specs the shared-library, multi-arch (x64/arm64) build target mirroring the Android module structure, with a portable-glibc build strategy for distribution to arbitrary Linux app/server consumers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Research during plan-writing found the portable-glibc goal is already met by Chromium's default use_sysroot/use_custom_libcxx behavior for target_os=linux -- no pinned old base image or manual static-link flags are needed, only an explicit arm64 sysroot fetch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Task-by-task plan mirroring the Android module structure, with an empirical build spike (arm64 native, then x64 cross-compile) in the existing OrbStack VM before wiring up install/test/archive/CI/docs, so the arm64-sysroot and shared-library-naming assumptions get validated early rather than assumed throughout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds modules/linux.py mirroring modules/android.py, implementing the six task functions (build_pdfium, patch, build, install, test, archive) for Linux. Wires the module into make.py's import list, docstring Tasks list, and task dispatch chain between the Android and WASM sections.
Task 3's first execution attempt discovered that PDFium's DEPS unconditionally fetches a buildtools/reclient CIPD package with no linux-arm64 build for the pinned version, so gclient sync fails outright on an arm64 Linux host regardless of target arch. Switched the plan (and the OrbStack doc section it produces) to a fresh amd64 VM, which also matches CI's ubuntu-24.04 (x64) runner architecture. Swapped Task 4/5's native/cross-compile arch assignments to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- modules/linux.py: run_task_test() now fails the build if libpdfium.so links against libstdc++ or libc++, guarding the static-libc++ linking guarantee (use_custom_libcxx) that was verified empirically against the build artifacts (readelf/objdump showed no libstdc++.so/libc++.so in NEEDED, glibc floor 2.16/2.17) but had no automated check. - .github/workflows/linux.yml: install pkg-config and libglib2.0-dev explicitly, since the existing "PDFium build dependencies" step (echo n | install-build-deps.sh) always hits the script's confirmation prompt and aborts without installing anything — it provides no real guarantee these packages are present on the runner.
The design spec still said `orb create ubuntu`, which defaults to the host's architecture (arm64 on Apple Silicon). Task 3's implementation found that PDFium's DEPS unconditionally fetches a buildtools/reclient CIPD package with no linux-arm64 build, so gclient sync fails on an arm64 host. docs/BUILD_LINUX.md and the implementation plan were already corrected to `orb create -a amd64 ubuntu`; this brings the design spec in line and notes the correction.
This project's format task (make.py format) uses black; the readelf check added in the portability regression guard wasn't yet formatted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libpdfium.soforx64andarm64, following the samemodules/*.py+make.pytask pattern used for iOS/macOS/Android/WASM (modules/linux.pymirrorsmodules/android.py, since both are shared-library, multi-arch targets).use_sysroot/use_custom_libcxxdefaults fortarget_os="linux"rather than a custom base image — verified empirically against the real compiled binaries:readelf -dshows no dependency onlibstdc++/libc++(statically linked), and the glibc floor is 2.16 (x64) / 2.17 (arm64), well below even Ubuntu 20.04's. A regression guard for this was added torun_task_test..github/workflows/linux.yml(nativeubuntu-24.04runner, no Docker, matching the other workflows) anddocs/BUILD_LINUX.md, and updates the README roadmap/platforms list.DEPSunconditionally fetches abuildtools/reclientCIPD package with nolinux-arm64build, sogclient syncfails outright on any arm64 Linux host (not project-specific — affects local dev via arm64 VMs, e.g. on Apple Silicon). Documented the amd64-VM workaround indocs/BUILD_LINUX.md.Test plan
modules/config.py/modules/common.pybuild-arg changes verified via direct Python import/print checksmodules/linux.py+make.pywiring verified viapython3 -c "import make"andpython3 make.py -hgclient sync+ both amd64/arm64 Chromium sysroots fetched)ELF 64-bitshared objects (fileconfirmedx86-64/ARM aarch64respectively)install-linux/test-linux/archive-linuxrun end-to-end, producing a reallinux.tgzwithlib/{x64,arm64}/libpdfium.so+include/headersreadelf -d(nolibstdc++/libc++dependency) andobjdump -T(glibc floor 2.16/2.17).github/workflows/linux.ymlYAML syntax validated