在mingw64环境中编译期间查找库(libgcrypt和libgpg-error)

时间:2016-11-28 16:20:43

标签: ffmpeg mingw-w64 libgcrypt

我是一名真正的初学者,所以提前就明显的问题道歉。我正在尝试编译ffmpeg的自定义构建,它具有正常构建所没有的额外依赖性。其中包括libgcryptlibgpg-error - 我知道这一点,因为当我运行configure时,它会失败,并且日志包含:

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错误的repo,运行makemake install,在libgpg-error.dll.a中创建了libgpg-error.la/home/myuser/w64root/lib。我已经尝试将此路径添加到我的$LIB环境变量中,但是配置运行仍然说它无法找到库。

如何让它可见?我也在机器上有pkg-config - 手动创建.pc文件可以帮助我吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

如果你运行./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

你应该没事。

相关问题