Re: [go-nuts] Go-SDL on windows

927 views
Skip to first unread message

Jared Anderson

unread,
Oct 20, 2012, 5:01:34 AM10/20/12
to Travis Johnson, golan...@googlegroups.com
The only way I know of getting sdl.pc is to build sdl yourself.  It looks like it is easy enough to write one by hand though.

You can try creating sdl.pc in MinGW\lib\pkgconfig with these two lines.
Cflags: -IC:\MinGW\include\SDL
Libs: -LC:\MinGW\lib -lSDL

I do not have sdl installed right now so I may be forgetting something in the CFLAGS (Cflags) or LDFLAGS (Libs).

On Fri, Oct 19, 2012 at 11:03 PM, Travis Johnson <sna...@gmail.com> wrote:
I'm fairly new to go, and even newer to getting mingw and other things to work on windows, but I feel I've exhausted my googling abilities on this one.
I'm trying to get Go-SDL (the one from github.com/0xe2-0x9a-0x9b/Go-SDL) to install on windows, and so far I've gotten pkg-config and the sdl libraries where (I think) they should be (in \MinGW), but it keeps looking for an 'sdl.pc' file apparently, and I have no idea where to get this, as it doesn't exist in any of the SDL downloads.

C:\Users\xxxx>go get -v github.com/0xe2-0x9a-0x9b/Go-SDL/...
github.com/0xe2-0x9a-0x9b/Go-SDL/mixer
github.com/0xe2-0x9a-0x9b/Go-SDL/sdl
github.com/0xe2-0x9a-0x9b/Go-SDL/sdl/audio
# pkg-config --cflags sdl
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
exit status 1
# pkg-config --cflags sdl
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
exit status 1
# pkg-config --cflags sdl sdl
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
exit status 1
C:\Users\xxxx>

--
 
 

Message has been deleted

Travis Johnson

unread,
Oct 22, 2012, 4:41:18 PM10/22/12
to golan...@googlegroups.com
So I did that, now I get this much smaller set of error messages:
 
C:\Users\Support.com>go get -v github.com/0xe2-0x9a-0x9b/Go-SDL/...
Package 'sdl' has no Name: field
exit status 1
# pkg-config --cflags sdl
Package 'sdl' has no Name: field
exit status 1
# pkg-config --cflags sdl sdl
Package 'sdl' has no Name: field
exit status 1

C:\Users\xxxx>

minux

unread,
Oct 22, 2012, 4:52:48 PM10/22/12
to Travis Johnson, golan...@googlegroups.com

your sdl.pc should be like this (fill in the paths):
Name: SDL
Description: SDL
Version: 1
Requires:
Libs: -L${libdir} -lsdl blah blah
Cflags: -I${includedir}

--
 
 

Harley Laue

unread,
Oct 22, 2012, 4:53:05 PM10/22/12
to golan...@googlegroups.com
Try this instead (if the prefix, exec_prefix, etc don't work, replace them with the correct path):

# sdl pkg-config source file

prefix=c:/mingw
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: sdl
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: 1.2.15
Requires:
Conflicts:
Libs: -L${libdir}  -lmingw32 -lSDLmain -lSDL  -mwindows
Libs.private: -lmingw32 -lSDLmain -lSDL  -mwindows  -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid
Cflags: -I${includedir}/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main


On 10/22/2012 03:40 PM, Travis Johnson wrote:
so I did that, and now I get a newer, though cleaner error message:
Package 'sdl' has no Name: field

exit status 1
# pkg-config --cflags sdl
Package 'sdl' has no Name: field

exit status 1
# pkg-config --cflags sdl sdl
Package 'sdl' has no Name: field
exit status 1
--
 
 

Travis Johnson

unread,
Oct 22, 2012, 5:07:34 PM10/22/12
to golan...@googlegroups.com
Ok, this helped, I had to move SDL_mixer.h and SLD_image.h into the include\SDL folder (when I had copied from the zip they were just in include), but now I get this:

c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL_mixer
collect2: ld returned 1 exit status
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL_image
collect2: ld returned 1 exit status

C:\Users\xxxx>

I'm not sure if this means I should also make separate include folders for the SDL_image/mixer, but that seems silly as I already need to have a copy in include\SDL, as that was the only way I could get to this point.

Travis Johnson

unread,
Oct 22, 2012, 8:49:15 PM10/22/12
to golan...@googlegroups.com
Baring getting this SDL library to work, does anyone have any ideas for libraries to do 2d graphics on windows? Specifically I want to make a pac-man duplicate.

Jared Anderson

unread,
Oct 22, 2012, 8:58:11 PM10/22/12
to Travis Johnson, golan...@googlegroups.com
You need SDL_image.lib and SDL_mixer.lib to be in mingw/lib.  You can get them from the devel zips.

--
 
 

Travis Johnson

unread,
Oct 22, 2012, 10:08:59 PM10/22/12
to golan...@googlegroups.com
Well don't I feel like a nub, not comparing the folder structures of my mingw and the zips I download.
Thank you, also the support here is amazing.

brainman

unread,
Oct 22, 2012, 10:22:07 PM10/22/12
to golan...@googlegroups.com
On Tuesday, 23 October 2012 11:49:15 UTC+11, Travis Johnson wrote:
Baring getting this SDL library to work, does anyone have any ideas for libraries to do 2d graphics on windows? Specifically I want to make a pac-man duplicate.


You can call windows api directly.

Maybe there is enough drawing support in https://github.com/lxn/walk.

Alex
Reply all
Reply to author
Forward
0 new messages