【发布时间】:2018-07-16 19:26:07
【问题描述】:
我正在运行命令“sudo make install”,相关的cmake_install.cmake文件在底部。我收到的确切错误消息是:
CMake Error at cmake_install.cmake:36 (file):
file INSTALL destination:
~/Desktop/Geant/geant4.10.04-install/share/Geant4-10.4.0/geant4make is not
a directory.
Makefile:104: recipe for target 'install' failed
make: *** [install] Error 1
这让我感到困惑,因为我可以导航到那个确切的目录,它存在而且更重要的是,它是在安装过程中创建的,所以 make install 正在创建这个目录,然后说它不存在......
另外,当我最初执行 cmake 命令时,我的 CMAKE_INSTALL_PREFIX 是“~/Desktop/Geant/geant4.10.04-install”,但由于 make install 命令能够使 geant4.10.04-install 目录正确地方,我认为这不是问题。
cmake_install.cmake 文件的前 50 行(如果需要,我可以发布其余的...):
# Install script for directory: /home/kagnew/Desktop/Geant/geant4.10.04
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "~/Desktop/Geant/geant4.10.04-install")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Release")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/Geant4-10.4.0/geant4make" TYPE FILE MESSAGE_LAZY PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/kagnew/Desktop/Geant/geant4-build/InstallTreeFiles/geant4make.sh")
endif()
更新:正如 Tsyvarev 所建议的,将我的前缀路径的开头从“~”更改为“/home/user/”似乎已经解决了问题
【问题讨论】:
-
符号
~非常适合CMAKE_INSTALL_PREFIX。命令sudo make install在root 环境中运行脚本,其中~是/root,而不是/home/username。 -
进行此更改似乎已经解决了问题。非常感谢
-
在 Stack Overflow 上,我们倾向于将 problems 与 solutions 分开。您的UPDATE 部分是一个solution,它不适合question post。但是,您完全可以回答自己的问题。
标签: cmake