这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(main/oxlint): fix build for 32-bit targets #25482

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

Merged
merged 1 commit into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions packages/oxlint/32-bit-block-align-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Fixes:
error: literal out of range for `usize`
--> napi/oxlint2/src/generated/raw_transfer_constants.rs:8:32
|
8 | pub const BLOCK_ALIGN: usize = 4294967296;
when targeting 32-bit

--- a/tasks/ast_tools/src/generators/raw_transfer.rs
+++ b/tasks/ast_tools/src/generators/raw_transfer.rs
@@ -1066,7 +1066,7 @@ fn generate_constants(consts: Constants) -> (String, TokenStream) {

///@@line_break
pub const BLOCK_SIZE: usize = #block_size;
- pub const BLOCK_ALIGN: usize = #block_align;
+ pub const BLOCK_ALIGN: u64 = #block_align;
pub const BUFFER_SIZE: usize = #buffer_size;
pub const RAW_METADATA_SIZE: usize = #raw_metadata_size;
};
--- a/napi/oxlint2/src/generated/raw_transfer_constants.rs
+++ b/napi/oxlint2/src/generated/raw_transfer_constants.rs
@@ -5,6 +5,6 @@
#![allow(dead_code)]

pub const BLOCK_SIZE: usize = 2147483632;
-pub const BLOCK_ALIGN: usize = 4294967296;
+pub const BLOCK_ALIGN: u64 = 4294967296;
pub const BUFFER_SIZE: usize = 2147483616;
pub const RAW_METADATA_SIZE: usize = 16;
diff --git a/napi/oxlint2/src/lib.rs b/napi/oxlint2/src/lib.rs
index 4ce833a..83b228b 100644
--- a/napi/oxlint2/src/lib.rs
+++ b/napi/oxlint2/src/lib.rs
@@ -82,7 +82,7 @@ fn wrap_run(cb: JsRunCb) -> ExternalLinterCb {
// the backing allocation.
let chunk_ptr = unsafe {
let ptr = metadata_ptr.cast::<u8>();
- let offset = ptr.as_ptr() as usize % BLOCK_ALIGN;
+ let offset = (ptr.as_ptr() as u64 % BLOCK_ALIGN) as usize;
ptr.sub(offset)
};

1 change: 1 addition & 0 deletions packages/oxlint/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Oxc JavaScript linter"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="1.8.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://github.com/oxc-project/oxc/archive/refs/tags/oxlint_v$TERMUX_PKG_VERSION.tar.gz"
TERMUX_PKG_SHA256=238659b1f44e6b62e78e045e893d3b46b2714d986c1a3c7478b088b05d7ca2b1
TERMUX_PKG_AUTO_UPDATE=true
Expand Down