在mingw64环境编译期间查找库(libgcrypt和libgpg-error)
问题描述:
我是一个真正的初学者,所以对于明显的问题提前表示歉意。我试图编译一个ffmpeg的自定义构建,它具有一些额外的依赖关系,而普通构建不包含这些依赖关系。在这些为libgcrypt
和libgpg-error
- 我知道这一点,因为当我运行configure
,失败和日志包含:在mingw64环境编译期间查找库(libgcrypt和libgpg-error)
C:/workspace/windows/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcrypt
C:/workspace/windows/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgpg-error
考虑到这一点,我克隆了的libgpg错误的回购,跑make
和make install
,它在/home/myuser/w64root/lib
中创建了libgpg-error.dll.a
和libgpg-error.la
。我已经尝试将此路径添加到我的$LIB
环境变量中,但配置运行仍然表示无法找到该库。
如何使其可见?我也有pkg-config
在机器上 - 将手动创建一个.pc
文件帮助我吗?
谢谢!
答
如果运行./configure -h
,你应该在输出看到这一点:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
请特别注意LDFLAGS
。这涵盖了你的情况,因为/home/myuser/w64root/lib
不在链接器的标准搜索目录中。因此运行:
export LDFLAGS='-L/home/myuser/w64root/lib'; ./configure
你应该没问题。