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

1.3.0 mingw build failure on win10

Open shellohunter opened this issue 11 months ago • 5 comments

Im using mginw32, having these sdl libs installed:

mingw-w64-ucrt-x86_64-SDL2 2.30.10-1
mingw-w64-ucrt-x86_64-SDL2_gfx 1.0.4-2
mingw-w64-ucrt-x86_64-SDL2_image 2.8.2-3
mingw-w64-ucrt-x86_64-SDL2_mixer 2.8.0-2
mingw-w64-ucrt-x86_64-SDL2_ttf 2.22.0-1

got errors as below. it looks like cimgui-go was linking some static libs shipped with the package?

C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\shello\AppData\Local\Temp\go-link-2712737066\000009.o: in function `_cgo_3cdcbea75483_Cfunc_SDL_GameControllerGetSteamHandle':
/tmp/go-build/cgo-gcc-prolog:546:(.text+0x5e6): undefined reference to `SDL_GameControllerGetSteamHandle'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x106e): undefined reference to `__imp_SetupDiGetClassDevsA'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x1081): undefined reference to `__imp_SetupDiEnumDeviceInterfaces'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x1088): undefined reference to `__imp_SetupDiGetDeviceInterfaceDetailA'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x116f): undefined reference to `__imp_SetupDiEnumDeviceInfo'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x117e): undefined reference to `__imp_SetupDiGetDeviceRegistryPropertyA'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/shello/go/pkg/mod/github.com/!allen!dang/[email protected]/backend/../lib/windows/x64/libSDL2.a(SDL_hidapi.c.obj):SDL_hidapi.c:(.text+0x133c): undefined reference to `__imp_SetupDiEnumDeviceInterfaces'
...........
...........
...........

found similar report here: any idea?

shellohunter avatar Jan 18 '25 15:01 shellohunter

@shellohunter which code are youb uilding? As far as I see it is something about SDL. Does it origin from sdl backend or imgui itself?

gucio321 avatar Jan 18 '25 17:01 gucio321

also, lemma say: our github CI can't reproduce https://github.com/AllenDang/cimgui-go/actions/runs/12464437434/job/34788540130

gucio321 avatar Jan 18 '25 21:01 gucio321

@gucio321

I'm building a cimgui-go demo with the ebiten backend. As far as I can tell, the link script were linking to the static lib under cimgui-go/lib. Those missing symbols were not found from [email protected]\lib\windows\x64\libSDL2.a, but they do exists in the lib installed by mingw, as below:

for example, GameControllerGetSteamHandle was reported missing.

PS > dumpbin.exe .\libSDL2.a | grep GameControllerGetSteamHandle


PS > nm C:\msys64\ucrt64\lib\libSDL2.dll.a | grep GameControllerGetSteamHandle
0000000000000000 I __imp_SDL_GameControllerGetSteamHandle
0000000000000000 T SDL_GameControllerGetSteamHandle

while GameControllerGetAxis was found in both libs.

PS > dumpbin.exe .\libSDL2.a | grep GameControllerGetAxis
          10 .rdata$.refptr.SDL_GameControllerGetAxisFromString_REAL
          10 .rdata$.refptr.SDL_GameControllerGetAxis_REAL


PS > nm C:\msys64\ucrt64\lib\libSDL2.dll.a | grep GameControllerGetAxis
0000000000000000 I __imp_SDL_GameControllerGetAxisFromString
0000000000000000 T SDL_GameControllerGetAxisFromString
0000000000000000 I __imp_SDL_GameControllerGetAxis
0000000000000000 T SDL_GameControllerGetAxis

a few questions:

  • what's the version of static libs like [email protected]\lib\windows\x64\libSDL2.a? maybe out of sync?
  • I can see 2 cimgui-go were installed into my go dir. they have the same content. but the 2nd one has a ! mark inside the path. so, why they two? and why the exclamation mark here?
    • C:\Users\shello\go\pkg\mod\github.com!allen!dang\[email protected]\lib\windows\x64\libSDL2.a
    • C:\Users\shello\go\pkg\mod\github.com\allendang\[email protected]\lib\windows\x64\libSDL2.a

shellohunter avatar Jan 19 '25 01:01 shellohunter

what's the version of static libs like [email protected]\lib\windows\x64\libSDL2.a? maybe out of sync?

They are compiled from thirdparty/ clones of these libraries so they shhould match imgui version as well.

I can see 2 cimgui-go were installed into my go dir. they have the same content. but the 2nd one has a ! mark inside the path. so, why they two? and why the exclamation mark here?

Generally this is a question to @golang

Could you try to:

  • clone this repo
  • clean go cache
  • run examples/glfw (or examples/ebiten)

First of all this should not try to build SDL backend so no symbols confusion should happen

More questions:

  • what go version
  • what mingw version
  • what SDL version comes with this mingw? (C:\msys64\ucrt64\lib\libSDL2.dll.a)

gucio321 avatar Jan 19 '25 11:01 gucio321

@shellohunter any progress?

gucio321 avatar Mar 14 '25 09:03 gucio321

@shellohunter you need to use msys2 version of gcc (shared libraries are compiled this way in our workflow). lmk if this problem persists

gucio321 avatar Apr 03 '25 14:04 gucio321