用静态库构建go二进制文件

I'm trying to cross compile (from Arch Linux to Windows) a go binary with the openal library statically linked.

I use MinGW to cross compile to Windows and to MinGW package I have install and intend to use to link the static libary is mingw-w64-openal.

My build command looks like this: CC='i686-w64-mingw32-gcc -fno-stack-protector -D_FORTIFY_SOURCE=0 -lssp' GOOS=windows CGO_ENABLED=1 GOARCH=386 go build --ldflags '--extldflags "-static"' -v -o bin/game.exe -tags='deploy' game.go

The .go files (linked below) that is using the library has the following cgo code to lookup the static library for MinGW to use: #cgo windows LDFLAGS: /usr/i686-w64-mingw32/lib/libOpenAL32.dll.a

I get no errors during compilation but when I try run the binary file on windows I get the typical The program can't start because OpenAL32.dll is missing error. I want a completely portable executable so redistributing the .dll with the executable won't do.

The go openal package that I've modified to compile to windows:

https://github.com/golang/mobile/blob/master/exp/audio/al/al_notandroid.go https://github.com/golang/mobile/blob/master/exp/audio/al/alc_notandroid.go