SKV
SKV

Reputation: 284

g++ doesn't find the file included with -I argument

I'm compiling a package using cMake-gui/make on Ubuntu. The package needs the address to pyublas which is by default located at /usr/local/lib/python2.7/dist-packages/pyublas. After configuration and running make, g++ is called with the correct parameter -I /usr/local/lib/python2.7/dist-packages/pyublas but g++-4.6 produces the error message:

[ 80%] Building CXX object 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: fatal error: pyublas/numpy.hpp: No such file or directory

Checking the pyublas I can see numpy.hpp in that folder. Changing the pyublas folder to /usr/local/lib/python2.7/dist-packages -- that is going up by one folder-- does not solve the problem. It produces the exact same error.

I have no clue what's going wrong!


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 <[email protected]>")
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 <[email protected]>")
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)

Upvotes: 0

Views: 464

Answers (1)

Antonio
Antonio

Reputation: 20326

Add in your CMakeLists.txt (eventually in the CMakeLists.txt in the src directory)

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

and of course remove it from your cmake call.

If it doesn't work, please post also the CMakeLists.txt in the src directory.

Upvotes: 1

Related Questions