portaudio icon indicating copy to clipboard operation
portaudio copied to clipboard

MacOS compile Windows error

Open justadoll opened this issue 2 years ago • 2 comments

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?

justadoll avatar Jul 20 '22 17:07 justadoll

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!

gordonklaus avatar Jul 20 '22 18:07 gordonklaus

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/

dh1tw avatar Jul 25 '22 11:07 dh1tw