mirror of
https://github.com/denoland/deno
synced 2024-08-24 18:47:06 +00:00
fix(npm): support compiling on linux/aarch64 (#16208)
Changes introduced in #13633 have broken the ability to compile for linux/aarch64 - specifically the use of a `i8` as a char type, which is an `u8` on linux/aarch64. This PR: - Replaces instances of `i8` with the architecture-aware wrapper type `c_char` - Skips the use of `--export-dynamic-symbol` on linux-aarch64, because the target environments often rely on older libc/binutils versions
This commit is contained in:
parent
3b6b75bb46
commit
a2488ae792
|
@ -67,6 +67,9 @@ pub fn benchmark(
|
|||
#[cfg(target_vendor = "apple")]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
let bun_exe = test_util::prebuilt_tool_path("bun-aarch64");
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
let bun_exe = test_util::prebuilt_tool_path("bun-aarch64");
|
||||
|
||||
// bun <path> <port>
|
||||
res.insert(
|
||||
|
|
|
@ -343,7 +343,10 @@ fn main() {
|
|||
.display(),
|
||||
);
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(all(
|
||||
not(target_os = "windows"),
|
||||
not(all(target_os = "linux", target_arch = "aarch64"))
|
||||
))]
|
||||
{
|
||||
// Load the symbols file generated by the `napi_sym` macro.
|
||||
#[derive(serde::Deserialize)]
|
||||
|
@ -375,6 +378,10 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
// Linux + aarch64 does not support a glibc version that supports `--export-dynamic-symbol`.
|
||||
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
|
||||
println!("cargo:rustc-link-arg-bin=deno=-rdynamic");
|
||||
|
||||
// To debug snapshot issues uncomment:
|
||||
// op_fetch_asset::trace_serializer();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use deno_runtime::deno_napi::*;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
|
@ -125,7 +126,7 @@ const NODE_VERSION: napi_node_version = napi_node_version {
|
|||
major: 17,
|
||||
minor: 4,
|
||||
patch: 0,
|
||||
release: "Deno\0".as_ptr() as *const i8,
|
||||
release: "Deno\0".as_ptr() as *const c_char,
|
||||
};
|
||||
|
||||
#[napi_sym::napi_sym]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use napi_sys::Status::napi_ok;
|
||||
use napi_sys::ValueType::napi_function;
|
||||
use napi_sys::*;
|
||||
use std::os::raw::c_void;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use std::ptr;
|
||||
|
||||
pub struct Baton {
|
||||
|
@ -62,7 +62,7 @@ extern "C" fn test_async_work(
|
|||
unsafe {
|
||||
napi_create_string_utf8(
|
||||
env,
|
||||
"test_async_resource\0".as_ptr() as *const i8,
|
||||
"test_async_resource\0".as_ptr() as *const c_char,
|
||||
usize::MAX,
|
||||
&mut resource_name,
|
||||
)
|
||||
|
|
|
@ -42,7 +42,7 @@ macro_rules! get_callback_info {
|
|||
macro_rules! new_property {
|
||||
($env: expr, $name: expr, $value: expr) => {
|
||||
napi_property_descriptor {
|
||||
utf8name: $name.as_ptr() as *const i8,
|
||||
utf8name: $name.as_ptr() as *const std::os::raw::c_char,
|
||||
name: ptr::null_mut(),
|
||||
method: Some($value),
|
||||
getter: None,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use napi_sys::Status::napi_ok;
|
||||
use napi_sys::ValueType::napi_number;
|
||||
use napi_sys::*;
|
||||
use std::os::raw::c_void;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use std::ptr;
|
||||
|
||||
pub struct NapiObject {
|
||||
|
@ -146,7 +146,7 @@ pub fn init(env: napi_env, exports: napi_value) {
|
|||
napi_set_named_property(
|
||||
env,
|
||||
exports,
|
||||
"NapiObject\0".as_ptr() as *const i8,
|
||||
"NapiObject\0".as_ptr() as *const c_char,
|
||||
cons,
|
||||
)
|
||||
} == napi_ok
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use napi_sys::PropertyAttributes::*;
|
||||
use napi_sys::Status::napi_ok;
|
||||
use napi_sys::*;
|
||||
use std::os::raw::c_char;
|
||||
use std::ptr;
|
||||
|
||||
pub fn init(env: napi_env, exports: napi_value) {
|
||||
|
@ -15,7 +16,7 @@ pub fn init(env: napi_env, exports: napi_value) {
|
|||
unsafe {
|
||||
napi_create_string_utf8(
|
||||
env,
|
||||
"key_v8_string".as_ptr() as *const i8,
|
||||
"key_v8_string".as_ptr() as *const c_char,
|
||||
usize::MAX,
|
||||
&mut name_value,
|
||||
)
|
||||
|
@ -29,7 +30,7 @@ pub fn init(env: napi_env, exports: napi_value) {
|
|||
unsafe {
|
||||
napi_create_string_utf8(
|
||||
env,
|
||||
"key_v8_symbol".as_ptr() as *const i8,
|
||||
"key_v8_symbol".as_ptr() as *const c_char,
|
||||
usize::MAX,
|
||||
&mut symbol_description,
|
||||
)
|
||||
|
@ -42,7 +43,7 @@ pub fn init(env: napi_env, exports: napi_value) {
|
|||
|
||||
let properties = &[
|
||||
napi_property_descriptor {
|
||||
utf8name: "test_property_rw\0".as_ptr() as *const i8,
|
||||
utf8name: "test_property_rw\0".as_ptr() as *const c_char,
|
||||
name: ptr::null_mut(),
|
||||
method: None,
|
||||
getter: None,
|
||||
|
@ -52,7 +53,7 @@ pub fn init(env: napi_env, exports: napi_value) {
|
|||
value: number,
|
||||
},
|
||||
napi_property_descriptor {
|
||||
utf8name: "test_property_r\0".as_ptr() as *const i8,
|
||||
utf8name: "test_property_r\0".as_ptr() as *const c_char,
|
||||
name: ptr::null_mut(),
|
||||
method: None,
|
||||
getter: None,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9f314cefb507e3b9de08edc6046353e4012279fc
|
||||
Subproject commit 17fd391b8f305d1e74ce7508c824176f09ab63d0
|
Loading…
Reference in a new issue