portaudio
portaudio copied to clipboard
MacOS compile Windows error
Hello! Is it real to compile portaudio for windows from macos?
I using this payload to go this:
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="x86_64-w64-mingw32-gcc" go build -o recorder_v1.exe
but gettting error:
x86_64-w64-mingw32-gcc: error: unrecognized command-line option '-framework
x4
Could you tell how fix it, pls?
I don't have any experience cross compiling portaudio-go. But I suspect your problem is related to the pkg-config configuration for PortAudio -- I suppose that is where -framework x4
is declared. Good luck!
Apart of the compiler, you also have to make sure that the C-Libraries are compiled for the correct OS / Architecture. I'm successfully using docker to cross compile cgo projects on MacOS with Windows / Linux as targets.
You can adopt the Dockerfiles to your needs: https://github.com/dh1tw/remoteAudio-xcompile
Here is a blog article with more details: https://dh1tw.de/2019/12/cross-compiling-golang-cgo-projects/