我正在尝试编译一个在Mingw64环境中使用ffmpeg的cgo程序。我从pkg-config
收到错误,说它无法找到ffmpeg库:
$ go build -x src/github.com/imkira/go-libav/examples/transcoder.go
WORK=C:\msys64\tmp\go-build616922114
mkdir -p $WORK\b033\
cd c:\users\chris_000\code\go\src\github.com\imkira\go-libav\avfilter
pkg-config --cflags -- libavfilter libavutil
mkdir -p $WORK\b030\
cd c:\users\chris_000\code\go\src\github.com\imkira\go-libav\avcodec
pkg-config --cflags -- libavcodec libavutil
# pkg-config --cflags libavfilter libavutil
Package libavfilter was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavfilter.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavfilter' found
Package libavutil was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavutil.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavutil' found
pkg-config: exit status 1
但是当我从shell运行pkg-config
时,它可以正常工作:
$ pkg-config --cflags -- libavfilter libavutil
-I/mingw64/include
$ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
我正在使用MSYS2的Mingw64环境。我做了一个干净的MSYS2安装(在Windows 10上),然后安装了以下软件包:
$ pacman -S pkg-config mingw-w64-x86_64-gcc mingw-w64-x86_64-ffmpeg
我尝试安装的Go程序来自examples/transcoder.go
https://github.com/imkira/go-libav
。我的Go版本为go1.10.1 windows/amd64
。
注意:PKG_CONFIG_PATH
从shell导出,libavutil.pc
和libavcodec.pc
出现在/mingw64/lib/pkgconfig
。
答案 0 :(得分:0)
pkg-config
有两个版本。安装mingw-w64-x86_64-pkg-config
修复了问题:
pacman -S mingw-w64-x86_64-pkg-config
不知道为什么我已安装的pkg-config
版本来自shell,但不是来自cgo。