【问题标题】:Finding library during compilation in mingw64 environment (libgcrypt and libgpg-error)mingw64环境编译时查找库(libgcrypt和libgpg-error)
【发布时间】:2016-11-28 16:20:42
【问题描述】:

我是这方面的真正初学者,所以对于明显的问题提前道歉。我正在尝试编译一个自定义构建的 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-error 的 repo,运行了 makemake install,它们在 /home/myuser/w64root/lib 中创建了 libgpg-error.dll.alibgpg-error.la。我已经尝试将此路径添加到我的$LIB 环境变量中,但配置运行仍然说它找不到库。

如何使它可见?我的机器上也有 pkg-config 可用 - 手动创建 .pc 文件对我有帮助吗?

谢谢!

【问题讨论】:

    标签: ffmpeg mingw-w64 libgcrypt


    【解决方案1】:

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

    你应该没事。

    【讨论】:

      猜你喜欢
      • 2018-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 2023-04-10
      • 1970-01-01
      • 2023-03-20
      相关资源
      最近更新 更多