adam000 / Go-SDL2

[WIP] Go bindings for SDL2
MIT License
9 stars 2 forks source link

How to install on Windows x64 with mingw64? #16

Closed metaleap closed 10 years ago

metaleap commented 10 years ago

Doing go get gave me "unknown command pkg-config" so I downloaded it from http://www.gtk.org/download/win64.php and now I get:

C:\Users\roxor\Documents\GitHub> go get github.com/adam000/Go-SDL2/sdl
# pkg-config --cflags sdl2
exit status 3221225595

SDL headers and libs are already in the appropriate mingw64 header/lib directories, the DLL is under c:\windows (as is sufficient for DLLs, works with glfw3.dll just fine too)..

Anyone successfully got this to build under mingw64? My mingw64 is from http://sourceforge.net/projects/tdm-gcc/ and the most recent version.

adam000 commented 10 years ago

I program on OS X and zombiezen codes on Ubuntu... I've never done Windows development (outside of .NET) before, but I did find this: http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw_how_to.html#pkg-config

(apparently pkg-config doesn't come with mingw and is a pain besides... hope you figure it out)

HTH

EDIT: derp, I totally misread and missed the part where you had pkg-config...

zombiezen commented 10 years ago

Downloading pkg-config itself isn't sufficient, you also have to have a .pc file. It's hard for me to tell the issue -- exit status 3221225595 is not one I recognize and there's no other output.

Unfortunately, I haven't had too much of a need to write Go on Windows either. You may have some luck searching around on golang-nuts for others who have used cgo packages on Windows.

adam000 commented 10 years ago

I can provide the .pc files given to me by Homebrew if that would help.

(obviously you'd have to plug in the proper values for your system, but it'd be a step in the right direction to be looking at the right format)

[11:54:15] (Masyaf) ~
Z echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig

[11:54:20] (Masyaf) ~
Z cd /usr/local/lib/pkgconfig

[11:54:27] (Masyaf) /usr/local/lib/pkgconfig
Z ls *sdl*
sdl.pc  sdl2.pc

[11:54:32] (Masyaf) /usr/local/lib/pkgconfig
Z cat sdl2.pc
# sdl pkg-config source file

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: 2.0.3
Requires:
Conflicts:
Libs: -L${libdir}  -lSDL2
Libs.private: -lSDL2    -lm -liconv -Wl,-framework,OpenGL  -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit
Cflags: -I${includedir}/SDL2  -D_THREAD_SAFE

[12:00:25] (Masyaf) /usr/local/lib/pkgconfig
Z ls *SDL*
SDL2_image.pc SDL2_mixer.pc SDL2_net.pc   SDL2_ttf.pc   SDL_image.pc  SDL_mixer.pc  SDL_net.pc    SDL_ttf.pc
metaleap commented 10 years ago

That's all quite inane interesting stuff, thanks guys :D I guess I could turn the question around and ask, does go get really (and/or why) need to run pkg-config at all? So far I was rather "lucky" that I could successfully cgo/link to both opengl32.dll and glfw3.dll (via their .h headers and .a libs) without requiring said tool..

As far as having a .pc file, I think I do have one that came with the SDL2 download. Now where the hell would I put it.. or to rephrase slightly differently, "perhaps SDL should drop the S from its name".....

adam000 commented 10 years ago

Well as I eluded to, your environment should have a $PKG_CONFIG_PATH from which it'll find .pc files.

If you don't want to use .pc files, but have a simpler way to do it for Windows, I do believe that cgo allows OS-specific directives.

metaleap commented 10 years ago

OK thanks, will give it a try next time I feel the immediate need to run on SDL2 under Win64 ;D

zombiezen commented 10 years ago

@metaleap If you feel reasonably confident that you have a set of off-the-shelf compiler/linker flags that work for Windows, please contribute that upstream.

pkg-config is used for portability on *nix based systems, but usually Windows has its own set of flags that need to be passed in. Usually, this process is not hard, it just requires a Windows machine and some time. This is what most packages do.

metaleap commented 10 years ago

Yeah will do that.. eventually ;)