go-fitz icon indicating copy to clipboard operation
go-fitz copied to clipboard

feat: support windows/arm64

Open iwilltry42 opened this issue 1 year ago • 2 comments
trafficstars

According to fitz_cgo.go and the libs files, Windows arm64 (aarch64) doesn't seem to be supported directly. Is there any time and interest for adding it?

iwilltry42 avatar Aug 06 '24 13:08 iwilltry42

If it is easy for me to add new crossdev toolchain on mu system I will add it. Not sure, I don't even know what devices use windows/arm64. I will check after the summer is over.

gen2brain avatar Aug 06 '24 14:08 gen2brain

I used https://github.com/mstorsjo/llvm-mingw but still failed building the mupdf lib because of sse4.1 instructions. I must be missing something, but I'm also not an expert in this field.

iwilltry42 avatar Aug 07 '24 15:08 iwilltry42

Ok, I added libraries for windows/arm64.

# CGO_ENABLED=1 CC=aarch64-w64-mingw32-gcc GOOS=windows GOARCH=arm64 go build -ldflags '-s -w'

# file example.exe
example.exe: PE32+ executable (console) Aarch64, for MS Windows, 7 sections

gen2brain avatar Sep 27 '24 18:09 gen2brain

This is dope, I'll try it soon, thank you!

May I ask how you got there? I failed to get it working.

iwilltry42 avatar Sep 27 '24 19:09 iwilltry42

I just used aarch64-w64-mingw-gcc from llvm-mingw as CC and compiled the library similar as what I do for other platforms. Here is an excerpt:

MINGW_ARM_64="/usr/aarch64-w64-mingw32"

OPTS="HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no WANT_OPENSSL=no WANT_CURL=no HAVE_MUJS=yes HAVE_JSCORE=no HAVE_V8=no"

export PATH=${PATH}:${MINGW_ARM_64}/bin
CROSS="aarch64-w64-mingw32-" \
PKG_CONFIG_LIBDIR=${MINGW_ARM_64}/lib/pkgconfig \
    CC=${CROSS}gcc CXX=${CROSS}g++ \
    LD=${CROSS}ld AR=${CROSS}ar \
    CROSSCOMPILE=yes `eval "${OPTS}"` make -j$(nproc) libs OS=mingw64-cross-arm64

And I had to modify Makerules to add mingw64-cross-arm64 section, similar to mingw64-cross.

gen2brain avatar Sep 27 '24 19:09 gen2brain