-
-
Notifications
You must be signed in to change notification settings - Fork 226
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 #362
Comments
andlabs/ui#326 (comment) |
Hi @jclc, does that mean the |
The error message is triggered by SDL2, so I would imagine that it's an SDL2 issue. Adding these linker flags as a CGO directive would probably fix it, but I'd like to know the root cause of it. |
It seems some people experienced it because they were compiling statically or have only static SDL2 library in their paths. Maybe it's because the |
You're right, it seems that SDL2 is now linked statically... that's not good. |
Perhaps you could try compiling the program via |
Yeah that's the thing though, |
It should still be possible to dynamically link SDL2 even with package ui; that's weird. I'll have to look at the build tags of this package... The C++ linker should not affect anything. If SDL is affected by it, then we have a problem with SDL... |
Returning to my project after a while, I'm finding more linker flags being lost.
Adding Edit: Right, it's because Go is forcing static linking but without the |
Right; I've taken steps to allow libui to be statically linkable specifically to make it more Go-like in nature; the interplay between this and that is an interesting question, and one that's in scope for the next release. Please file a bug there so I can keep track of it. |
Are you sure it's an issue with libui though? I have no issues importing both ui and https://github.com/mattn/go-sqlite3; only go-sdl2 seems to have this issue. FYI the code I'm using to test this:
|
Hi @jclc, I'll have a look at this as well during the weekend. I'll keep you posted! |
It's not so much a problem with libui but a subtlety with mixing packages that expect different linking requirements. My question is about what's conventional for the rest of the Go open-source world, so I can provide the best possible solution. libui can be used dynamically and it would be great if I could provide that option as well... |
Hi @jclc, do you have problem when compiling with
I can't seem to reproduce the problem on my Linux OS with this code:
|
With d969945 that works, but only when using |
@jclc Ahh I see now! You're cross-compiling on Linux to Windows but require SDL2 to be dynamic. In that case, could you try modifying
For me, I had to specify include path as well like the following. Perhaps you also need it.
I haven't tried to run it but at least it compiled for me =P |
@veeableful Hi, sorry for the delay, I've been busy. What version of Go are you using? For me it says those flags are not valid; even adding them to
As a sidenote, I've decided it's better to just use static linkage on Windows anyway; maybe even on other platforms. I'll still help out figuring out this issue if needed. |
Remove the space after the comma. |
Right, thanks... It does link SDL2 dynamically but now it also requires |
I'm importing this package alongside github.com/andlabs/ui and I get this error when cross-compiling to Windows using mingw:
The package ui uses C++, could this be confusing the Go linker into using C++ linkage for SDL2?
The text was updated successfully, but these errors were encountered: