0

我正在 Ubuntu 上使用 cMake-gui/make 编译一个包。该软件包需要 pyublas 的地址,默认情况下位于/usr/local/lib/python2.7/dist-packages/pyublas. 配置并运行后makeg++使用正确的参数调用,-I /usr/local/lib/python2.7/dist-packages/pyublasg++-4.6会产生错误消息:

[ 80%] 构建 CXX 对象 src/cuv_python/CMakeFiles/cuv_python.dir/export_tensor.cpp.o cd /home/xxx/workspace/CUV/build/src/cuv_python && /usr/bin/g++-4.6 -DRANDOM_PATH=/ home/xxx/workspace/CUV/build -Dcuv_python_EXPORTS -fPIC -O3 -DNDEBUG -fPIC -I/usr/local/cuda/C/common/inc -I/home/xxx/workspace/CUV/src/tools -I/ home/xxx/workspace/CUV/src -I/home/xxx/workspace/CUV/src/basics -I/home/xxx/workspace/CUV/src/convert -I/home/xxx/workspace/CUV/src/ tensor_ops -I/home/xxx/workspace/CUV/src/matrix_ops -I/home/xxx/workspace/CUV/src/convolution_ops -I/home/xxx/workspace/CUV/src/random -I/usr/include/ python2.7 -I/usr/local/lib/python2.7/dist-packages/pyublas -o CMakeFiles/cuv_python.dir/export_tensor.cpp.o -c /home/xxx/workspace/CUV/src/cuv_python/export_tensor.cpp /home/xxx/workspace/CUV/src/cuv_python/export_tensor.cpp:39: 29: 致命错误:pyublas/numpy.hpp:没有这样的文件或目录

检查pyublas我可以numpy.hpp在该文件夹中看到。将 pyublas 文件夹更改为/usr/local/lib/python2.7/dist-packages- 增加一个文件夹 - 并不能解决问题。它产生完全相同的错误。

我不知道出了什么问题!


Here's the CMakeLists.txt:
cmake_minimum_required( VERSION 2.6 FATAL_ERROR )

#
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their
# definition # and dump it in the cache along with proper documentation,
# otherwise set CMAKE_BUILD_TYPE # to Debug prior to calling PROJECT()
#
IF(DEFINED CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ELSE()
    SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF()

PROJECT(CUV Fortran CXX C)
SET(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules )

EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d%H%M" OUTPUT_VARIABLE DATESTR)
string(REGEX REPLACE "^(....)(..)(..)(..)(..).*" "\\1\\2\\3\\4\\5" DATESTR ${DATESTR}) 

SET(LIB_SUFFIX "")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
    SET(LIB_SUFFIX _dbg)
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")


INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_SOURCE_GENERATOR "DEB")
SET(CPACK_GENERATOR "DEB")
#SET(CPACK_PACKAGE_NAME "cuv${LIB_SUFFIX}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "N-dimensional array datastructures and algorithms on CPU and GPU")
SET(CPACK_PACKAGE_VENDOR "Hannes Schulz")
SET(CPACK_PACKAGE_CONTACT "Hannes Schulz <schulz@ais.uni-bonn.de>")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
    SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "9")
SET(CPACK_PACKAGE_VERSION_PATCH ${DATESTR})
SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES};cfg/config.h;${CMAKE_SOURCE_DIR}/.git;${CMAKE_SOURCE_DIR}/src/matrix_ops/spmv_kernel_inst.cuh;${CMAKE_SOURCE_DIR}/src/matrix_ops/spmv_kernel_inst.cuh-;${CMAKE_SOURCE_DIR}/build;${CMAKE_SOURCE_DIR}/debug")
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${LIB_SUFFIX}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET (CPACK_OUTPUT_FILE_PREFIX "../..")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Hannes Schulz <schulz@ais.uni-bonn.de>")
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm;")
#SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst;")
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "cuv${LIB_SUFFIX}")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS    "libboost-dev, libblas-dev, libpng-dev, libjpeg-dev" )
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS   "cimg-dev, python-dev, libboost-python-dev" )
INCLUDE(CPack)

FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
    CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_BINARY_DIR}/docs/Doxyfile)
    ADD_CUSTOM_COMMAND(
        DEPENDS ${CMAKE_BINARY_DIR}/docs/Doxyfile
        OUTPUT  ${CMAKE_BINARY_DIR}/docs/html/index.html
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/docs/Doxyfile
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        )
    ADD_CUSTOM_TARGET(doc DEPENDS ${CMAKE_BINARY_DIR}/docs/html/index.html ${CMAKE_BINARY_DIR}/docs/Doxyfile)
ENDIF(DOXYGEN_FOUND)

ENABLE_TESTING()
add_subdirectory(src)

4

1 回答 1

1

添加您的 CMakeLists.txt(最终在 src 目录中的 CMakeLists.txt 中)

include_directories(/usr/local/lib/python2.7/dist-packages/)

当然,从你的 cmake 调用中删除它。

如果它不起作用,请将 CMakeLists.txt 也发布到 src 目录中。

于 2013-06-26T20:55:31.307 回答