Support Board
Date/Time: Tue, 22 Apr 2025 05:57:38 +0000
Post From: Problem: Remote Build in SierraChart_ARM64.exe is creating x64 (Intel) DLLs
[2025-01-05 04:45:47] |
seandunaway - Posts: 348 |
cross-compiling x64 and arm64 dlls from ubuntu 22 using llvm $ uname -a
Linux localhost 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 22.04.5 LTS Release: 22.04 Codename: jammy $ whoami root install official llvm public key $ curl -L https://apt.llvm.org/llvm-snapshot.gpg.key > /etc/apt/trusted.gpg.d/apt.llvm.org.asc
add official llvm ubuntu repository (windows sdk complains ubuntu 22's default llvm version is too old to compile) $ add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main'
install llvm $ apt install --no-install-recommends clang-19 clang-tools-19 lld-19 unzip
install official windows sdk from microsoft to /opt/winsysroot *alternatively you can copy the windows sdk from your visual studio install. however, this is nice because it creates symlinks to deal with linux filesystems being case sensitive while windows isn't (e.g. Windows.h vs windows.h). sierrachart headers are using some non-standard header casings $ curl -L https://github.com/Jake-Shadle/xwin/releases/download/0.6.5/xwin-0.6.5-x86_64-unknown-linux-musl.tar.gz | tar -zxvf -
$ xwin-0.6.5-x86_64-unknown-linux-musl/xwin --accept-license --temp --sdk-version 10.0.22621 --arch aarch64,x86_64 splat --preserve-ms-arch-notation --use-winsysroot-style --output /opt/winsysroot Manifest [0s] 16.12 MiB/16.12 MiB 📥 downloaded CRT.headers [0s] 13.93 MiB/13.93 MiB 📦 splatted CRT.libs.x86_64.desktop [0s] 201.98 MiB/201.98 MiB 📦 splatted CRT.libs.x86_64.store [0s] 82.91 MiB/82.91 MiB 📦 splatted CRT.libs.aarch64.desktop [0s] 190.34 MiB/190.34 MiB 📦 splatted CRT.libs.aarch64.store [0s] 200.51 MiB/200.51 MiB 📦 splatted SDK.headers.all.none [0s] 90.08 MiB/90.08 MiB 📦 splatted SDK.headers.all.store [0s] 225.15 MiB/225.15 MiB 📦 splatted SDK.headers.x86_64.none [0s] 45.36 KiB/45.36 KiB 📦 splatted SDK.headers.aarch64.none [0s] 105.04 KiB/105.04 KiB 📦 splatted SDK.libs.x86_64 [0s] 73.45 MiB/73.45 MiB 📦 splatted SDK.libs.aarch64 [0s] 141.52 MiB/141.52 MiB 📦 splatted SDK.libs.store.all [0s] 117.84 MiB/117.84 MiB 📦 splatted SDK.ucrt.all [0s] 241.38 MiB/241.38 MiB 📦 splatted symlinks [3s] 4641/4641 $ rm -r xwin-0.6.5-x86_64-unknown-linux-musl $ cd /opt/winsysroot/Windows\ Kits/10 && ln -s include Include && ln -s lib Lib && cd - review: we've installed llvm system wide and windows sdk to /opt/winsysroot $ clang++-19 --version
Ubuntu clang version 19.1.6 (++20241217105927+657e03f8625c-1~exp1~20241217105943.71) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-19/bin $ du -hs /opt/winsysroot/ 1.1G /opt/winsysroot/ grab sierrachart headers $ curl -L https://download2.sierrachart.com//downloads/ZipFiles/SierraChart2730.zip > SierraChart2730.zip
$ unzip SierraChart2730.zip "ACS_Source/*" && rm SierraChart2730.zip && cd ACS_Source and finally.. compile for x64 $ clang-cl-19 --target=x86_64-pc-windows-msvc -fuse-ld=lld /winsysroot /opt/winsysroot /LD /FeGDIExample_64.dll GDIExample.cpp
$ file GDIExample_64.dll GDIExample_64.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows compile for arm64 $ clang-cl-19 --target=aarch64-pc-windows-msvc -fuse-ld=lld /winsysroot /opt/winsysroot /LD /FeGDIExample_arm64.dll GDIExample.cpp
$ file GDIExample_arm64.dll GDIExample_arm64.dll: PE32+ executable (DLL) (GUI) Aarch64, for MS Windows clang-cl-19 -help and lld-link-19 -help for additional arguments for optimizations, warnings, debug builds and such (e.g. /O2 /W4 and /link /noimplib) if you run into any issues i'm happy to help any way i can Date Time Of Last Edit: 2025-01-05 17:10:49
|