From a2488ae79200abfcbad0f0f8b084a3ff8e183880 Mon Sep 17 00:00:00 2001 From: Luke Channings <461449+LukeChannings@users.noreply.github.com> Date: Mon, 10 Oct 2022 03:29:31 +0100 Subject: 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 --- test_napi/src/properties.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test_napi/src/properties.rs') diff --git a/test_napi/src/properties.rs b/test_napi/src/properties.rs index 89d95d6c6..b245fd61d 100644 --- a/test_napi/src/properties.rs +++ b/test_napi/src/properties.rs @@ -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, -- cgit v1.2.3