Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker error when compiling to Windows when importing github.com/andlabs/ui #326

Closed
jclc opened this issue Oct 3, 2018 · 3 comments
Closed

Comments

@jclc
Copy link

jclc commented Oct 3, 2018

I'm importing this package alongside https://github.com/veandco/go-sdl2 and I get this error when cross-compiling to Windows using mingw:

/usr/lib/go/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32-g++ failed: exit status 1
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windows.o):(.text+0x17f): undefined reference to `__imp_CoInitializeEx'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xf6): undefined reference to `ImmGetIMEFileNameA'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x144): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x167): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1d4): undefined reference to `ImmGetCompositionStringW'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1ec): undefined reference to `ImmGetCompositionStringW'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x3ff): undefined reference to `ImmGetIMEFileNameA'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x569): undefined reference to `GetFileVersionInfoSizeA'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x595): undefined reference to `GetFileVersionInfoA'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x5bf): undefined reference to `VerQueryValueA'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x85c): undefined reference to `__imp_SysFreeString'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x9ee): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xa0c): undefined reference to `ImmNotifyIME'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xa29): undefined reference to `ImmNotifyIME'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xa35): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xa83): undefined reference to `ImmSetCompositionStringW'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xb13): undefined reference to `ImmAssociateContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xc2d): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0xc3c): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x12bd): undefined reference to `ImmAssociateContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x14f5): undefined reference to `ImmAssociateContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x158c): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x15bd): undefined reference to `ImmSetCompositionWindow'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x15c9): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x16a1): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x16ed): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x17de): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x17ff): undefined reference to `ImmGetCandidateListW'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1814): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x198b): undefined reference to `ImmGetContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1a21): undefined reference to `ImmReleaseContext'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1a6d): undefined reference to `ImmGetCandidateListW'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1dc6): undefined reference to `__imp_SysFreeString'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_windowskeyboard.o):(.text+0x1ebb): undefined reference to `__imp_SysFreeString'
/usr/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libSDL2.a(SDL_wasapi.o):(.text+0x355): undefined reference to `__imp_PropVariantClear'
collect2: virhe: ld:n paluuarvo oli 1

The package ui uses C++, could this be confusing the Go linker into using C++ linkage for SDL2?

@jclc
Copy link
Author

jclc commented Oct 3, 2018

Meant to post this issue on go-sdl2. Sorry.

@jclc jclc closed this as completed Oct 3, 2018
@andlabs
Copy link
Owner

andlabs commented Oct 4, 2018

For what it's worth, those specific linker errors have nothing to do with C++; they have to do with missing -loleaut32, -limm32, and -lversion in the linker flags.

@jclc
Copy link
Author

jclc commented Oct 4, 2018

Well what do you know, adding those + -lole32 fixed it, thanks! It is odd that this only occurs when importing both ui and go-sdl2/sdl, individually they build just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants