CMake 在自定义安装路径中找不到 FFMPEG

发布于 2024-10-29 04:24:56 字数 369 浏览 2 评论 0原文

我正在 Ubuntu 10.10 上编译一个项目的依赖项,默认情况下我没有将其安装到 /usr/local,而是将其安装到 /tmp/stage/usr/local。当我调用 CMake 来生成所述项目的构建文件时,如何通知 CMake 此自定义安装依赖项的位置。

我正在运行CMAKE 2.8.1,并且我尝试在CMake命令行上设置CMAKE_PREFIX_PATH,

cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local

但这似乎并没有什么不同 - 该项目似乎并没有检测到依赖关系。

另外,如果重要的话,所讨论的项目是 OpenCV 2.2,所讨论的依赖项是 FFMPEG...

I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.

I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so

cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local

but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.

Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦初启 2024-11-05 04:24:56

我想出了如何解决我的问题,并且尝试将 CMake 指向适当的安装位置不是问题。

显然,CMake 无法找到 FFMPEG 的 pkg-config 文件(即 libavcodec.pc、libavdevice.pc 等)来告诉它 FFMPEG 标头和库的位置。在典型的安装场景中,这些文件将位于 /usr/lib/pkgconfig。但是,由于自定义安装位置,它们位于 /tmp/stage/usr/local/lib/pkgconfig。

为了让 CMake 能够找到这些文件,我必须添加以下环境变量:

export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig

之后,OpenCV 按预期针对 FFMPEG 进行构建。

I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.

Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.

So that CMake could find these files, I had to add the following environment variable:

export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig

After which point, OpenCV built against FFMPEG as expected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文