configure_file 编译 nfs-ganesha 时 make install 出错

configure_file error on make install while compiling nfs-ganesha

我的objective

我想在 Oracle Linux 机器上从源代码编译和安装 nfs-ganesha。

重现步骤

  1. 从 github 下载 nfs-ganesha:https://github.com/nfs-ganesha/nfs-ganesha
  2. 按照本指南第 56 行到第 61 行的步骤(只是正常的编译和安装):https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/COMPILING_HOWTO.txt
  3. 有时,您可能会收到一条错误消息,提示您缺少 userspace-rcu。 sudo yum install userspace-rcu userspace-rcu-devel 修复它。
  4. 当我 运行 最后一个命令 (make install) 时,我得到以下错误:

错误

bash-4.2$ make install
[  3%] Built target MainServices
normal build output...
[100%] Built target fsalmem
Install the project...
-- Install configuration: "Debug"
-- Installing: /etc/ganesha/ganesha.conf
CMake Error at cmake_install.cmake:54 (configure_file):
  configure_file Problem configuring file


make: *** [install] Error 1

一些见解

我打开 cmake_install.cmake 看看有什么问题,这里是代码片段:

我用箭头标记了错误的线路

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  
        set(_destfile "/etc/ganesha/ganesha.conf")
        if (NOT "$ENV{DESTDIR}" STREQUAL "")
            # prepend install root prefix with install-time DESTDIR
            set(_destfile "$ENV{DESTDIR}//etc/ganesha/ganesha.conf")
        endif ()
        if (EXISTS ${_destfile})
            message(STATUS "Skipping: ${_destfile} (already exists)")
            execute_process(COMMAND "/usr/bin/cmake" -E compare_files
                /home/carlhida/Documents/ganesha/src/config_samples/ganesha.conf.example ${_destfile} RESULT_VARIABLE _diff)
            if (NOT "${_diff}" STREQUAL "0")
                message(STATUS "Installing: ${_destfile}.example")
                configure_file(/home/carlhida/Documents/ganesha/src/config_samples/ganesha.conf.example ${_destfile}.example COPYONLY)
            endif ()
        else ()
            message(STATUS "Installing: ${_destfile}")
            # install() is not scriptable within install(), and
            # configure_file() is the next best thing
-------->>> configure_file(/home/carlhida/Documents/ganesha/src/config_samples/ganesha.conf.example ${_destfile} COPYONLY)
            # TODO: create additional install_manifest files?
        endif ()
    
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

我在这个函数上发现的是它将一个文件复制到另一个文件,但我不确定如何从错误中获取更多信息。我主要担心的是它可能与权限有关,但是当我使用 sudo 时,我只得到:

bash-4.2$ sudo make install
CMake Error: The source directory "/home/carlhida/Documents/ganesha/src" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** [cmake_check_build_system] Error 1

所以我认为这与此无关。

旋转问题

有没有办法知道这些文件到底出了什么问题?如果有人知道如何获得这些错误的详细输出,我将不胜感激。

感谢您的帮助!

我通过将 repo 的文件夹和构建文件夹移动到名为 /scratch 的目录来解决这个问题。然后我以root身份再次发出命令。这次安装正确了。