FAQ
I'm trying to run this simple program

package main

import (
"github.com/0xe2-0x9a-0x9b/Go-SDL/sdl"
"log"
)

func main() {
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
log.Fatal(sdl.GetError())
}
}

However when I try and run the program I just get this error

2012/11/24 22:36:27 No available video device
exit status 1

I've heard this *might* be because in OSX 10.8 Apple removed X11, the
"solution" to this is to install Xquartz - I've done that but I still get
the same problem above.

Was just wondering if anyone has experienced anything similar?

--

Search Discussions

  • Tharaneedharan Vilwanathan at Nov 24, 2012 at 11:17 pm
    Hi,

    I have not used OpenGL on Mac but I am trying to see if I can give some
    tips.

    The problem could be with SDL. Can you reinstall SDL libraries, compile the
    program and try again? This may solve the problem.

    Hope this helps.

    Regards
    dharani
    On Sat, Nov 24, 2012 at 2:40 PM, wrote:

    I'm trying to run this simple program

    package main

    import (
    "github.com/0xe2-0x9a-0x9b/Go-SDL/sdl"
    "log"
    )

    func main() {
    if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
    log.Fatal(sdl.GetError())
    }
    }

    However when I try and run the program I just get this error

    2012/11/24 22:36:27 No available video device
    exit status 1

    I've heard this *might* be because in OSX 10.8 Apple removed X11, the
    "solution" to this is to install Xquartz - I've done that but I still get
    the same problem above.

    Was just wondering if anyone has experienced anything similar?

    --

    --
  • Djharperuk at Nov 24, 2012 at 11:30 pm
    I've reinstalled SDL many times using the "brew" command, this installs
    sdl-1.2.15, e.g.

    brew install sdl sdl_image sdl_gfx sdl_ttf

    However, the problem still persists.

    On Saturday, November 24, 2012 11:17:11 PM UTC, vdharani wrote:

    Hi,

    I have not used OpenGL on Mac but I am trying to see if I can give some
    tips.

    The problem could be with SDL. Can you reinstall SDL libraries, compile
    the program and try again? This may solve the problem.

    Hope this helps.

    Regards
    dharani
    On Sat, Nov 24, 2012 at 2:40 PM, <djhar...@gmail.com <javascript:>> wrote:

    I'm trying to run this simple program

    package main

    import (
    "github.com/0xe2-0x9a-0x9b/Go-SDL/sdl"
    "log"
    )

    func main() {
    if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
    log.Fatal(sdl.GetError())
    }
    }

    However when I try and run the program I just get this error

    2012/11/24 22:36:27 No available video device
    exit status 1

    I've heard this *might* be because in OSX 10.8 Apple removed X11, the
    "solution" to this is to install Xquartz - I've done that but I still get
    the same problem above.

    Was just wondering if anyone has experienced anything similar?

    --

    --
  • Philipp Schumann at Nov 25, 2012 at 6:35 am
    Any pressing need why you really have to use SDL instead of GLFW? The
    latter and its go-bindings work really fine for me, both OSX and the other
    OSes.

    Also you'll want to have your main()'s first instruction to be
    runtime.LockOSThread() in these kinds of apps.

    On Sunday, November 25, 2012 7:30:16 AM UTC+8, djhar...@gmail.com wrote:

    I've reinstalled SDL many times using the "brew" command, this installs
    sdl-1.2.15, e.g.

    brew install sdl sdl_image sdl_gfx sdl_ttf

    However, the problem still persists.

    On Saturday, November 24, 2012 11:17:11 PM UTC, vdharani wrote:

    Hi,

    I have not used OpenGL on Mac but I am trying to see if I can give some
    tips.

    The problem could be with SDL. Can you reinstall SDL libraries, compile
    the program and try again? This may solve the problem.

    Hope this helps.

    Regards
    dharani
    On Sat, Nov 24, 2012 at 2:40 PM, wrote:

    I'm trying to run this simple program

    package main

    import (
    "github.com/0xe2-0x9a-0x9b/Go-SDL/sdl"
    "log"
    )

    func main() {
    if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
    log.Fatal(sdl.GetError())
    }
    }

    However when I try and run the program I just get this error

    2012/11/24 22:36:27 No available video device
    exit status 1

    I've heard this *might* be because in OSX 10.8 Apple removed X11, the
    "solution" to this is to install Xquartz - I've done that but I still get
    the same problem above.

    Was just wondering if anyone has experienced anything similar?

    --

    --
  • ⚛ at Nov 25, 2012 at 7:44 am

    On Sunday, November 25, 2012 7:35:35 AM UTC+1, Philipp Schumann wrote:

    Also you'll want to have your main()'s first instruction to be
    runtime.LockOSThread() in these kinds of apps.
    Shouldn't be needed when using github.com/0xe2-0x9a-0x9b/Go-SDL/sdl in
    particular. The package has been primarily tested on Linux (there may be
    issues with other OSes).

    --
  • Steve McCoy at Nov 26, 2012 at 1:45 pm

    On Sunday, November 25, 2012 2:44:19 AM UTC-5, ⚛ wrote:
    On Sunday, November 25, 2012 7:35:35 AM UTC+1, Philipp Schumann wrote:

    Also you'll want to have your main()'s first instruction to be
    runtime.LockOSThread() in these kinds of apps.
    Shouldn't be needed when using github.com/0xe2-0x9a-0x9b/Go-SDL/sdl in
    particular. The package has been primarily tested on Linux (there may be
    issues with other OSes).
    The SDL docs state that all graphics and event functions should be called
    from the main thread. Linux just happens to get away with breaking that
    rule. I don't think this is the cause of the OP's issue, though.

    (Also, doesn't LockOSThread have to be called in one of the main package's
    init functions, rather than main?)

    It also doesn't have to do with X11; SDL doesn't use X on OSX. Otherwise, I
    have no clue, because I'm still on 10.7.

    --
  • Erwin at Nov 26, 2012 at 4:43 pm


    It also doesn't have to do with X11; SDL doesn't use X on OSX. Otherwise,
    I have no clue, because I'm still on 10.7.
    Hmm, i tried, but didn't manage to get SDL running on OSX other than in X11
    mode. When i tried to set SDL_VIDEODRIVER to Quartz, my app crashed
    immediately, i think it has something to do with SDL_main.
    How did you set things up to get SDL in native OS X mode?

    --
  • Steve McCoy at Nov 26, 2012 at 5:09 pm
    On Monday, November 26, 2012 11:43:56 AM UTC-5, notnot wrote:
    It also doesn't have to do with X11; SDL doesn't use X on OSX. Otherwise,
    I have no clue, because I'm still on 10.7.
    Hmm, i tried, but didn't manage to get SDL running on OSX other than in
    X11 mode. When i tried to set SDL_VIDEODRIVER to Quartz, my app crashed
    immediately, i think it has something to do with SDL_main.
    How did you set things up to get SDL in native OS X mode?
    Interesting. I've never had to do anything special, in either C or Go, for
    either SDL 1.2 or 2 (For Go, I use my own cgo code). How are you building
    SDL? In the past, for 1.2 I've built/installed via MacPorts or installed
    the pre-compiled frameworks, but recently for SDL2, I just pull from the
    SDL hg repo and build SDL.framework with the xcode files they provide.

    --
  • Djharperuk at Nov 26, 2012 at 7:43 pm
    I just installed SDL via homebrew.

    I'm not sure what the problem is to be honest, but I decided to go down the
    GLFW route suggested by Philipp Schumann and it works fine
    On Monday, November 26, 2012 5:09:28 PM UTC, Steve McCoy wrote:
    On Monday, November 26, 2012 11:43:56 AM UTC-5, notnot wrote:

    It also doesn't have to do with X11; SDL doesn't use X on OSX.
    Otherwise, I have no clue, because I'm still on 10.7.
    Hmm, i tried, but didn't manage to get SDL running on OSX other than in
    X11 mode. When i tried to set SDL_VIDEODRIVER to Quartz, my app crashed
    immediately, i think it has something to do with SDL_main.
    How did you set things up to get SDL in native OS X mode?
    Interesting. I've never had to do anything special, in either C or Go, for
    either SDL 1.2 or 2 (For Go, I use my own cgo code). How are you building
    SDL? In the past, for 1.2 I've built/installed via MacPorts or installed
    the pre-compiled frameworks, but recently for SDL2, I just pull from the
    SDL hg repo and build SDL.framework with the xcode files they provide.
    --
  • Bryanturley at Nov 26, 2012 at 7:56 pm
    It may be different now, but in the past (still?) SDL has only been able to
    manage a single window per program which always drove me away from it.

    --
  • Erwin at Nov 26, 2012 at 8:02 pm
    Yeah, SDL 1.2 isn't so cool, but I am only using it to set up OpenGL and
    get audio output. SDL Unicode support on OS X isn't 100% either, I can type
    many a character, but € isn't one of them. Maybe SDL 2.0 will do better,
    but it hasn't stabilized and I haven't been able to locate a Go binding for
    that yet.

    I agree, GLFW works nicely on Linux and OS X (WIndows I haven't tried).
    But: no audio access in there.

    --
  • Alco at Apr 18, 2013 at 1:43 pm
    Has anyone got Go-SDL to work on OS X at all? I'm running 10.7 and it
    doesn't work for me.

    When I'm launching test.go from
    https://github.com/0xe2-0x9a-0x9b/Go-SDL/tree/master/sdl-test I get the
    following output https://gist.github.com/alco/5412735

    Setting SDL_VIDEODRIVER env variable to x11 fixes the crash, but it simply
    launches the X server and nothing more happens. I can remember making SDL
    work from C on my OS, using the native NSWindow interface, so it should be
    a problem with the Go binding.

    I think I saw somewhere that one should run SDL's main() in order to
    initialize it properly. Looking in the file src/main/macos/SDL_main.c,
    there is a main() function that does initialize many things and then calls
    SDL_main() which is provided by the user if I'm not mistaken.

    So, does Go-SDL perform similar initialization that main() function does or
    skips them altogether? Is it possible to call SDL's main() as the first
    thing inside the Go program's main() and then be able to resume execution
    in Go (i.e. call SDL's main() without giving up control to it)?

    P.S. I want to use SDL's drawing functions, so GLFW is not an alternative.
    On Sunday, November 25, 2012 12:40:11 AM UTC+2, Daniel Harper wrote:

    I'm trying to run this simple program

    package main

    import (
    "github.com/0xe2-0x9a-0x9b/Go-SDL/sdl"
    "log"
    )

    func main() {
    if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
    log.Fatal(sdl.GetError())
    }
    }

    However when I try and run the program I just get this error

    2012/11/24 22:36:27 No available video device
    exit status 1

    I've heard this *might* be because in OSX 10.8 Apple removed X11, the
    "solution" to this is to install Xquartz - I've done that but I still get
    the same problem above.

    Was just wondering if anyone has experienced anything similar?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 24, '12 at 10:45p
activeApr 18, '13 at 1:43p
posts12
users8
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase