SDL2 binding for Go

SDL2 binding for Go Build Status Go Report Card Reviewed by Hound Financial Contributors on Open Collective

go-sdl2 is SDL2 wrapped for Go users. It enables interoperability between Go and the SDL2 library which is written in C. That means the original SDL2 installation is required for this to work.

Table of Contents

Documentation

Examples

package main

import "github.com/veandco/go-sdl2/sdl"

func main() {
	if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
		panic(err)
	}
	defer sdl.Quit()

	window, err := sdl.CreateWindow("test", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
		800, 600, sdl.WINDOW_SHOWN)
	if err != nil {
		panic(err)
	}
	defer window.Destroy()

	surface, err := window.GetSurface()
	if err != nil {
		panic(err)
	}
	surface.FillRect(nil, 0)

	rect := sdl.Rect{0, 0, 200, 200}
	surface.FillRect(&rect, 0xffff0000)
	window.UpdateSurface()

	running := true
	for running {
		for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch event.(type) {
			case *sdl.QuitEvent:
				println("Quit")
				running = false
				break
			}
		}
	}
}

For more complete examples, see https://github.com/veandco/go-sdl2-examples. You can run any of the .go files with go run.

Requirements

Below is some commands that can be used to install the required packages in some Linux distributions. Some older versions of the distributions such as Ubuntu 13.10 may also be used but it may miss an optional package such as libsdl2-ttf-dev on Ubuntu 13.10's case which is available in Ubuntu 14.04.

On Ubuntu 14.04 and above, type:
apt install libsdl2{,-image,-mixer,-ttf,-gfx}-dev

On Fedora 25 and above, type:
yum install SDL2{,_image,_mixer,_ttf,_gfx}-devel

On Arch Linux, type:
pacman -S sdl2{,_image,_mixer,_ttf,_gfx}

On Gentoo, type:
emerge -av libsdl2 sdl2-{image,mixer,ttf,gfx}

On macOS, install SDL2 via Homebrew like so:
brew install sdl2{,_image,_mixer,_ttf,_gfx} pkg-config

On Windows,

  1. Install mingw-w64 from Mingw-builds
    • Version: latest (at time of writing 6.3.0)
    • Architecture: x86_64
    • Threads: win32
    • Exception: seh
    • Build revision: 1
    • Destination Folder: Select a folder that your Windows user owns
  2. Install SDL2 http://libsdl.org/download-2.0.php
    • Extract the SDL2 folder from the archive using a tool like 7zip
    • Inside the folder, copy the i686-w64-mingw32 and/or x86_64-w64-mingw32 depending on the architecture you chose into your mingw-w64 folder e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64
  3. Setup Path environment variable
    • Put your mingw-w64 binaries location into your system Path environment variable. e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\bin and C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\bin
  4. Open up a terminal such as Git Bash and run go get -v github.com/veandco/go-sdl2/sdl.
  5. (Optional) You can repeat Step 2 for SDL_image, SDL_mixer, SDL_ttf
    • NOTE: pre-build the libraries for faster compilation by running go install github.com/veandco/go-sdl2/{sdl,img,mix,ttf}
  • Or you can install SDL2 via Msys2 like so: pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2{,_image,_mixer,_ttf,_gfx}

Installation

To get the bindings, type:
go get -v github.com/veandco/go-sdl2/sdl
go get -v github.com/veandco/go-sdl2/img
go get -v github.com/veandco/go-sdl2/mix
go get -v github.com/veandco/go-sdl2/ttf
go get -v github.com/veandco/go-sdl2/gfx

or type this if you use Bash terminal:
go get -v github.com/veandco/go-sdl2/{sdl,img,mix,ttf}

Due to go-sdl2 being under active development, a lot of breaking changes are going to happen during v0.x. With versioning system coming to Go soon, we'll make use of semantic versioning to ensure stability in the future.

Static compilation

Since v0.3.0, it is possible to build statically against included libraries in .go-sdl2-libs. To build statically, run:

CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64 go build -tags static -ldflags "-s -w"

You can also cross-compile to another OS. For example, to Windows:

CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -tags static -ldflags "-s -w"

For the list of OS and architecture, you can see inside the .go-sdl2-libs directory.

NOTE: If you're using the new Go Module system, you will need to refer to the master branch for now by running:

go get -v github.com/veandco/go-sdl2/sdl@master

Before building the program.

Cross-compiling

Linux to Windows

  1. Install MinGW toolchain.
    • On Arch Linux, it's simply pacman -S mingw-w64.
  2. Download the SDL2 development package for MinGW here (and the others like SDL_image, SDL_mixer, etc.. here if you use them).
  3. Extract the SDL2 development package and copy the x86_64-w64-mingw32 folder inside recursively to the system's MinGW x86_64-w64-mingw32 folder. You may also do the same for the i686-w64-mingw32 folder.
    • On Arch Linux, it's cp -r x86_64-w64-mingw32 /usr.
  4. Now you can start cross-compiling your Go program by running env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" go build -x main.go. You can change some of the parameters if you'd like to. In this example, it should produce a main.exe executable file.
  5. Before running the program, you need to put SDL2.dll from the SDL2 runtime package (For others like SDL_image, SDL_mixer, etc.., look for them here) for Windows in the same folder as your executable.
  6. Now you should be able to run the program using Wine or Windows!

macOS to Windows

  1. Install Homebrew
  2. Install MinGW through Homebrew via brew install mingw-w64
  3. Download the SDL2 development package for MinGW here (and the others like SDL_image, SDL_mixer, etc.. here if you use them).
  4. Extract the SDL2 development package and copy the x86_64-w64-mingw folder inside recursively to the system's MinGW x86_64-w64-mingw32 folder. You may also do the same for the i686-w64-mingw32 folder. The path to MinGW may be slightly different but the command should look something like cp -r x86_64-w64-mingw32 /usr/local/Cellar/mingw-w64/5.0.3/toolchain-x86_64.
  5. Now you can start cross-compiling your Go program by running env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/local/Cellar/mingw-w64/5.0.3/toolchain-x86_64/x86_64-w64-mingw32/lib -lSDL2" CGO_CFLAGS="-I/usr/local/Cellar/mingw-w64/5.0.3/toolchain-x86_64/x86_64-w64-mingw32/include -D_REENTRANT" go build -x main.go. You can change some of the parameters if you'd like to. In this example, it should produce a main.exe executable file.
  6. Before running the program, you need to put SDL2.dll from the SDL2 runtime package (For others like SDL_image, SDL_mixer, etc.., look for them here) for Windows in the same folder as your executable.
  7. Now you should be able to run the program using Wine or Windows!

FAQ

Why does the program not run on Windows? Try putting the runtime libraries (e.g. SDL2.dll and friends) in the same folder as your program.

Why does my program crash randomly or hang? Putting runtime.LockOSThread() at the start of your main() usually solves the problem (see SDL2 FAQ about multi-threading).

UPDATE: Recent update added a call queue system where you can put thread-sensitive code and have it called synchronously on the same OS thread. See the render_queue or render_goroutines examples from https://github.com/veandco/go-sdl2-examples to see how it works.

Why can't SDL_mixer seem to play MP3 audio file? Your installed SDL_mixer probably doesn't support MP3 file.

On macOS, this is easy to correct. First remove the faulty mixer: brew remove sdl2_mixer, then reinstall it with the MP3 option: brew install sdl2_mixer --with-flac --with-fluid-synth --with-libmikmod --with-libmodplug --with-smpeg2. If necessary, check which options you can enable with brew info sdl2_mixer. You could also try installing sdl2_mixer with mpg123 by running brew install sdl2_mixer --with-mpg123.

On Other Operating Systems, you will need to compile smpeg and SDL_mixer from source with the MP3 option enabled. You can find smpeg in the external directory of SDL_mixer. Refer to issue #148 for instructions.

Note that there seems to be a problem with SDL_mixer 2.0.2 so you can also try to revert back to 2.0.1 and see if it solves your problem

Does go-sdl2 support compiling on mobile platforms like Android and iOS? For Android, see https://github.com/veandco/go-sdl2-examples/tree/master/examples/android.

There is currently no support for iOS yet.

Why does my window not immediately render after creation? It appears the rendering subsystem needs some time to be able to present the drawn pixels. This can be workaround by adding delay using sdl.Delay() or put the rendering code inside a draw loop.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

Go-SDL2 is BSD 3-clause licensed.

Owner
Ve & Co.
We are a group of people who love to do fun things!
Ve & Co.
Comments
  • Generate a standalone build on Mac OS X

    Generate a standalone build on Mac OS X

    How do you generate a build shipping with statically linked version of the libs (the goal being to be able to distribute a binary to people without asking them to install sdl2 and other shared libs via homebrew or apt-get) ?

    I tried multiple things - nothing works. The closest I got is on topheman/gopher-ball, running CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gopher-ball-darwin-amd64.app ., I got the following error:

    # github.com/veandco/go-sdl2/sdl
    ../../veandco/go-sdl2/sdl/yuv_sw_c.go:17: undefined: Surface
    ../../veandco/go-sdl2/sdl/yuv_sw_c.go:18: undefined: Surface
    make: *** [darwin] Error 2
    

    More infos https://github.com/topheman/gopher-ball/issues/2

  • Missing Documentation about Texture.Lock

    Missing Documentation about Texture.Lock

    Sorry to bother yet again but I promise it is different this time.

    When locking a Texture for pixel access it requires a *unsafe.Pointer as a pointer to the pixel bytes. So I created a Surface, called .Pixels() on it and created a pointer pointing to the result. However cannot use &pixels (type *[]byte) as type *unsafe.Pointer. In the documentation of unsafe it merely requires a Pointer to an arbitrary type and I think a pointer to a slice filled with pixel bytes is suitable for that description. What am I doing wrong?

  • Cannot build on windows 10 with latest version of go

    Cannot build on windows 10 with latest version of go

    I have spent two days configuring a simple go app that uses SDL2. I have done this several times on Linux. I have followed instructions from various places.

    1. Started with git-bash. No GCC
    2. MinGW could not get gcc 64
    3. Sdl2 installation instructions do not match anything in MinGW
    4. Full cygwin 64 + gcc 64. Cannot find headers audio.h Copied from SDL zip ld cannot find SDL2, copied from zip followed by a whole chain of dll(s) that could not be found, about 20.

    I have given up... Scrapped cygwin, MinGW and SDL.

    Could somone please look at the instructions for building on windows 10. Why is is so complex? Could it be prebuilt for Win 10 platform.

    Going back to to good old linux for now but I really needto get this working on windows 10 as well.

    I have been doing this sort of thing for years and not been so frustrated for a long time :-(

    Sorry if this is the wrong forum for this but I could not see any other way to discuss this issue!

  • Window Doesn't Respond Sometimes

    Window Doesn't Respond Sometimes

    I buillt a small 2D game. However, the window becomes non-responsive to any events. The strange part is it works sometimes and doesn't most of the time. I am on a OSX Yoesmite and using go-1.7.

    Below is the main function

    func main() {
    	/* Initilize SDL with all its subsystems.
    	create a Game instance if Intilization is a success */
    	err := sdl.Init(sdl.INIT_EVERYTHING)
    	if err != nil {
    		panic(err)
    	}
    
    	g := new(Game)
    	g.init("Flappy")
    	g.drawTitle("Flappy Bird")
    	g.clear()
    
    	var event sdl.Event
    
    	go g.play() //  Keep moving the background
    
    	running := true
    	fmt.Println("Waiting on events")
    	for running {
    		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
    			switch event.(type) {
    			case *sdl.QuitEvent:
    				running = false
    				break
    			case *sdl.KeyDownEvent:
    				g.handleKeyEvent(event.(*sdl.KeyDownEvent))
    			}
    		}
    	}
    	quito()
    }
    
  • Example in readme.md doesn't work

    Example in readme.md doesn't work

    Code run:

    package main
    
    import "github.com/veandco/go-sdl2/sdl"
    
    func main() {
    	sdl.Init(sdl.INIT_EVERYTHING)
    
    	window, err := sdl.CreateWindow("test", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
    		800, 600, sdl.WINDOW_SHOWN)
    	if err != nil {
    		panic(err)
    	}
    	defer window.Destroy()
    
    	surface, err := window.GetSurface()
    	if err != nil {
    		panic(err)
    	}
    
    	rect := sdl.Rect{0, 0, 200, 200}
    	surface.FillRect(&rect, 0xffff0000)
    	window.UpdateSurface()
    
    	sdl.Delay(10000)
    	sdl.Quit()
    }
    

    Expected: an 800x600 window with a 200x200 red rectangle in the corner.

    Actual Results: An 800x600 window flashes for 10 seconds, with nothing in it, showing the background of the windowing environment. Linked screenshot.

    Go version: go version go1.7.4 linux/amd64 (also tried on 1.8.3 on debian unstable, same results). Linux version: Ubuntu 17:04.

    % glxinfo | grep "version"
    server glx version string: 1.4
    client glx version string: 1.4
    GLX version: 1.4
        Max core profile version: 3.3
        Max compat profile version: 3.0
        Max GLES1 profile version: 1.1
        Max GLES[23] profile version: 3.0
    OpenGL core profile version string: 3.3 (Core Profile) Mesa 17.0.3
    OpenGL core profile shading language version string: 3.30
    OpenGL version string: 3.0 Mesa 17.0.3
    OpenGL shading language version string: 1.30
    OpenGL ES profile version string: OpenGL ES 3.0 Mesa 17.0.3
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
    
  • struct ABI test

    struct ABI test

    I get failed tests with this message on debian linux:

        struct_test.go:75: type size mismatch: MouseWheelEvent(28) != cMouseWheelEvent(24)
    

    This may be a platform or sdl version dependent bug, as the same error does not happen on my macbook when using the same go version.

  • non-utf8 functions in sdl-ttf

    non-utf8 functions in sdl-ttf

    I recently saw, that the sdl-ttf wrapper has latin1 and utf8 support. Since go is utf8-only. I suggest to remove the non-utf8 version, since there is no way of providing a string that is encoded in latin1 (in the non ascii compatible range of course)

  • Unable to set HapticDirection.dir

    Unable to set HapticDirection.dir

    dir is unexported (https://github.com/veandco/go-sdl2/blob/master/sdl/haptic.go#L46) and has no methods to set it with, so we're currently unable to use it.

    https://wiki.libsdl.org/SDL_HapticDirection

  • Creating a stable binding release

    Creating a stable binding release

    The README states that go-sdl2 is not stable right now. Is there anything that needs to happen before someone can tag a version number that we can vendor to?

  • Exception 0xc0000005 0x1 0x333249 0x6c7bec77 PC=0x6c7bec77 signal arrived during cgo execution

    Exception 0xc0000005 0x1 0x333249 0x6c7bec77 PC=0x6c7bec77 signal arrived during cgo execution

    I have this intermittent problem. Sometimes it crashes on launch.

    package main
    
    import (
        "fmt"
        "runtime"
    
        "github.com/veandco/go-sdl2/sdl"
        "github.com/veandco/go-sdl2/sdl_ttf"
    )
    
    func main() {
        runtime.LockOSThread()
        defer runtime.UnlockOSThread()
    
        ttf.Init()
    
        font, errOpen := ttf.OpenFont("Ubuntu-B.ttf", 300)
        if errOpen != nil {
            panic(errOpen)
        }
        defer font.Close()
    
        window, err := sdl.CreateWindow("test", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
            800, 600, sdl.WINDOW_SHOWN)
        if err != nil {
            panic(err)
        }
        defer window.Destroy()
    
        surface := window.GetSurface()
    
        fontSurface := font.RenderText_Shaded("123", sdl.Color{R: 255, G: 165, B: 0, A: 255}, sdl.Color{R: 0, G: 0, B: 0, A: 255})
        rect := sdl.Rect{surface.W/2 - fontSurface.W/2, surface.H/2 - fontSurface.H/2, 800, 800}
        fontSurface.Blit(nil, surface, &rect)
        fontSurface.Free()
    
        var event sdl.Event
        running := true
    
        for running {
            for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
                switch t := event.(type) {
                case *sdl.QuitEvent:
                    running = false
                case *sdl.MouseMotionEvent:
                    fmt.Printf("[%d ms] MouseMotion\ttype:%d\tid:%d\tx:%d\ty:%d\txrel:%d\tyrel:%d\n",
                        t.Timestamp, t.Type, t.Which, t.X, t.Y, t.XRel, t.YRel)
                case *sdl.MouseButtonEvent:
                    fmt.Printf("[%d ms] MouseButton\ttype:%d\tid:%d\tx:%d\ty:%d\tbutton:%d\tstate:%d\n",
                        t.Timestamp, t.Type, t.Which, t.X, t.Y, t.Button, t.State)
                case *sdl.MouseWheelEvent:
                    fmt.Printf("[%d ms] MouseWheel\ttype:%d\tid:%d\tx:%d\ty:%d\n",
                        t.Timestamp, t.Type, t.Which, t.X, t.Y)
                case *sdl.KeyUpEvent:
                    fmt.Printf("[%d ms] Keyboard\ttype:%d\tsym:%c\tmodifiers:%d\tstate:%d\trepeat:%d\n",
                        t.Timestamp, t.Type, t.Keysym.Sym, t.Keysym.Mod, t.State, t.Repeat)
                }
            }
    
            window.UpdateSurface()
            sdl.Delay(1000 / 30)
        }
    }
    
    Exception 0xc0000005 0x1 0x333249 0x6c7bec77
    PC=0x6c7bec77
    signal arrived during cgo execution
    
    github.com/veandco/go-sdl2/sdl_ttf._Cfunc_SDL_free(0x8ce750)
            d:/dev/go/gopath/src/github.com/veandco/go-sdl2/sdl_ttf/:44 +0x4c
    github.com/veandco/go-sdl2/sdl_ttf.(*Font).RenderText_Shaded(0xc082034018, 0x517010, 0x3, 0xff000000ff00a5ff, 0x2829a0)
            d:/dev/go/gopath/src/github.com/veandco/go-sdl2/sdl_ttf/sdl_ttf.go:110 +0x11c
    main.main()
            D:/Dev/go/Tests/sdl2crash/sdl2.go:32 +0x24b
    
    goroutine 17 [syscall, locked to thread]:
    runtime.goexit()
            c:/go/src/runtime/asm_amd64.s:2232 +0x1
    rax     0x8ce740
    rbx     0x8
    rcx     0x6c85fb60
    rdx     0x333231
    rdi     0xc082025d00
    rsi     0x5bfa60
    rbp     0x22feb0
    rsp     0x22fdf0
    r8      0x1c00bf0e2bb52254
    r9      0x1c00bf0e2c420994
    r10     0x8c0158
    r11     0x280000
    r12     0xff
    r13     0x0
    r14     0x0
    r15     0x0
    rip     0x6c7bec77
    rflags  0x10293
    cs      0x33
    fs      0x53
    gs      0x2b
    
  • Unknown event type: 8192

    Unknown event type: 8192

    When creating a new window with sdl.WINDOW_RESIZABLE flag and later attempt at resizing the window or setting full screen through the window.FullScreen() method the program panics with "Unknown event type: 8192". Something similiar also happens when opening the task mananger with CTRL+ALT+DEL

    Full error: C:/Users/ADMINI~1/AppData/Local/Temp/2/makerelease250988475/go/src/pkg/runtime/panic.c:266 +0xc8 github.com/veandco/go-sdl2/sdl.goEvent(0xc08405a8c0, 0xc000000001, 0x100000000) C:/Users/Kevin/Desktop/Go/src/github.com/veandco/go-sdl2/sdl/sdl_events.go:438 +0x15a github.com/veandco/go-sdl2/sdl.PollEvent(0x69fbe8, 0x0) C:/Users/Kevin/Desktop/Go/src/github.com/veandco/go-sdl2/sdl/sdl_events.go:383 +0x6a

    OS: Window 8

  • Static compilation on Fedora 37 fails on linker stage for -lasound

    Static compilation on Fedora 37 fails on linker stage for -lasound

    Go version: go1.19.3 linux/amd64 Go-SDL2 version: 0.4.0 SDL2 version: 2.26.0 OS: Fedora Linux Architecture: AMD64

    I tried installing SAASound-devel.x86_64 : Development files for SAASound but no luck. I have a suspicion this SAASound package has nothing to do with the error.

    This is the output I get:

    CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w"
    # sdl2
    /usr/lib/golang/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
    /usr/bin/ld: cannot find -lasound: No such file or directory
    collect2: error: ld returned 1 exit status
    
    make: *** [Makefile:9: static] Error 2
    
  • windows build warning: SDL_GetRevisionNumber

    windows build warning: SDL_GetRevisionNumber

    I got an error when I tried to compile the windows platform (Both compiling with cross-platform and compiling directly on windows gave me an error) macos to windows image

    windows image

  • Can't understand the sentences in the readme

    Can't understand the sentences in the readme

    I wrote a program on macos, probably affected by sdl2 so it can not be compiled cross-platform. So I tried to compile the windows exe on windows. when compiling it reported an error image

    I tried to find the answer in the readme, but I couldn't understand it

    The passage:

    Install SDL2 http://libsdl.org/download-2.0.php
    - Extract the SDL2 folder from the archive using a tool like [7zip](http://7-zip.org/)
    - Inside the folder, copy the i686-w64-mingw32 and/or x86_64-w64-mingw32 depending on the architecture you chose into your mingw-w64 folder e.g. C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64
    

    I downloaded sdl2 and only one dll file was available after decompression image

    Which folder does Inside the folder refer to? Where do I copy i686-w64-mingw32 and/or x86_64-w64-mingw32 to mingw-w64?

  • Crash on running Go-SDL2 app through Rosetta

    Crash on running Go-SDL2 app through Rosetta

    Hello!

    Just wanted to see if anybody knew anything about this particular issue - I'm the creator of a productivity and organization app known as MasterPlan. It's written with go-sdl2, and has been working pretty well. Normally, I build on GitHub Actions through Mac OS 10.15 - you can see the setup script for the action here.

    However, some M1 Mac users have reported that the app crashes on initial startup for them - looks like it's due to sdl_ttf; this is the result that a user got on attempting to run the program through the terminal.

    MasterPlan.app/Contents/MacOS/MasterPlan ; exit;
    SIGILL: illegal instruction
    PC=0x46d373e m=0 sigcode=1
    signal arrived during cgo execution
    instruction bytes: 0xc5 0xf8 0x57 0xc0 0xc5 0xf8 0x11 0x47 0x28 0xc5 0xf8 0x11 0x47 0x18 0xc5 0xf8
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x4491750, 0xc00029f920)
        /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/cgocall.go:156 +0x5c fp=0xc00029f8f8 sp=0xc00029f8c0 pc=0x40136fc
    github.com/veandco/go-sdl2/ttf._Cfunc_TTF_Init()
        _cgo_gotypes.go:461 +0x48 fp=0xc00029f920 sp=0xc00029f8f8 pc=0x4171a08
    github.com/veandco/go-sdl2/ttf.Init()
        /Users/runner/go/pkg/mod/github.com/veandco/[email protected]/ttf/sdl_ttf.go:56 +0x19 fp=0xc00029f938 sp=0xc00029f920 pc=0x4171f79
    main.main()
        /Users/runner/work/masterplan/masterplan/main.go:186 +0x8ee fp=0xc00029ff80 sp=0xc00029f938 pc=0x443c2ae
    runtime.main()
        /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/proc.go:255 +0x227 fp=0xc00029ffe0 sp=0xc00029ff80 pc=0x4046cc7
    runtime.goexit()
        /Users/runner/hostedtoolcache/go/1.17.11/x64/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc00029ffe8 sp=0xc00029ffe0 pc=0x40759a1
    
    rax    0x5b12248
    rbx    0x5b0ea80
    rcx    0x5b0ea80
    rdx    0xffffffffffffffc8
    rdi    0x5b12230
    rsi    0x0
    rbp    0x2092567f0
    rsp    0x2092567f0
    r8     0xe1c
    r9     0xe2d
    r10    0xffffe000
    r11    0x0
    r12    0x5b12230
    r13    0x5b11ea0
    r14    0x4bdff78
    r15    0x0
    rip    0x46d373e
    rflags 0x202
    cs     0x2b
    fs     0x0
    gs     0x0
    Saving session...
    ...copying shared history...
    ...saving history...truncating history files...
    ...completed.
    Deleting expired sessions...       7 completed.
    

    I've done some research on what this issue could be, but I'm not 100% on the cause. Clearly, it's crashing during the ttf.Init() function call, but I'm not really sure what to make of that. It should be that Rosetta can handle all Intel code and translate it to ARM code on program first run, right?

    I could use some direction in case somebody else has run into something similar before?

  • Change Windows static compile to include more static libraries

    Change Windows static compile to include more static libraries

    This will alleviate missing libstdc++ and winpthread. I verified this by running the static build go build -a -tags static -ldflags "-s -w" and looking at Windows Process Explorer to ensure that no dlls from mingw were linked against the binary.

Go implement D*Lite with SDL2
Go implement D*Lite with SDL2

dstarlite-gosdl Go implement D*Lite with SDL2 使用Go SDL2库实现的D*Lite算法 注意,尽可能使用 go mod ,自动下载依赖库(确保已经安装了SDL2库) 推荐使用Linux或者macOS运行 git clone https://github

Apr 2, 2022
A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)

xgbutil is a utility library designed to work with the X Go Binding. This project's main goal is to make various X related tasks easier. For example,

Dec 10, 2022
A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)

xgbutil is a utility library designed to work with the X Go Binding. This project's main goal is to make various X related tasks easier. For example,

Dec 10, 2022
mass-binding-target is a command line tool for generating binding target list by search plot files from disk.

mass-binding-target mass-binding-target is a command line tool for generating binding target list by search plot files from disk. Build Go 1.13 or new

Nov 5, 2021
A Go language binding for encodeing and decoding data in the bencode format that is used by the BitTorrent peer-to-peer file sharing protocol.

bencode-go A Go language binding for encoding and decoding data in the bencode format that is used by the BitTorrent peer-to-peer file sharing protoco

Nov 27, 2022
Reflectionless data binding for Go's net/http (not actively maintained)
Reflectionless data binding for Go's net/http (not actively maintained)

binding Reflectionless data binding for Go's net/http Features HTTP request data binding Data validation (custom and built-in) Error handling Benefits

Nov 18, 2022
Go binding for the cairo graphics library

go-cairo Go binding for the cairo graphics library Based on Dethe Elza's version https://bitbucket.org/dethe/gocairo but significantly extended and up

Dec 19, 2022
Go OpenCL (GOCL) Binding

gocl Go OpenCL (GOCL) Binding (http://www.gocl.org) Library documentation: http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/ http://www.khron

Jan 25, 2022
OpenGL binding generator for Go

GoGL GoGL is an OpenGL binding generator for Go. No external dependencies like GLEW are needed. Install the OpenGL bindings For example, OpenGL 2.1 bi

Dec 25, 2022
Go binding for GTK
Go binding for GTK

go-gtk WHATS Go bindings for GTK SCREENSHOT INSTALL You can experiment with go-gtk by running the various example programs: git clone https://github.c

Jan 5, 2023
The X Go Binding is a low-level API to communicate with the X server. It is modeled on XCB and supports many X extensions.

Note that this project is largely unmaintained as I don't have the time to do or support more development. Please consider using this fork instead: ht

Dec 29, 2022
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

Introduction Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on var

Jan 2, 2023
Go binding to ImageMagick's MagickWand C API

Go Imagick Go Imagick is a Go bind to ImageMagick's MagickWand C API. We support two compatibility branches: master (tag v2.x.x): 6.9.1-7 <= ImageMagi

Jan 6, 2023
gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具
gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具

中文文档 Automatic parameter binding base on go-gin doc Golang gin automatic parameter binding Support for RPC automatic mapping Support object registrati

Jan 3, 2023
Go binding for gammu

gogammu is binding for SMS related functions of libGammu (documentation). gogammu/smsd is simple, MySQL based, SMS daemon, written entirely in Go (it

Dec 24, 2020
Iris Go binding

Iris Go binding This is the official Go language binding for the Iris cloud messaging framework. Version v1 of the binding is compatible with Iris v0.

Apr 22, 2022
Openldap (LDAP) binding for Golang (go) ; no more support ; you may have a look at https://github.com/go-ldap/ldap

OpenLDAP this is Openldap binding in GO language. I don't work any more with golang, so, please fork this project. Installation : Installation is easy

Mar 4, 2021
Cgo binding for icu4c library

About Cgo binding for icu4c C library detection and conversion functions. Guaranteed compatibility with version 50.1. Installation Installation consis

Sep 27, 2022
Cgo binding for Snowball C library

Description Snowball stemmer port (cgo wrapper) for Go. Provides word stem extraction functionality. For more detailed info see http://snowball.tartar

Nov 28, 2022
Go binding to libserialport for serial port functionality.

Go Serial Package serial provides a binding to libserialport for serial port functionality. Serial ports are commonly used with embedded systems, such

Nov 1, 2022