rodrigocfd / windigo

Windows API and GUI in idiomatic Go.

Home Page:https://pkg.go.dev/github.com/rodrigocfd/windigo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling, resource syso workarounds?

shaoerkuai opened this issue · comments

Compiling with provided minimal.syso

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\XXX\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -ldflags -H=windowsgui -o C:\Users\XXX\AppData\Local\JetBrains\IntelliJIdea2023.2\tmp\GoLand\___go_build_XXX.exe XXX #gosetup
# XXX
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
e:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `C:\Users\XXX\AppData\Local\Temp\go-link-947727318\000000.o' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status

I fixed it using rsrc compiling a new amd64 syso,then..

After recompiling with -arch amd64 using rsrc it fixed, but I could not make it works:

  1. go build -ldflags="-linkmode internal"
  2. run
    3.panic: [1813 0x715] The specified resource type cannot be found in the image file.

I can confirm that the ICON embbed, but (github.com/akavel/rsrc) WindowMainOpts ().IconId(101) panic

How could I solve this? Now I was removed IconId and It's OK now , just not sure How could I use icon with akavel's rsrc tool compiled syso..

The error message

panic: [1813 0x715] The specified resource type cannot be found in the image file.

means that Windows could not find the icon, there's nothing else beyond this. The problem seems to be with the syso compilation, which is producing and invalid Win32 resource. There's nothing Windigo can do here.

I will try to figure out how this compliation will cause this panic.