-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add aarch64-linux-android target #29675
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
Changes from all commits
d92ffb3
549a9fc
f9764f8
491967e
fbb25a5
631d83f
5d3a175
95c6328
c53db69
3a76060
3fe9854
baf4cb0
a63a68b
059a44e
fcf7346
565403e
8792c32
813b539
2b66335
081363a
616b3e1
f42a15a
4a3ce1c
28958b7
b310c0d
e6c6a72
911427a
7c3c9fe
fd53f02
fdb5f46
f0c3159
c44123c
380cd90
8c1294c
a305e1f
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 |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ import { | |
| /** | ||
| * @typedef {"linux" | "darwin" | "windows"} Os | ||
| * @typedef {"aarch64" | "x64"} Arch | ||
| * @typedef {"musl"} Abi | ||
| * @typedef {"musl" | "android"} Abi | ||
| * @typedef {"debian" | "ubuntu" | "alpine" | "amazonlinux"} Distro | ||
| * @typedef {"latest" | "previous" | "oldest" | "eol"} Tier | ||
| * @typedef {"release" | "assert" | "debug" | "asan"} Profile | ||
|
|
@@ -129,6 +129,10 @@ const buildPlatforms = [ | |
| { os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.23" }, | ||
| { os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.23" }, | ||
| { os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.23" }, | ||
| // Android: cross-compiled from glibc amazonlinux via NDK sysroot. Host arch | ||
| // matches target arch so only --abi/--target/--sysroot are cross. | ||
| { os: "linux", arch: "aarch64", abi: "android", distro: "amazonlinux", release: "2023", features: ["docker"] }, | ||
| { os: "linux", arch: "x64", abi: "android", distro: "amazonlinux", release: "2023", features: ["docker"] }, | ||
|
Comment on lines
+132
to
+135
Contributor
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. Exclude Android builds from the existing baseline-verification flow. Adding Suggested follow-up outside this hunkfunction needsBaselineVerification(platform) {
- const { os, arch, baseline } = platform;
- if (os === "linux") return (arch === "x64" && baseline) || arch === "aarch64";
+ const { os, arch, abi, baseline } = platform;
+ if (os === "linux") return abi !== "android" && ((arch === "x64" && baseline) || arch === "aarch64");
if (os === "windows") return arch === "x64" && baseline;
return false;
}🤖 Prompt for AI Agents |
||
| { os: "windows", arch: "x64", release: "2019" }, | ||
| { os: "windows", arch: "x64", baseline: true, release: "2019" }, | ||
| { os: "windows", arch: "aarch64", release: "11" }, | ||
|
|
@@ -207,7 +211,9 @@ function getImageKey(platform) { | |
| key += `-with-${features.join("-")}`; | ||
| } | ||
|
|
||
| if (abi) { | ||
| // Android cross-compiles from the same glibc image as gnu (just needs NDK, | ||
| // which bootstrap.sh installs on all Linux build images) — no separate image. | ||
| if (abi && abi !== "android") { | ||
| key += `-${abi}`; | ||
| } | ||
|
|
||
|
|
@@ -488,6 +494,10 @@ function getBuildArgs(target, options, mode) { | |
| if (os === "linux") args.push(`--abi=${abi ?? "gnu"}`); | ||
| } else if (abi === "musl") { | ||
| args.push("--abi=musl"); | ||
| } else if (abi === "android") { | ||
| // Android cross-compiles C++ from a glibc host: arch/abi must be explicit | ||
| // (host detection would report the build box's gnu/x64, not the target). | ||
| args.push(`--os=${os}`, `--arch=${arch}`, "--abi=android"); | ||
| } | ||
| if (baseline) args.push("--baseline=on"); | ||
| if (profile === "asan") args.push("--asan=on"); | ||
|
|
@@ -598,6 +608,9 @@ function getTargetTriplet(platform) { | |
| if (abi === "musl") { | ||
| triplet += "-musl"; | ||
| } | ||
| if (abi === "android") { | ||
| triplet += "-android"; | ||
| } | ||
| if (baseline) { | ||
| triplet += "-baseline"; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,11 +24,28 @@ static void load_certs_from_directory(const char* dir_path, STACK_OF(X509)* cert | |
| continue; | ||
| } | ||
|
|
||
| // Check if file has .crt, .pem, or .cer extension | ||
| // Accept .crt/.pem/.cer. On Android also accept OpenSSL c_rehash-style names | ||
| // (^[0-9a-f]{8}\.[0-9]+$) since /system/etc/security/cacerts/ uses ONLY that | ||
| // format. On Debian /etc/ssl/certs/ has both *.pem and <hash>.0 symlinks to | ||
| // the same files, so accepting both there would just double-load. | ||
| const char* ext = strrchr(entry->d_name, '.'); | ||
| if (!ext || (strcmp(ext, ".crt") != 0 && strcmp(ext, ".pem") != 0 && strcmp(ext, ".cer") != 0)) { | ||
| continue; | ||
| if (!ext) continue; | ||
| bool ok = strcmp(ext, ".crt") == 0 || strcmp(ext, ".pem") == 0 || strcmp(ext, ".cer") == 0; | ||
| #ifdef __ANDROID__ | ||
| if (!ok) { | ||
| size_t prefix = (size_t)(ext - entry->d_name); | ||
| if (prefix == 8) { | ||
| ok = true; | ||
| for (size_t i = 0; i < 8; i++) { | ||
| char c = entry->d_name[i]; | ||
| if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'))) { ok = false; break; } | ||
| } | ||
| for (const char* p = ext + 1; ok && *p; p++) if (*p < '0' || *p > '9') ok = false; | ||
| if (ext[1] == '\0') ok = false; | ||
| } | ||
| } | ||
| #endif | ||
| if (!ok) continue; | ||
|
claude[bot] marked this conversation as resolved.
|
||
|
|
||
| // Build full path | ||
| char filepath[PATH_MAX]; | ||
|
|
@@ -109,7 +126,16 @@ extern "C" void us_load_system_certificates_linux(STACK_OF(X509) **system_certs) | |
|
|
||
| // Otherwise, load certificates from standard Linux/Unix paths | ||
| // These are the common locations for system certificates | ||
|
|
||
| #ifdef __ANDROID__ | ||
| // Android: no bundle files. System CAs are individual hashed PEM files. | ||
| static const char* bundle_paths[] = { NULL }; | ||
| static const char* dir_paths[] = { | ||
| "/apex/com.android.conscrypt/cacerts", // API 30+ (mainline updatable) | ||
| "/system/etc/security/cacerts", // base system store | ||
| "/data/misc/user/0/cacerts-added", // user-installed | ||
| NULL | ||
| }; | ||
|
Comment on lines
+132
to
+137
Contributor
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. User-installed certificates path hardcodes user ID 0. The path This is acceptable for initial Android support since most devices are single-user, but worth documenting as a known limitation. 🔧 Optional: Dynamic user ID resolution- "/data/misc/user/0/cacerts-added", // user-installed
+ // Note: hardcoded to user 0; multi-user devices would need
+ // runtime resolution via getuid() or directory enumeration
+ "/data/misc/user/0/cacerts-added", // user-installed (primary user only)🤖 Prompt for AI Agents |
||
| #else | ||
| // Common certificate bundle locations (single file with multiple certs) | ||
| // These paths are based on common Linux distributions and OpenSSL defaults | ||
| static const char* bundle_paths[] = { | ||
|
|
@@ -123,20 +149,21 @@ extern "C" void us_load_system_certificates_linux(STACK_OF(X509) **system_certs) | |
| "/usr/local/share/ca-certificates/ca-certificates.crt", // Custom CA installs | ||
| NULL | ||
| }; | ||
|
|
||
| // Common certificate directory locations (multiple files) | ||
| // Note: OpenSSL expects hashed symlinks in directories (c_rehash format) | ||
| static const char* dir_paths[] = { | ||
| "/etc/ssl/certs", // Common location (Debian/Ubuntu with hashed links) | ||
| "/etc/pki/tls/certs", // RHEL/Fedora | ||
| "/usr/share/ca-certificates", // Debian/Ubuntu (original certs, not hashed) | ||
| "/usr/local/share/certs", // FreeBSD | ||
| "/etc/openssl/certs", // NetBSD | ||
| "/etc/openssl/certs", // NetBSD | ||
| "/var/ssl/certs", // AIX | ||
| "/usr/local/etc/openssl/certs", // Homebrew OpenSSL on macOS | ||
| "/System/Library/OpenSSL/certs", // macOS system OpenSSL (older versions) | ||
| NULL | ||
| }; | ||
| #endif | ||
|
|
||
| // Try loading from bundle files first | ||
| for (const char** path = bundle_paths; *path != NULL; path++) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,9 @@ void us_internal_loop_update_pending_ready_polls(struct us_loop_t *loop, | |
| #define UNLIKELY(cond) __builtin_expect((_Bool)(cond), 0) | ||
| #endif | ||
|
|
||
| extern void __attribute((__noreturn__)) Bun__panic(const char *message, size_t length); | ||
|
Contributor
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify if __attribute (single underscore) is defined as a macro or used elsewhere in the codebase
# Check for a macro definition of __attribute
rg -n '#define\s+__attribute\b' --type=c --type=cpp
# Check usage patterns of __attribute vs __attribute__ in the repo
echo "=== Usage of __attribute (single underscore) ==="
rg -c '\b__attribute\s*\(' --type=c --type=cpp | head -20
echo "=== Usage of __attribute__ (double underscore) ==="
rg -c '\b__attribute__\s*\(' --type=c --type=cpp | head -20Repository: oven-sh/bun Length of output: 1027 🏁 Script executed: # First, read the actual file content around line 65
cat -n packages/bun-usockets/src/internal/internal.h | sed -n '60,70p'Repository: oven-sh/bun Length of output: 551 🏁 Script executed: # Check if there's any compatibility header or macro definition in bun-usockets
rg -n 'define.*__attribute' packages/bun-usockets/ -t c -t cpp -t h
# Also check the main libusockets.h file to see the pattern
echo "=== Checking libusockets.h ==="
head -20 packages/bun-usockets/src/libusockets.hRepository: oven-sh/bun Length of output: 894 🏁 Script executed: # Check for any include guards or compatibility definitions that might explain single underscore
rg -B2 -A2 '__attribute\s*\(' packages/bun-usockets/src/internal/internal.hRepository: oven-sh/bun Length of output: 220 Fix the Line 65 uses 🤖 Prompt for AI Agents |
||
| #define BUN_PANIC(message) Bun__panic(message, sizeof(message) - 1) | ||
|
|
||
| #ifdef _WIN32 | ||
| #define IS_EINTR(rc) (rc == SOCKET_ERROR && WSAGetLastError() == WSAEINTR) | ||
| #define LIBUS_ERR WSAGetLastError() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.