nevernew
nevernew

Reputation: 672

How do you set up golang on windows with the header files for goav

I'm trying to compile goav on Windows and I've got quite far I've compiled the ffmpeg libraries in MSYS2 and linked the packages with:

set PKG_CONFIG_PATH=%~dp0FFmpeg\libavformat;%~dp0FFmpeg\libavcodec;%~dp0FFmpeg\libavutil;%~dp0FFmpeg\libswresample;

which has worked!

However, here's the problem now:

# github.com/giorgisio/goav/avcodec
source\src\github.com\giorgisio\goav\avcodec\avcodec.go:14:34: fatal error: libavformat/avformat.h: No such file or directory
 //#include <libavformat/avformat.h>

When compiling, Golang can't find the avformat.h (and I assume the other ffmpeg header files, but compilation terminated).

How do I tell go where these files are? I've checked and they are in the folders described in the PKG_CONFIG_PATH, but I guess it's not looking for them there.

Side note: I see that on linux-debian based systems I just have to do a apt-get install libavformat-dev but I want to compile on windows.

Upvotes: 0

Views: 854

Answers (1)

nevernew
nevernew

Reputation: 672

The solution to my problem was to set the CGO_CFLAGS environment variable before building to tell the compiler where the include files are for ffmpeg:

@set CGO_CFLAGS=-IC:\path\to\FFmpeg\

... My project is still not building, but that error isn't showing up anymore

Upvotes: 1

Related Questions