From 0f51831bf54267327ecb348883d7b120b9e4b0fb Mon Sep 17 00:00:00 2001 From: Christophe Alladoum Date: Mon, 10 Nov 2025 13:17:57 -0800 Subject: [PATCH 1/5] restored ubuntu arm64 builds on ci --- .github/workflows/build.yml | 2 +- build.rs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0090fb0..9224599 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: variants: # - {os: ubuntu-22.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - {os: ubuntu-24.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - # - {os: ubuntu-24.04-arm, config: release, compiler: linux_gcc_arm64, aqt_os: linux_arm64, aqt_compiler: linux_gcc_arm64} + - {os: ubuntu-24.04-arm, config: release, compiler: gcc_arm64, aqt_os: linux_arm64, aqt_compiler: gcc_arm64} # - {os: windows-2022, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - {os: windows-2025, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - {os: macos-14, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} diff --git a/build.rs b/build.rs index facd36d..b9a9597 100644 --- a/build.rs +++ b/build.rs @@ -26,7 +26,13 @@ fn get_qt_libs_path() -> String { return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/macos/lib"); #[cfg(target_os = "linux")] - return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/gcc_64/lib"); + { + #[cfg(target_arch = "aarch64")] + return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/gcc_arm64/lib"); + + #[cfg(target_arch = "x86_64")] + return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/gcc_64/lib"); + } } fn qt_download() { @@ -51,7 +57,13 @@ fn qt_download() { .args(["-m", "aqt", "install-qt", "-O", LIBDIE_BUILD_DIR]); #[cfg(target_os = "linux")] - cmd.args(["linux", "desktop", QT_VERSION]); + { + #[cfg(target_arch = "x86_64")] + cmd.args(["linux", "desktop", QT_VERSION]); + + #[cfg(target_arch = "aarch64")] + cmd.args(["linux_arm64", "desktop", QT_VERSION, "linux_gcc_arm64"]); + } #[cfg(target_os = "macos")] cmd.args(["mac", "desktop", QT_VERSION, "clang_64"]); #[cfg(target_os = "windows")] From 964b822e6dcfef891ff1efd52fb6c0849ef0b946 Mon Sep 17 00:00:00 2001 From: Christophe Alladoum Date: Mon, 10 Nov 2025 13:32:41 -0800 Subject: [PATCH 2/5] restore macos too --- .github/workflows/build.yml | 12 +++++------- build.rs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9224599..871ece2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,13 +16,11 @@ jobs: fail-fast: false matrix: variants: - # - {os: ubuntu-22.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - - {os: ubuntu-24.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - - {os: ubuntu-24.04-arm, config: release, compiler: gcc_arm64, aqt_os: linux_arm64, aqt_compiler: gcc_arm64} - # - {os: windows-2022, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - - {os: windows-2025, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - - {os: macos-14, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} - # - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} + - {os: ubuntu-24.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} + - {os: ubuntu-24.04-arm, config: release, compiler: gcc_arm64, aqt_os: linux_arm64, aqt_compiler: gcc_arm64} + - {os: windows-2025, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} + - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} + # - {os: macos-14, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} runs-on: ${{ matrix.variants.os }} steps: - uses: actions/checkout@v5 diff --git a/build.rs b/build.rs index b9a9597..ef07124 100644 --- a/build.rs +++ b/build.rs @@ -65,7 +65,7 @@ fn qt_download() { cmd.args(["linux_arm64", "desktop", QT_VERSION, "linux_gcc_arm64"]); } #[cfg(target_os = "macos")] - cmd.args(["mac", "desktop", QT_VERSION, "clang_64"]); + cmd.args(["mac", "desktop", QT_VERSION]); #[cfg(target_os = "windows")] cmd.args(["windows", "desktop", QT_VERSION, "win64_msvc2022_64"]); From 010f206fcd62e79e1c58bfcab455fd602d7e474d Mon Sep 17 00:00:00 2001 From: Christophe Alladoum Date: Mon, 10 Nov 2025 16:44:13 -0800 Subject: [PATCH 3/5] fixed ffi stuff --- src/lib.rs | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e6fbefb..b20ee53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,12 +46,12 @@ bitflags! { #[link(name = "die", kind = "static")] unsafe extern "C" { // Definitions from die.h - fn DIE_FreeMemoryA(str: *const i8); - fn DIE_ScanFileA(fname: *const i8, flags: u32, db: *const i8) -> *const i8; - fn DIE_ScanFileExA(fname: *const i8, flags: u32) -> *mut i8; - fn DIE_ScanMemoryA(mem: *const u8, len: u32, flags: u32, db: *const i8) -> *mut i8; - fn DIE_ScanMemoryExA(mem: *const u8, len: u32, flags: u32) -> *mut i8; - fn DIE_LoadDatabaseA(fname: *const i8) -> i32; + fn DIE_FreeMemoryA(str: *const u8); + fn DIE_ScanFileA(fname: *const u8, flags: u32, db: *const u8) -> *const u8; + fn DIE_ScanFileExA(fname: *const u8, flags: u32) -> *const u8; + fn DIE_ScanMemoryA(mem: *const u8, len: u32, flags: u32, db: *const u8) -> *const u8; + fn DIE_ScanMemoryExA(mem: *const u8, len: u32, flags: u32) -> *const u8; + fn DIE_LoadDatabaseA(fname: *const u8) -> i32; } /// Scans a file at the specified path using the provided scan flags. @@ -89,8 +89,10 @@ pub fn scan_file(fpath: &Path, flags: ScanFlags) -> Result { let fpath = CString::new(fpath.to_str().ok_or(Error::ConversionFailure)?)?; unsafe { - let res = DIE_ScanFileExA(fpath.as_ptr(), flags.bits()); - let out = CStr::from_ptr(res).to_str()?.to_string(); + let res = DIE_ScanFileExA(fpath.as_bytes_with_nul().as_ptr(), flags.bits()); + let out = CStr::from_ptr(res as *const std::os::raw::c_char) + .to_str()? + .to_string(); DIE_FreeMemoryA(res); Ok(out) } @@ -133,9 +135,15 @@ pub fn scan_file_with_db(fpath: &Path, flags: ScanFlags, db_path: &Path) -> Resu let db_path = CString::new(db_path.to_str().ok_or(Error::ConversionFailure)?)?; unsafe { - let cstr = CStr::from_ptr(fpath.as_ptr() as *const i8); - let res = DIE_ScanFileA(cstr.as_ptr(), flags.bits(), db_path.as_ptr()); - let str = CStr::from_ptr(res).to_str()?.to_string(); + let cstr = CStr::from_ptr(fpath.as_ptr()); + let res = DIE_ScanFileA( + cstr.to_bytes_with_nul().as_ptr(), + flags.bits(), + db_path.to_bytes_with_nul().as_ptr(), + ); + let str = CStr::from_ptr(res as *const std::os::raw::c_char) + .to_str()? + .to_string(); DIE_FreeMemoryA(res); Ok(str) } @@ -178,7 +186,9 @@ pub fn scan_memory(mem: &[u8], flags: ScanFlags) -> Result { unsafe { let res = DIE_ScanMemoryExA(ptr, sz as u32, flags.bits()); - let str = CStr::from_ptr(res).to_str()?.to_string(); + let str = CStr::from_ptr(res as *const std::os::raw::c_char) + .to_str()? + .to_string(); DIE_FreeMemoryA(res); Ok(str) } @@ -224,8 +234,15 @@ pub fn scan_memory_with_db(mem: &[u8], flags: ScanFlags, db_path: &Path) -> Resu } unsafe { - let res = DIE_ScanMemoryA(ptr, sz as u32, flags.bits(), db_path.as_ptr()); - let str = CStr::from_ptr(res).to_str()?.to_string(); + let res = DIE_ScanMemoryA( + ptr, + sz as u32, + flags.bits(), + db_path.as_bytes_with_nul().as_ptr(), + ); + let str = CStr::from_ptr(res as *const std::os::raw::c_char) + .to_str()? + .to_string(); DIE_FreeMemoryA(res); Ok(str) } @@ -263,7 +280,7 @@ pub fn scan_memory_with_db(mem: &[u8], flags: ScanFlags, db_path: &Path) -> Resu pub fn load_database(fpath: &Path) -> Result<()> { let fpath = CString::new(fpath.to_str().ok_or(Error::ConversionFailure)?)?; - let res = unsafe { DIE_LoadDatabaseA(fpath.as_ptr()) }; + let res = unsafe { DIE_LoadDatabaseA(fpath.as_bytes_with_nul().as_ptr()) }; match res { 0 => Ok(()), err => Err(Error::Ffi { error_code: err }), From 1d81a0f958e22ff24c69cc1d2bd2aa9099075cfe Mon Sep 17 00:00:00 2001 From: Christophe Alladoum Date: Mon, 10 Nov 2025 16:44:32 -0800 Subject: [PATCH 4/5] cmake - make sure we use the right aqt folder for linux/arm64 --- libdie++/cmake/FindDieLibrary.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libdie++/cmake/FindDieLibrary.cmake b/libdie++/cmake/FindDieLibrary.cmake index ba92698..de88095 100644 --- a/libdie++/cmake/FindDieLibrary.cmake +++ b/libdie++/cmake/FindDieLibrary.cmake @@ -6,7 +6,11 @@ set(QT_BUILD_VERSION "6.10.0") if(WIN32) set(QT_BUILD_COMPILER "msvc2022_64") elseif(LINUX) - set(QT_BUILD_COMPILER "gcc_64") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64") + set(QT_BUILD_COMPILER "gcc_arm64") + else() + set(QT_BUILD_COMPILER "gcc_64") + endif() elseif(APPLE) set(QT_BUILD_COMPILER "macos") else() From d533daebb110fbf2b9447d16e1ea3c9c206c04ec Mon Sep 17 00:00:00 2001 From: Christophe Alladoum Date: Mon, 10 Nov 2025 16:51:28 -0800 Subject: [PATCH 5/5] removed macos from ci, problem with 3rd party --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 871ece2..ef8b859 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - {os: ubuntu-24.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - {os: ubuntu-24.04-arm, config: release, compiler: gcc_arm64, aqt_os: linux_arm64, aqt_compiler: gcc_arm64} - {os: windows-2025, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} + # - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} # - {os: macos-14, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} runs-on: ${{ matrix.variants.os }} steps: