veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.17k stars 219 forks source link

Cannot find -lsdl2 #586

Closed PrinceDeveloperOf closed 6 months ago

PrinceDeveloperOf commented 6 months ago

Go version: go version go1.21.5 windows/amd64 Go-SDL2 version:v0.4.35 SDL2 version:2.28.5 OS:Windows 10 Architecture:x64-based processor

D:\GoLang\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 c:/users/USER/scoop/apps/gcc/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lSDL2 collect2.exe: error: ld returned 1 exit status

This is the error i get when i run go build. I've tried putting the proper folders in the Path and nothing changes.

veeableful commented 6 months ago

Hi @PrinceDeveloperOf, could you let me know where the SDL2 libraries are located in your setup?

PrinceDeveloperOf commented 6 months ago

They're at this location D:\AGD\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1\mingw64\lib

veeableful commented 6 months ago

Could you try merging the x86_64-w64-mingw32 and/or i686-w64-mingw32 directories from the SDL2-devel-[version]-mingw.zip into the same directories in MinGW?

PrinceDeveloperOf commented 6 months ago

I've merged them together and It's still giving me the same error.

veeableful commented 6 months ago

Could you show me the value of Path environment variable?

PrinceDeveloperOf commented 6 months ago
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files (x86)\VMware\VMware Player\bin\
C:\Program Files (x86)\Razer\ChromaBroadcast\bin
C:\Program Files\Razer\ChromaBroadcast\bin
D:\Vulkan\Bin
C:\Program Files\Python310\Scripts\
C:\Program Files\Python310\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\ffmpeg\bin
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
D:\Cmake\bin
C:\Users\USER\scoop\apps\python\current\Scripts
C:\Users\USER\scoop\apps\python\current
C:\Users\USER\scoop\apps\gcc\current\bin
C:\Users\USER\scoop\shims
C:\Users\USER\AppData\Local\Microsoft\WindowsApps
C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\bin
C:\texlive\2022\bin\win32
C:\Users\USER\AppData\Local\GitHubDesktop\bin
C:\Users\USER\AppData\Roaming\python\python310\site-packages
C:\Users\USER\.dotnet\tools
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\PuTTY\
C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.1.1\
C:\Program Files\PowerShell\7-preview\preview
C:\Program Files\PowerShell\7\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files\dotnet\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
D:\GoLang\bin
C:\Program Files\Git\cmd
D:\AGD\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1\mingw64\lib
C:\mingw64
C:\Users\USER\scoop\apps\python\current\Scripts
C:\Users\USER\scoop\apps\python\current
C:\Users\USER\scoop\apps\gcc\current\bin
C:\Users\USER\scoop\shims
C:\Users\USER\AppData\Local\Microsoft\WindowsApps
C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\bin
C:\texlive\2022\bin\win32
C:\Users\USER\AppData\Local\GitHubDesktop\bin
C:\Users\USER\AppData\Roaming\python\python310\site-packages
C:\Exercism
C:\Users\USER\.dotnet\tools
D:\GoLang\go\bin

This is the output from $env:path.split(';') in powershell

I've tries using D:\AGD\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1\mingw64\bin too it also gives the same result.

veeableful commented 6 months ago

Thanks! Could you try putting the absolute path where you have x86_64-w64-mingw32/bin that contains sdl2-config into the Path environment variable along with D:\AGD\x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1\mingw64\bin? After that, perhaps re-launch the Terminal.

(Sorry, I'm unfamiliar with Windows so it's a bit of a guesswork from me too!)

PrinceDeveloperOf commented 6 months ago

Doing all that and it's still giving me the same error.

veeableful commented 6 months ago

Hmm I just noticed that the gcc used seems to be different from MinGW. Could you try temporarily removing the C:\Users\USER\scoop\apps\gcc\current\bin entries in Path?

PrinceDeveloperOf commented 6 months ago

That was the issue, i now have the binary i desire. Thank you so much! 😊