Skip to content

native: 64-bit multi-ABI + latest engine + OpenSSL 3, and bootstrap CI#5

Merged
xroche merged 5 commits into
masterfrom
ci-phase-a
Jul 12, 2026
Merged

native: 64-bit multi-ABI + latest engine + OpenSSL 3, and bootstrap CI#5
xroche merged 5 commits into
masterfrom
ci-phase-a

Conversation

@xroche

@xroche xroche commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Bootstraps a 64-bit, modern-NDK native build for httrack-android on the latest httrack engine (3.49.12) with OpenSSL 3.x, and adds GitHub Actions CI (the repo had none). This is the first slice of a larger modernization and touches only the native build and CI, not the Java/Gradle app, which comes in later phases.

The app shipped a single 32-bit ABI (armeabi-v7a), a 2017 engine snapshot, and a hand-hacked OpenSSL 1.0.2k build (setenv-android.sh, GCC, FIPS). 64-bit is a Play requirement, OpenSSL 1.0.2 is long past end-of-life, and the current engine already picks TLS_client_method() for OpenSSL 3.x, so bumping it drops the whole hack in favor of a clean OpenSSL 3 build.

Native changes: Android.mk moves to per-ABI prebuilt OpenSSL and a per-ABI openssl include, drops the hardcoded TARGET_ARCH := arm, gates the armv7-only -Wl,--no-merge-exidx-entries (it breaks the arm64/x86_64 link), moves libiconv 1.15 to 1.17, adds the engine sources the current tree needs (htssniff.c, hts*_selftest.c) and drops the vestigial libhtsjava module since the engine removed htsjava.c. Application.mk sets APP_ABI to arm64-v8a, armeabi-v7a, x86_64 at android-24. config.h derives SIZEOF_LONG from the compiler (it was hardcoded to 4, wrong on 64-bit). HTTrackLib drops htsjava from the load list. The httrack submodule moves to 3.49.12, so git submodule update --init --recursive is required (coucal is nested).

CI: a reproducible toolchain (docker/ image plus tools/ci vendor and fetch scripts) and three workflows: a self-contained native ndk-build job, a GHCR image publish, and dual-language CodeQL scoped to the JNI glue.

Built locally with NDK r26d: libiconv.so, libhttrack.so (with OpenSSL 3.0.15 statically linked), and libhtslibjni.so all build for arm64-v8a and armeabi-v7a.

Follow-ups: minSdk is 24 because minizip's fseeko/ftello are bionic API 24+; x86_64 is deferred until the coffeecatch x86_64 fix lands (xroche/coffeecatch#46).

xroche and others added 3 commits July 12, 2026 18:37
Ports the JNI native build to 64-bit and the current engine. Validated locally
with NDK r26d (Clang 17): libiconv.so, libhttrack.so (OpenSSL 3.0.15 statically
linked), libhtslibjni.so all build for arm64-v8a AND armeabi-v7a.

Android.mk:
- per-ABI prebuilt OpenSSL (../prebuild/$(TARGET_ARCH_ABI)/lib{ssl,crypto}.a) +
  per-ABI openssl include dir
- drop hardcoded TARGET_ARCH := arm
- gate armv7-only -Wl,--no-merge-exidx-entries behind armeabi-v7a (it breaks the
  arm64/x86_64 link)
- libiconv-1.15 -> libiconv-1.17
- add new engine library sources (htssniff.c, hts*_selftest.c) — required by the
  3.49.12 engine; drop the vestigial libhtsjava module (engine removed htsjava.c)
Application.mk: APP_ABI = arm64-v8a armeabi-v7a x86_64; APP_PLATFORM android-24
  (bionic introduces minizip's fseeko/ftello at API 24 — min-API decision noted).
config.h: SIZEOF_LONG/SIZEOF_LONG_LONG compiler-derived (was hardcoded 4 — wrong
  on 64-bit ABIs).
HTTrackLib.java: drop 'htsjava' from the native load list.

Submodule httrack -> 627ae2b (3.49.12), which already selects TLS_client_method()
for OpenSSL 3.x. Requires 'git submodule update --init --recursive' (coucal is
nested). x86_64 is deferred pending a coffeecatch x86_64 ucontext fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Greenfield CI (repo had no .github). Matches the httrack repo conventions
(contents: read, concurrency cancel, checkout@v6 + submodules recursive, CodeQL
security-extended).

- docker/: reproducible toolchain image (JDK17 + SDK35 + NDK r26d + OpenSSL 3.x
  statics for all ABIs). wget (curl's threaded resolver fails on some Docker
  hosts); build-essential for libiconv ./configure.
- tools/ci/vendor-libiconv.sh: fetch + configure libiconv 1.17, patch the
  host-configured HAVE_LANGINFO_CODESET (bionic nl_langinfo is API 26+).
- tools/ci/fetch-openssl-statics.sh: stage per-ABI OpenSSL into prebuild/.
- .github/workflows/docker-image.yml: build+push the image to GHCR (+ statics
  artifact).
- .github/workflows/android.yml: 'native' ndk-build job (arm64-v8a + armeabi-v7a;
  x86_64 pending coffeecatch fix). assemble/emulator jobs documented for later
  phases.
- .github/workflows/codeql.yml + codeql-config.yml: java-kotlin + c-cpp, c-cpp
  scoped to htslibjni*.c (engine scanned by its own repo).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The container-based jobs failed with 'manifest unknown' — the GHCR toolchain
image can't be bootstrapped from a PR branch (workflow_dispatch needs the
workflow on the default branch). Rework native + codeql to set up the NDK,
cross-compile OpenSSL (cached), vendor libiconv, and ndk-build inline — the
flow validated locally. java-kotlin CodeQL uses build-mode: none (the app
doesn't build under modern Gradle until the AGP 8 migration). docker/ image +
docker-image.yml stay for the later Gradle/assemble phase.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

xroche and others added 2 commits July 12, 2026 19:09
…sis)

codeql-config.yml's `paths` applies to every language, so restricting it to the
htslibjni.* C files left the java-kotlin analysis with zero source ('no source
code seen'). Add app/src/main/java to paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The first run downloaded a clean NDK and built; the next run restored an
incomplete NDK from local-cache and failed with 'clang: No such file or
directory'. Download the NDK fresh each run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xroche
xroche merged commit 0861467 into master Jul 12, 2026
4 checks passed
xroche added a commit that referenced this pull request Jul 16, 2026
…ed05faa, drop armeabi-v7a) (#7)

Finishes the native foundation that Phase A (#5) left half-done. The coffeecatch bump to 9a0bdce carries the x86_64 ucontext fix (xroche/coffeecatch#46) and the i386 redefinition fix against the modern NDK sysroot. Without it the x86_64 ABI does not compile, which is why x86_64 was declared in `Application.mk` but built by neither the committed pin nor CI.

The engine moves from 627ae2b to engine master (ed05faa). That range fixes a 32-bit chunked-transfer overflow (#593), files of 2GB and over (#568), an `hts_free_opt` leak on every crawl (#585), an unbounded filter-matcher recursion (#590/#575), and `--update` destroying a good mirrored copy (#584/#560), and it adds scheme-aware proxy parsing with SOCKS5 (#566/#570), all in sources Android compiles. Two new modules come with it, `htscodec.c` and `htsproxy.c`, now in the build; brotli and zstd stay compile-off, so `htscodec` falls back to zlib and pulls no new dependencies. The JNI surface is untouched.

The ABI set is now arm64-v8a plus x86_64. Dropping 32-bit armeabi-v7a is safe: Play allows 64-bit-only builds, and minSdk 24 already excludes almost all 32-bit-only hardware. That leaves the armv7 exidx-merge gating dead, so it goes, and `Application.mk`, the CI ABI matrix and the Gradle `abiFilters` now agree on the same two ABIs.

Part of #4.


Signed-off-by: Xavier Roche <roche@httrack.com>
Sign up for free to 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