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

Not compatible with Go 1.21.0 #577

Open
dsoechting opened this issue Sep 4, 2023 · 7 comments
Open

Not compatible with Go 1.21.0 #577

dsoechting opened this issue Sep 4, 2023 · 7 comments

Comments

@dsoechting
Copy link

Go version: 1.21.0
Go-SDL2 version: v0.4.35
SDL2 version: 2.0.20
OS: Windows 10 (19045.3324) -> Ubuntu 22.04.2 LTS through WSL2
Architecture: x86-64 (Ryzen 3700x CPU)

When I installed the Go module, none of the go-sdl2 functions were accessible from my application code besides some Btoi function in a file called helper.go. I could see all of the source code when looking at the module from my file system, but could not use most it.

I resolved my issue by downgrading to Go 1.20.7. Perhaps a note in the documentation could be made.

@veeableful
Copy link
Contributor

Hi @dsoechting, would you be able to provide a minimal example project that reproduces the issue? I was able to use Go 1.21 on my Linux and macOS with go-sdl2 v0.4.35.

@gen2brain
Copy link
Collaborator

@dsoechting Looks like you have CGO_ENABLED=0 globally. Check with go env.

@Yagisanatode
Copy link

This also occurred with me.

go version go1.21.0 windows/amd64
SDL2 version: 2.0.20

As @gen2brain mentioned the env setting for this is CGO_ENABLED=0

I'm a little lost on how to change this setting being a very fresh noob to Go (I don't think I am using the right keywords to search for it).

Any suggestions would be appreciated.

@veeableful
Copy link
Contributor

Hi @Yagisanatode, you could try putting it before the command. For example, CGO_ENABLED=1 go build.

@Yagisanatode
Copy link

@veeableful thanks for the guidance. My issue ended up being a combination on failing to add the g++.exe file and not adding the sdl2 dll to the module path.

@ramizpolic
Copy link

Would love to contribute to this if this is still relevant

@gen2brain
Copy link
Collaborator

@ramizpolic I don't think there is much to contribute here. Perhaps adding some notes for users in documentation, how it looks when there is no C compiler, how it looks when CGO is disabled etc. Something like that maybe,

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

5 participants