我正在尝试在 WSL 中编译新安装的 PCL 库。我按照线程中给出的步骤进行操作:https://stackoverflow.com/questions/58040066/how-to-compile-point-cloud-library-pcl-with-examples-ubuntu。我安装了线程中提到的所有必需依赖项,但遇到编译错误。
CMake Deprecation Warning at CMakeLists.txt:15 (cmake_policy):
The OLD behavior for policy CMP0048 will be removed from a futur
version of CMake.l/lib/cmake/vtk 9.2/FindFreetype.cmake:179(vtk_detect_library_type)
/usr/local/lib/cmake/vtk-9.2/patches/3.19/FindX11.cmake:235(find_package)
The cmake-policies(7) manual explains that the OLD behaviors of al
(find_package) policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances.
Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only
under specific short-term circumstances.
--Could NOT find LIBUSB_1 (missing: LIBUSB_1_LIBRARY LIBUSB_1_INCLUDE_DIR)
-- Checking for module 'metslib'
-- No package 'metslib' found
-- Configuring incomplete, errors occurred!
-- QHULL found (include: /usr/include, lib:
optimized;/usr/lib/x86_64-linux gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so)
CMake Error at /usr/local/lib/cmake/vtk 9.2/vtkDetectLibraryType.cmake:23 (message):
The `PATH` argument is required.
Projects should be ported to the NEW behavior and not rely on
setting a policy to OLD.
我不太明白第一行写的警告。它与 CMake 版本有什么关系吗?我是 cmake 的新手,无法弄清楚这一点。一些帮助将不胜感激:)
您正在尝试在 WSL 上进行编译,它只是一个子系统,即它没有 X-server。就这么简单。看这一行:
/usr/local/lib/cmake/vtk-9.2/patches/3.19/FindX11.cmake:235(find_package)
长话短说,你不能也许能够在WSL上编译它,因为但是VTK需要一个X-server来实现它的可视化,你需要从获取X-开始服务器已启动并正在运行。我真的不确定这将如何在 WSL 上运行,即使您有 X-server 可以与 WSL 一起使用,但我在这里可能是错的。
编辑:显然,通过转发它可以让 X-server 在 WSL 上工作,但我仍然相信(特别是因为你是新人)这比仅仅让双启动工作要做更多的工作。
EDIT2:Tsyvarev 非常友善地提供了一个很好的链接,介绍如何在 WSL 上配置 X-server。
The PATH argument is required
问题。我的解决方案来自使用 VTK 依赖项配置软件时的问题 - VTK cmake 文件中失败。 我的错误信息如下
CMake Error at /usr/local/lib/cmake/vtk-9.1/vtkDetectLibraryType.cmake:23 (message):
The `PATH` argument is required.
Call Stack (most recent call first):
/usr/local/lib/cmake/vtk-9.1/FindFreetype.cmake:179 (vtk_detect_library_type)
/usr/local/lib/cmake/vtk-9.1/patches/3.19/FindX11.cmake:235 (find_package)
/usr/local/lib/cmake/vtk-9.1/VTK-vtk-module-find-packages.cmake:350 (find_package)
/usr/local/lib/cmake/vtk-9.1/vtk-config.cmake:152 (include)
CMakeLists.txt:366 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/user/sourcecode/pcl-1.9.1/build/CMakeFiles/CMakeOutput.log".
vtkDetectLibraryType.cmake:23
破坏了程序。
vtkDetectLibraryType.cmake:23
的上下文如下:
function (vtk_detect_library_type output)
cmake_parse_arguments(PARSE_ARGV 1 vdlt
""
"PATH"
"")
if (NOT DEFINED vdlt_PATH)
message(FATAL_ERROR
"The `PATH` argument is required.") # <------ error occurs here
endif ()
if (DEFINED vdlt_UNPARSED_ARGUMENTS)
message(FATAL_ERROR
"Unparsed arguments for vtk_detect_library_type: "
"${vdlt_UNPARSED_ARGUMENTS}")
endif ()
从代码来看,只有当vdlt_PATH
没有定义时,程序才会退出并输出
The PATH argument is required
。
vdlt_PATH
是如何定义的?这是由
cmake_parse_arguments
完成的。它解析参数,检查是否包含
PATH
关键字并将值相应地存储到
vdlt_PATH
。
FindFreetype.cmake:179
导致了
vtkDetectLibraryType.cmake:23
。
FindFreetype.cmake:179
的内容是:
vtk_detect_library_type(freetype_release_library_type
PATH "${FREETYPE_LIBRARY_RELEASE}")
只需在相关函数中传递 ${FREETYPE_LIBRARY_RELEASE}
和
${argv1}
的值,输出都是相同的。因此,在我的情况下,
cmake_parse_arguments
似乎无法正常工作。因此,我们可以手动设置
cmake_parse_arguments
的值,而不是使用
vdlt_PATH
,如下所示:
function (vtk_detect_library_type output)
list(GET ARGN 1 ARGN1)
set(vdlt_PATH ${ARGN1})
if (NOT DEFINED vdlt_PATH)
message(FATAL_ERROR
"The `PATH` argument is required.")
endif ()