Can't build OpenCV3.1 for Python 2.7 - python

I downloaded opencv and opencv contrib files, following the tutorial here: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/
I want to install OpenCV3 for Python2.7 in a Conda environment called obj_recog. My OS is Ubuntu 16.04.
I then tried running the Cmake with different options, finally settling on this:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON \
-D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON -D WITH_CUDA=ON \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 -D WITH_FFMPEG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
-D PYTHON_EXECUTABLE=~/anaconda3/envs/obj_recog/bin/python \
-D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON -D WITH_CUBLAS=ON ..
Here is the output I get:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON -D WITH_CUDA=ON -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 -D WITH_FFMPEG=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules -D PYTHON_EXECUTABLE=~/anaconda3/envs/obj_recog/bin/python -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D BUILD_EXAMPLES=ON -D WITH_CUBLAS=ON ..
-- The CXX compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detected version of GNU GCC: 54 (504)
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing Test HAVE_C_W - Success
-- Performing Test HAVE_CXX_WALL
-- Performing Test HAVE_CXX_WALL - Success
-- Performing Test HAVE_C_WALL
-- Performing Test HAVE_C_WALL - Success
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_C_WERROR_RETURN_TYPE
-- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_WERROR_ADDRESS
-- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
-- Performing Test HAVE_C_WERROR_ADDRESS
-- Performing Test HAVE_C_WERROR_ADDRESS - Success
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_CXX_WFORMAT
-- Performing Test HAVE_CXX_WFORMAT - Success
-- Performing Test HAVE_C_WFORMAT
-- Performing Test HAVE_C_WFORMAT - Success
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WMISSING_DECLARATIONS
-- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing Test HAVE_C_WUNDEF - Success
-- Performing Test HAVE_CXX_WINIT_SELF
-- Performing Test HAVE_CXX_WINIT_SELF - Success
-- Performing Test HAVE_C_WINIT_SELF
-- Performing Test HAVE_C_WINIT_SELF - Success
-- Performing Test HAVE_CXX_WPOINTER_ARITH
-- Performing Test HAVE_CXX_WPOINTER_ARITH - Success
-- Performing Test HAVE_C_WPOINTER_ARITH
-- Performing Test HAVE_C_WPOINTER_ARITH - Success
-- Performing Test HAVE_CXX_WSHADOW
-- Performing Test HAVE_CXX_WSHADOW - Success
-- Performing Test HAVE_C_WSHADOW
-- Performing Test HAVE_C_WSHADOW - Success
-- Performing Test HAVE_CXX_WSIGN_PROMO
-- Performing Test HAVE_CXX_WSIGN_PROMO - Success
-- Performing Test HAVE_C_WSIGN_PROMO
-- Performing Test HAVE_C_WSIGN_PROMO - Failed
-- Performing Test HAVE_CXX_WNO_NARROWING
-- Performing Test HAVE_CXX_WNO_NARROWING - Success
-- Performing Test HAVE_C_WNO_NARROWING
-- Performing Test HAVE_C_WNO_NARROWING - Success
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success
-- Performing Test HAVE_CXX_WNO_LONG_LONG
-- Performing Test HAVE_CXX_WNO_LONG_LONG - Success
-- Performing Test HAVE_C_WNO_LONG_LONG
-- Performing Test HAVE_C_WNO_LONG_LONG - Success
-- Performing Test HAVE_CXX_PTHREAD
-- Performing Test HAVE_CXX_PTHREAD - Success
-- Performing Test HAVE_C_PTHREAD
-- Performing Test HAVE_C_PTHREAD - Success
-- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER
-- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success
-- Performing Test HAVE_C_FOMIT_FRAME_POINTER
-- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success
-- Performing Test HAVE_CXX_MSSE
-- Performing Test HAVE_CXX_MSSE - Success
-- Performing Test HAVE_C_MSSE
-- Performing Test HAVE_C_MSSE - Success
-- Performing Test HAVE_CXX_MSSE2
-- Performing Test HAVE_CXX_MSSE2 - Success
-- Performing Test HAVE_C_MSSE2
-- Performing Test HAVE_C_MSSE2 - Success
-- Performing Test HAVE_CXX_MNO_AVX
-- Performing Test HAVE_CXX_MNO_AVX - Success
-- Performing Test HAVE_C_MNO_AVX
-- Performing Test HAVE_C_MNO_AVX - Success
-- Performing Test HAVE_CXX_MSSE3
-- Performing Test HAVE_CXX_MSSE3 - Success
-- Performing Test HAVE_C_MSSE3
-- Performing Test HAVE_C_MSSE3 - Success
-- Performing Test HAVE_CXX_MNO_SSSE3
-- Performing Test HAVE_CXX_MNO_SSSE3 - Success
-- Performing Test HAVE_C_MNO_SSSE3
-- Performing Test HAVE_C_MNO_SSSE3 - Success
-- Performing Test HAVE_CXX_MNO_SSE4_1
-- Performing Test HAVE_CXX_MNO_SSE4_1 - Success
-- Performing Test HAVE_C_MNO_SSE4_1
-- Performing Test HAVE_C_MNO_SSE4_1 - Success
-- Performing Test HAVE_CXX_MNO_SSE4_2
-- Performing Test HAVE_CXX_MNO_SSE4_2 - Success
-- Performing Test HAVE_C_MNO_SSE4_2
-- Performing Test HAVE_C_MNO_SSE4_2 - Success
-- Performing Test HAVE_CXX_FFUNCTION_SECTIONS
-- Performing Test HAVE_CXX_FFUNCTION_SECTIONS - Success
-- Performing Test HAVE_C_FFUNCTION_SECTIONS
-- Performing Test HAVE_C_FFUNCTION_SECTIONS - Success
-- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN
-- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /home/geoff/anaconda3/envs/obj_recog/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Found TIFF: /home/geoff/anaconda3/envs/obj_recog/lib/libtiff.so (found version "4.0.6")
-- Found JPEG: /home/geoff/anaconda3/envs/obj_recog/lib/libjpeg.so
-- Found WebP: /usr/lib/x86_64-linux-gnu/libwebp.so
-- Found Jasper: /usr/lib/x86_64-linux-gnu/libjasper.so (found version "1.900.1")
-- Found ZLIB: /home/geoff/anaconda3/envs/obj_recog/lib/libz.so (found version "1.2.8")
-- Found PNG: /home/geoff/anaconda3/envs/obj_recog/lib/libpng.so (found version "1.6.22")
-- Looking for /home/geoff/anaconda3/envs/obj_recog/include/libpng/png.h
-- Looking for /home/geoff/anaconda3/envs/obj_recog/include/libpng/png.h - not found
-- Looking for semaphore.h
-- Looking for semaphore.h - found
-- Performing Test HAVE_CXX_WNO_SHADOW
-- Performing Test HAVE_CXX_WNO_SHADOW - Success
-- Performing Test HAVE_CXX_WNO_UNUSED
-- Performing Test HAVE_CXX_WNO_UNUSED - Success
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success
-- Performing Test HAVE_CXX_WNO_UNDEF
-- Performing Test HAVE_CXX_WNO_UNDEF - Success
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success
-- Performing Test HAVE_CXX_WNO_SWITCH
-- Performing Test HAVE_CXX_WNO_SWITCH - Success
-- Performing Test HAVE_CXX_WNO_PARENTHESES
-- Performing Test HAVE_CXX_WNO_PARENTHESES - Success
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success
-- Performing Test HAVE_CXX_WNO_EXTRA
-- Performing Test HAVE_CXX_WNO_EXTRA - Success
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success
-- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
-- No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
-- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
-- No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
-- No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
-- No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
-- No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
-- No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
-- No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
-- No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
-- Found libdc1394-2, version 2.2.4
-- Checking for module 'libv4l1'
-- Found libv4l1, version 1.10.0
-- Checking for module 'libv4l2'
-- Found libv4l2, version 1.10.0
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavcodec'
-- Found libavcodec, version 57.64.101
-- Checking for module 'libavformat'
-- Found libavformat, version 57.56.100
-- Checking for module 'libavutil'
-- Found libavutil, version 55.34.100
-- Checking for module 'libswscale'
-- Found libswscale, version 4.2.100
-- Checking for module 'libavresample'
-- No package 'libavresample' found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
-- No package 'libgphoto2' found
-- Checking for module 'tbb'
-- Found tbb, version 4.4~20151115
-- ICV: Removing previous unpacked package: /home/geoff/opencv-3.1.0/3rdparty/ippicv/unpack
-- ICV: Unpacking ippicv_linux_20151201.tgz to /home/geoff/opencv-3.1.0/3rdparty/ippicv/unpack...
-- ICV: Package successfully downloaded
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/geoff/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /home/geoff/anaconda3/envs/obj_recog/bin/python (found suitable version "2.7.12", minimum required is "2.7")
When I execute make j-4 as in the tutorial, the make then breaks around 40%.
I also tried installing by using conda install opencv, but then I can't read .avi videos or images, getting the following error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /root/mc-x64-2.7/conda-bld/opencv-3_1482256854890/work/opencv-3.1.0/modules/highgui/src/window.cpp, line 545
Traceback (most recent call last):
File "find_game.py", line 24, in <module>
cv2.imshow("Image", image)
cv2.error: /root/mc-x64-2.7/conda-bld/opencv-3_1482256854890/work/opencv-3.1.0/modules/highgui/src/window.cpp:545: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage
I checked and libgtk2-0-dev is correctly installed.
Before building OpenCV by hand, I also compiled and reinstalled ffmpeg and gstreamer.
During the make, I get this error:
//usr/lib/x86_64-linux-gnu/libsoxr.so.0: undefined reference to `GOMP_parallel#GOMP_4.0'
collect2: error: ld returned 1 exit status
samples/opengl/CMakeFiles/example_opengl_opengl_interop.dir/build.make:107: recipe for target 'bin/opengl-example-opengl_interop' failed
make[2]: *** [bin/opengl-example-opengl_interop] Error 1
CMakeFiles/Makefile2:31556: recipe for target 'samples/opengl/CMakeFiles/example_opengl_opengl_interop.dir/all' failed
make[1]: *** [samples/opengl/CMakeFiles/example_opengl_opengl_interop.dir/all] Error 2
Any help would be greatly appreciated !

https://realpython.com/blog/python/face-detection-in-python-using-a-webcam/
If you follow this link and you can try running this code
git clone https://github.com/shantnu/Webcam-Face-Detect.git
cd cd Webcam-Face-Detect/
sudo python webcam_cv3.py haarcascade_frontalface_default.xml
typing the sudo python did the trick for me , i was getting errors when using just python.So try running with sudo.

This error is nothing to do with libgtk2.0-dev and pkg-config. Probably both are installed, but you still get the same error everytime you try to run make.
This often happen when you have tried to install opencv from different sources (for exemple opencv-python, official python, etc). Try to uninstall all opencv related packages (specially if they were not the official one), and start over. I even had to re-install ubuntu once.
The instructions from pyimagesearch work well.

Related

CmakeLists.txt is empty [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 days ago.
Improve this question
i want to ask u pls i got this error with a CmakeLists.txt fille empty, can u pls help me?
ash23#DESKTOP-BUN2LC1:~/catkin_ws$ sudo apt-get install -y ros-move-base-msgs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ros-actionlib-msgs ros-geometry-msgs ros-std-msgs
The following NEW packages will be installed:
ros-actionlib-msgs ros-geometry-msgs ros-move-base-msgs ros-std-msgs
0 upgraded, 4 newly installed, 0 to remove and 39 not upgraded.
Need to get 19.4 kB of archives.
After this operation, 127 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 ros-std-msgs all 0.5.12-2 [5,432 B]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 ros-actionlib-msgs all 1.12.7-2 [3,992 B]
Get:3 http://archive.ubuntu.com/ubuntu focal/universe amd64 ros-geometry-msgs all 1.12.7-2 [6,044 B]
Get:4 http://archive.ubuntu.com/ubuntu focal/universe amd64 ros-move-base-msgs all 1.13.1-1 [3,884 B]
Fetched 19.4 kB in 0s (44.4 kB/s)
Selecting previously unselected package ros-std-msgs.
(Reading database ... 161458 files and directories currently installed.)
Preparing to unpack .../ros-std-msgs_0.5.12-2_all.deb ...
Unpacking ros-std-msgs (0.5.12-2) ...
Selecting previously unselected package ros-actionlib-msgs.
Preparing to unpack .../ros-actionlib-msgs_1.12.7-2_all.deb ...
Unpacking ros-actionlib-msgs (1.12.7-2) ...
Selecting previously unselected package ros-geometry-msgs.
Preparing to unpack .../ros-geometry-msgs_1.12.7-2_all.deb ...
Unpacking ros-geometry-msgs (1.12.7-2) ...
Selecting previously unselected package ros-move-base-msgs.
Preparing to unpack .../ros-move-base-msgs_1.13.1-1_all.deb ...
Unpacking ros-move-base-msgs (1.13.1-1) ...
Setting up ros-std-msgs (0.5.12-2) ...
Setting up ros-geometry-msgs (1.12.7-2) ...
Setting up ros-actionlib-msgs (1.12.7-2) ...
Setting up ros-move-base-msgs (1.13.1-1) ...
ash23#DESKTOP-BUN2LC1:~/catkin_ws$ catkin_make
Base path: /home/ash23/catkin_ws
Source space: /home/ash23/catkin_ws/src
Build space: /home/ash23/catkin_ws/build
Devel space: /home/ash23/catkin_ws/devel
Install space: /home/ash23/catkin_ws/install
####
#### Running command: "cmake /home/ash23/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/ash23/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ash23/catkin_ws/install -G Unix Makefiles" in "/home/ash23/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ash23/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ash23/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 21 packages in topological order:
-- ~~ - fouliex_bot
-- ~~ - navigation (metapackage)
-- ~~ - move_base_msgs
-- ~~ - tutorial_one
-- ~~ - map_server
-- ~~ - map_msgs
-- ~~ - rplidar_ros
-- ~~ - amcl
-- ~~ - fake_localization
-- ~~ - voxel_grid
-- ~~ - costmap_2d
-- ~~ - nav_core
-- ~~ - base_local_planner
-- ~~ - carrot_planner
-- ~~ - clear_costmap_recovery
-- ~~ - dwa_local_planner
-- ~~ - move_slow_and_clear
-- ~~ - navfn
-- ~~ - global_planner
-- ~~ - rotate_recovery
-- ~~ - move_base
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'fouliex_bot'
-- ==> add_subdirectory(MapAWorldWithSlamAndACustomRobot)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Could NOT find move_base_msgs (missing: move_base_msgs_DIR)
-- Could not find the required component 'move_base_msgs'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "move_base_msgs"
with any of the following names:
move_base_msgsConfig.cmake
move_base_msgs-config.cmake
Add the installation prefix of "move_base_msgs" to CMAKE_PREFIX_PATH or set
"move_base_msgs_DIR" to a directory containing one of the above files. If
"move_base_msgs" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
MapAWorldWithSlamAndACustomRobot/CMakeLists.txt:11 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/ash23/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ash23/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
i want to create a map

ModuleNotFoundError: No module named 'freenect' - how to fix this?

I'm working on a project that requires python and some libraries. Almost everything works but there is one library that I can't get installed. It's about OpenKinect. You can find more information about it here: https://openkinect.org/wiki/Main_Page. I am running ubuntu desktop with python 3 installed.
i tried to install it using the instructions on the website but when i try to run it i get the error ModuleNotFoundError: No module named 'freenect'.
I want to make this project and improve it: https://www.instructables.com/How-You-Can-Make-a-Fully-Autonomous-Self-Driving-V/
All files are here: https://github.com/sieuwe1/Advanced-Real-Time-Self-Driving.
I've also tried to follow this guide: https://naman5.wordpress.com/2014/06/24/experimenting-with-kinect-using-opencv-python-and-open-kinect-libfreenect/ but when I try to install the necessary dependencies (step 2) I get this error:
Pakketlijsten worden ingelezen... Klaar
Boom van vereisten wordt opgebouwd... Klaar
De statusinformatie wordt gelezen... Klaar
Let op, 'git' wordt geselecteerd in plaats van 'git-core'
E: Kan pakket lubusb-1.0-0-dev niet vinden
E: Kon geen enkel pakket vinden via expansie (glob) 'lubusb-1.0-0-dev'
E: Kon geen enkel pakket vinden via regex 'lubusb-1.0-0-dev'
I leave it in Dutch to avoid mistakes.
When I type "cmake -L .." I get the following error:
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Operating system is Linux
-- Got System Processor x86_64
-- Linux x86_64 Detected
-- libfreenect will be installed to /usr/local
-- Headers will be installed to /usr/local/include/libfreenect
-- Libraries will be installed to /usr/local/lib
-- Found libusb-1.0:
-- - Includes: /usr/local/include/libusb-1.0
-- - Libraries: /usr/local/lib/libusb-1.0.so
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindOpenGL.cmake:315 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
examples/CMakeLists.txt:16 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'glut'
-- No package 'glut' found
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindOpenGL.cmake:315 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
wrappers/cpp/CMakeLists.txt:9 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Checking for module 'glut'
-- No package 'glut' found
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named numpy
-- Configuring done
-- Generating done
-- Build files have been written to: /home/marijn/libfreenect
-- Cache values
BUILD_AS3_SERVER:BOOL=OFF
BUILD_CPACK_DEB:BOOL=OFF
BUILD_CPACK_RPM:BOOL=OFF
BUILD_CPACK_TGZ:BOOL=OFF
BUILD_CPP:BOOL=ON
BUILD_CV:BOOL=OFF
BUILD_C_SYNC:BOOL=ON
BUILD_EXAMPLES:BOOL=ON
BUILD_FAKENECT:BOOL=ON
BUILD_OPENNI2_DRIVER:BOOL=OFF
BUILD_PYTHON:BOOL=ON
BUILD_PYTHON2:BOOL=OFF
BUILD_PYTHON3:BOOL=OFF
BUILD_REDIST_PACKAGE:BOOL=ON
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CYTHON_EXECUTABLE:FILEPATH=CYTHON_EXECUTABLE-NOTFOUND
LIBUSB_1_INCLUDE_DIR:PATH=/usr/local/include/libusb-1.0
LIBUSB_1_LIBRARY:FILEPATH=/usr/local/lib/libusb-1.0.so
Python2_EXACTVERSION:STRING=
Python3_EXACTVERSION:STRING=
I hope someone knows how to fix this!

CMAKE Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS)

I am trying to run cmake in our school project, the CMakeList.txt looks as follows:
cmake_minimum_required(VERSION 3.0)
project(nagata)
FIND_PACKAGE( OpenMP )
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
set(CMAKE_C_COMPILER clang-omp CACHE STRING "C compiler" FORCE)
set(CMAKE_CXX_COMPILER clang-omp++ CACHE STRING "C++ compiler" FORCE)
FIND_PACKAGE( pybind11 REQUIRED )
FIND_PACKAGE(PythonInterp 3)
FIND_PACKAGE(PythonLibs 3)
IF( PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND PYBIND11_FOUND )
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_DIRS}
${PYBIND11_INCLUDE_DIRS}
)
ENDIF()
INCLUDE_DIRECTORIES("/usr/include/python3.7m")
add_library(pynagata SHARED pythonlib.cpp)
# The library must not have any prefix and should be located in
# a subfolder that includes the package name. The setup will be
# more complicated otherwise.
SET_TARGET_PROPERTIES( pynagata
PROPERTIES
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pynagata"
)
add_executable(nagata main.cpp)
install(TARGETS nagata RUNTIME DESTINATION bin)
When I run cmake .. in my build directory I get this output which looks almost OK:
-- The C compiler identification is Clang 11.0.0
-- The CXX compiler identification is Clang 11.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp=libomp (found version "5.0")
-- Found OpenMP_CXX: -fopenmp=libomp (found version "5.0")
-- Found OpenMP: TRUE (found version "5.0")
OPENMP FOUND
-- Found PythonInterp: /usr/local/bin/python3.8 (found version "3.8.6")
-- Found PythonLibs: /usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- Found PythonInterp: /usr/local/bin/python3.8 (found suitable version "3.8.6", minimum required is "3")
-- Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is at least version "3")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/.../build
Except the line -- Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is at least version "3") which seems odd to me as few lines before it literally finds it:-- Found PythonLibs: /usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib. I tried to set an env variable PYTHON_INCLUDE_DIRS="/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib" which is the exact same path as from the line above. Still, I get this error.
How can I make it find the PythonLibs? I really don't understand why the env variable doesn't work. I will also be happy to provide more info - I just don't know what.
I am using:
CLT: 12.0.0.0.1.1599194153
Xcode: 12.0.1
macOS Catalina ver. 10.15.7
Clang: 12.0 build 1200
PS: When I try to run make afterwards I get fatal error: 'string' file not found #include <string> which is maybe somehow connected to this issue...
It looks like I got the flags' names wrong. Calling the cmake with the following flags solved the problem for me:
cmake -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.8.dylib -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/include/python3.8 ..
It finds the PythonLibs successfully now.

Problem with building PyTorch from source on Linux

❓ Problem with building PyTorch from source
Hello everyone,
I have problem with building PyTorch from source. I followed the official build instructions. I use Anaconda Python 3.7.1 (version 2018.12, build py37_0). I installed all neccessary dependencies using conda and issued python setup.py install command to build it. It builds all files successfully but then it fails at the installation step saying:
build/temp.linux-x86_64-3.7/torch/csrc/stub.o: file not recognized: file format not recognized
I tried building with gcc/g++ versions 5,6,7 but it did not help. Can you help me resolve this problem?
Build output in terminal
This is the output of python setup.py install with the error I am getting:
[manjaro-pc pytorch]# python setup.py install
Building wheel torch-1.1.0a0+44809fd
-- Building version 1.1.0a0+44809fd
[0/1] Install the project...
-- Install configuration: "Release"
running install
running build
running build_py
copying torch/version.py -> build/lib.linux-x86_64-3.7/torch
copying caffe2/proto/caffe2_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/caffe2_legacy_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/predictor_consts_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/metanet_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/torch_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/prof_dag_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
copying caffe2/proto/hsm_pb2.py -> build/lib.linux-x86_64-3.7/caffe2/proto
running build_ext
-- Building with NumPy bindings
-- Not using cuDNN
-- Not using MIOpen
-- Not using CUDA
-- Not using MKLDNN
-- Not using NCCL
-- Building without distributed package
Copying extension caffe2.python.caffe2_pybind11_state
Copying caffe2.python.caffe2_pybind11_state from torch/lib/python3.7/site-packages/caffe2/python/caffe2_pybind11_state.cpython-37m-x86_64-linux-gnu.so to /home/manjaro/Downloads/pytorch/build/lib.linux-x86_64-3.7/caffe2/python/caffe2_pybind11_state.cpython-37m-x86_64-linux-gnu.so
building 'torch._C' extension
gcc -pthread -B /opt/anaconda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/anaconda/include/python3.7m -c torch/csrc/stub.cpp -o build/temp.linux-x86_64-3.7/torch/csrc/stub.o -std=c++11 -Wall -Wextra -Wno-strict-overflow -Wno-unused-parameter -Wno-missing-field-initializers -Wno-write-strings -Wno-unknown-pragmas -Wno-deprecated-declarations -fno-strict-aliasing -Wno-missing-braces
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -B /opt/anaconda/compiler_compat -L/opt/anaconda/lib -Wl,-rpath=/opt/anaconda/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/torch/csrc/stub.o -L/home/manjaro/Downloads/pytorch/torch/lib -lshm -ltorch_python -o build/lib.linux-x86_64-3.7/torch/_C.cpython-37m-x86_64-linux-gnu.so -Wl,-rpath,$ORIGIN/lib
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/torch/csrc/stub.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/torch/csrc/stub.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/torch/csrc/stub.o: unable to initialize decompress status for section .debug_info
/opt/anaconda/compiler_compat/ld: build/temp.linux-x86_64-3.7/torch/csrc/stub.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.7/torch/csrc/stub.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
From this output, I assume the error was caused by this line:
g++ -pthread -shared -B /opt/anaconda/compiler_compat -L/opt/anaconda/lib -Wl,-rpath=/opt/anaconda/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/torch/csrc/stub.o -L/home/manjaro/Downloads/pytorch/torch/lib -lshm -ltorch_python -o build/lib.linux-x86_64-3.7/torch/_C.cpython-37m-x86_64-linux-gnu.so -Wl,-rpath,$ORIGIN/lib
My environment
PyTorch version: 1.0
Is debug build: N/A
CUDA used to build PyTorch: 10
OS: Manjaro Linux
GCC version: (GCC) 6.4.1 20171002
CMake version: version 3.12.2
Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: GeForce GTX 650
Nvidia driver version: 415.27
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.7.4.1
/usr/lib/libcudnn_static_v7.a
Versions of relevant libraries:
[pip] Could not collect
[conda] blas 1.0 mkl
[conda] magma-cuda100 2.4.0 1 pytorch
[conda] mkl 2019.1 144
[conda] mkl-include 2019.1 144
[conda] mkl-service 1.1.2 py37he904b0f_5
[conda] mkl_fft 1.0.6 py37hd81dba3_0
[conda] mkl_random 1.0.2 py37hd81dba3_0
[conda] mkldnn 0.16.1 0 mingfeima
My CMake configuration printed before building PyTorch
Building wheel torch-1.1.0a0+44809fd
-- Building version 1.1.0a0+44809fd
['cmake',
'/home/manjaro/Downloads/pytorch',
'-GNinja',
'-DBLAS=MKL',
'-DBUILDING_WITH_TORCH_LIBS=ON',
'-DBUILD_BINARY=False',
'-DBUILD_CAFFE2_OPS=False',
'-DBUILD_PYTHON=True',
'-DBUILD_SHARED_LIBS=ON',
'-DBUILD_TEST=False',
'-DBUILD_TORCH=ON',
'-DCAFFE2_STATIC_LINK_CUDA=False',
'-DCMAKE_BUILD_TYPE=Release',
'-DCMAKE_CXX_FLAGS= ',
'-DCMAKE_C_FLAGS= ',
'-DCMAKE_EXE_LINKER_FLAGS=',
'-DCMAKE_INSTALL_PREFIX=/home/manjaro/Downloads/pytorch/torch',
'-DCMAKE_PREFIX_PATH=/opt/anaconda/bin/../',
'-DCMAKE_SHARED_LINKER_FLAGS=',
'-DINSTALL_TEST=False',
'-DNCCL_EXTERNAL=False',
'-DNUMPY_INCLUDE_DIR=/opt/anaconda/lib/python3.7/site-packages/numpy/core/include',
'-DONNX_NAMESPACE=onnx_torch',
'-DPYTHON_EXECUTABLE=/opt/anaconda/bin/python',
'-DPYTHON_INCLUDE_DIR=/opt/anaconda/include/python3.7m',
'-DPYTHON_LIBRARY=/opt/anaconda/lib/libpython3.7m.so.1.0',
'-DTHD_SO_VERSION=1',
'-DTORCH_BUILD_VERSION=1.1.0a0+44809fd',
'-DUSE_CUDA=False',
'-DUSE_DISTRIBUTED=False',
'-DUSE_FBGEMM=False',
'-DUSE_FFMPEG=False',
'-DUSE_LEVELDB=False',
'-DUSE_LMDB=False',
'-DUSE_MKLDNN=False',
'-DUSE_NNPACK=False',
'-DUSE_NUMPY=True',
'-DUSE_OPENCV=False',
'-DUSE_QNNPACK=False',
'-DUSE_ROCM=False',
'-DUSE_SYSTEM_EIGEN_INSTALL=OFF',
'-DUSE_SYSTEM_NCCL=False',
'-DUSE_TENSORRT=False']
{'BLAS': 'MKL',
'BUILD_CAFFE2_OPS': '0',
'BUILD_TEST': '0',
'CMAKE_PREFIX_PATH': '/opt/anaconda/bin/../',
'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus',
'HG': '/usr/bin/hg',
'HOME': '/root',
'LANG': 'en_US.UTF-8',
'LC_ADDRESS': 'sk_SK.UTF-8',
'LC_IDENTIFICATION': 'sk_SK.UTF-8',
'LC_MEASUREMENT': 'sk_SK.UTF-8',
'LC_MONETARY': 'sk_SK.UTF-8',
'LC_NAME': 'sk_SK.UTF-8',
'LC_NUMERIC': 'sk_SK.UTF-8',
'LC_PAPER': 'sk_SK.UTF-8',
'LC_TELEPHONE': 'sk_SK.UTF-8',
'LC_TIME': 'sk_SK.UTF-8',
'LD_LIBRARY_PATH': ':/usr/local/lib64:/usr/local/lib:/opt/cuda/lib64',
'LOGNAME': 'manjaro',
'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:',
'MAIL': '/var/spool/mail/manjaro',
'MAX_JOBS': '4',
'MOZ_PLUGIN_PATH': '/usr/lib/mozilla/plugins',
'NO_CAFFE2_OPS': '1',
'NO_CUDA': '1',
'NO_CUDNN': '1',
'NO_DISTRIBUTED': '1',
'NO_FBGEMM': '1',
'NO_MIOPEN': '1',
'NO_MKLDNN': '1',
'NO_NNPACK': '1',
'NO_QNNPACK': '1',
'NO_TEST': '1',
'OLDPWD': '/home/manjaro/Downloads',
'PATH': '/opt/anaconda/bin:/opt/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/local/bin:/opt/cuda/bin:/usr/local/bin:/opt/cuda/bin',
'PWD': '/home/manjaro/Downloads/pytorch',
'PYTHONPATH': ':/usr/local/lib/python3.7/site-packages/:/usr/local/lib/python3.7/site-packages/',
'QT_LINUX_ACCESSIBILITY_ALWAYS_ON': '1',
'SHELL': '/bin/bash',
'SHLVL': '2',
'SSH_CLIENT': '62.197.243.30 45360 44444',
'SSH_CONNECTION': '62.197.243.30 45360 192.168.1.147 44444',
'SSH_TTY': '/dev/pts/4',
'TERM': 'xterm-256color',
'TORCH_CUDA_ARCH_LIST': '3.0',
'USER': 'manjaro',
'USE_CUDA': '0',
'USE_CUDNN': '0',
'USE_DISTRIBUTED': '0',
'USE_FBGEMM': '0',
'USE_MIOPEN': '0',
'USE_MKLDNN': '0',
'USE_NNPACK': '0',
'USE_QNNPACK': '0',
'XDG_DATA_DIRS': '/home/manjaro/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share',
'XDG_RUNTIME_DIR': '/run/user/1000',
'XDG_SESSION_ID': 'c8',
'YAOURT_COLORS': 'nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35',
'_': '/opt/anaconda/bin/python'}
-- The CXX compiler identification is GNU 5.4.1
-- The C compiler identification is GNU 5.4.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test COMPILER_WORKS
-- Performing Test COMPILER_WORKS - Success
-- Performing Test SUPPORT_GLIBCXX_USE_C99
-- Performing Test SUPPORT_GLIBCXX_USE_C99 - Success
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED
-- Performing Test CAFFE2_EXCEPTION_PTR_SUPPORTED - Success
-- std::exception_ptr is supported.
-- Performing Test CAFFE2_IS_NUMA_AVAILABLE
-- Performing Test CAFFE2_IS_NUMA_AVAILABLE - Success
-- NUMA is available
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING
-- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING - Success
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS - Success
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS
-- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Success
-- Current compiler supports avx512f extension. Will build fbgemm.
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Success
-- Building using own protobuf under third_party per request.
-- Use custom protobuf build.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Caffe2 protobuf include directory: $<BUILD_INTERFACE:/home/manjaro/Downloads/pytorch/third_party/protobuf/src>$<INSTALL_INTERFACE:include>
-- Trying to find preferred BLAS backend of choice: MKL
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Checking for [mkl_intel_lp64 - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
-- Library mkl_intel_lp64: /opt/anaconda/lib/libmkl_intel_lp64.so
-- Library mkl_gnu_thread: /opt/anaconda/lib/libmkl_gnu_thread.so
-- Library mkl_core: /opt/anaconda/lib/libmkl_core.so
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Found OpenMP: TRUE (found version "4.0")
-- Library gomp: -fopenmp
-- Library pthread: /usr/lib/libpthread.so
-- Library m: /usr/lib/libm.so
-- Library dl: /usr/lib/libdl.so
-- Looking for cblas_sgemm
-- Looking for cblas_sgemm - found
-- MKL library found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Caffe2: Found gflags with new-style gflags target.
-- Caffe2: Cannot find glog automatically. Using legacy find.
-- Found glog: /usr/include
-- Caffe2: Found glog (include: /usr/include, library: /usr/lib/libglog.so)
-- Found Numa: /usr/include
-- Found Numa (include: /usr/include, library: /usr/lib/libnuma.so)
-- Downloading PSimd to /home/manjaro/Downloads/pytorch/build/confu-srcs/psimd (define PSIMD_SOURCE_DIR to avoid it)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/manjaro/Downloads/pytorch/build/confu-deps/psimd-download
[1/9] Creating directories for 'psimd'
[2/9] Performing download step (git clone) for 'psimd'
Cloning into 'psimd'...
Already on 'master'
Your branch is up to date with 'origin/master'.
[3/9] No patch step for 'psimd'
[4/9] Performing update step for 'psimd'
Current branch master is up to date.
[5/9] No configure step for 'psimd'
[6/9] No build step for 'psimd'
[7/9] No install step for 'psimd'
[8/9] No test step for 'psimd'
[9/9] Completed 'psimd'
-- Using third party subdirectory Eigen.
Python 3.7.1
-- Found PythonInterp: /opt/anaconda/bin/python (found suitable version "3.7.1", minimum required is "2.7")
-- Found PythonLibs: /opt/anaconda/lib/libpython3.7m.so.1.0 (found suitable version "3.7.1", minimum required is "2.7")
-- Found PythonInterp: /opt/anaconda/bin/python (found version "3.7.1")
-- Found PythonLibs: /opt/anaconda/lib/libpython3.7m.so.1.0
-- System pybind11 found
-- pybind11 include dirs: /usr/include;/opt/anaconda/include/python3.7m
CMake Warning at cmake/Dependencies.cmake:805 (message):
Not using CUDA, so disabling NCCL. Suppress this warning with
-DUSE_NCCL=OFF.
Call Stack (most recent call first):
CMakeLists.txt:219 (include)
CMake Warning at cmake/Dependencies.cmake:950 (message):
Metal is only used in ios builds.
Call Stack (most recent call first):
CMakeLists.txt:219 (include)
--
-- ******** Summary ********
-- CMake version : 3.12.2
-- CMake command : /opt/anaconda/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 5.4.1
-- CXX flags : -fvisibility-inlines-hidden -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions : TH_BLAS_MKL
-- CMAKE_PREFIX_PATH : /opt/anaconda/bin/../
-- CMAKE_INSTALL_PREFIX : /home/manjaro/Downloads/pytorch/torch
-- CMAKE_MODULE_PATH : /home/manjaro/Downloads/pytorch/cmake/Modules;/usr/share/cmake/pybind11
--
-- ONNX version : 1.4.1
-- ONNX NAMESPACE : onnx_torch
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
--
-- Protobuf compiler :
-- Protobuf includes :
-- Protobuf libraries :
-- BUILD_ONNX_PYTHON : OFF
-- Found gcc >=5 and CUDA <= 7.5, adding workaround C++ flags
-- Could not find CUDA with FP16 support, compiling without torch.CudaHalfTensor
-- Removing -DNDEBUG from compile flags
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Compiling with OpenMP support
-- MAGMA not found. Compiling without MAGMA support
-- Could not find hardware support for NEON on this machine.
-- No OMAP3 processor on this machine.
-- No OMAP4 processor on this machine.
-- Looking for cpuid.h
-- Looking for cpuid.h - found
-- Performing Test HAVE_GCC_GET_CPUID
-- Performing Test HAVE_GCC_GET_CPUID - Success
-- Performing Test NO_GCC_EBX_FPIC_BUG
-- Performing Test NO_GCC_EBX_FPIC_BUG - Success
-- Performing Test C_HAS_AVX_1
-- Performing Test C_HAS_AVX_1 - Failed
-- Performing Test C_HAS_AVX_2
-- Performing Test C_HAS_AVX_2 - Success
-- Performing Test C_HAS_AVX2_1
-- Performing Test C_HAS_AVX2_1 - Failed
-- Performing Test C_HAS_AVX2_2
-- Performing Test C_HAS_AVX2_2 - Success
-- Performing Test CXX_HAS_AVX_1
-- Performing Test CXX_HAS_AVX_1 - Failed
-- Performing Test CXX_HAS_AVX_2
-- Performing Test CXX_HAS_AVX_2 - Success
-- Performing Test CXX_HAS_AVX2_1
-- Performing Test CXX_HAS_AVX2_1 - Failed
-- Performing Test CXX_HAS_AVX2_2
-- Performing Test CXX_HAS_AVX2_2 - Success
-- AVX compiler support found
-- AVX2 compiler support found
-- Performing Test HAS_C11_ATOMICS
-- Performing Test HAS_C11_ATOMICS - Failed
-- Performing Test HAS_MSC_ATOMICS
-- Performing Test HAS_MSC_ATOMICS - Failed
-- Performing Test HAS_GCC_ATOMICS
-- Performing Test HAS_GCC_ATOMICS - Success
-- Atomics: using GCC intrinsics
-- Performing Test BLAS_F2C_DOUBLE_WORKS
-- Performing Test BLAS_F2C_DOUBLE_WORKS - Failed
-- Performing Test BLAS_F2C_FLOAT_WORKS
-- Performing Test BLAS_F2C_FLOAT_WORKS - Success
-- Performing Test BLAS_USE_CBLAS_DOT
-- Performing Test BLAS_USE_CBLAS_DOT - Success
-- Found a library with BLAS API (mkl).
-- Found a library with LAPACK API (mkl).
disabling CUDA because NOT USE_CUDA is set
-- CuDNN not found. Compiling without CuDNN support
disabling ROCM because NOT USE_ROCM is set
-- MIOpen not found. Compiling without MIOpen support
disabling MKLDNN because USE_MKLDNN is not set
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for shm_open
-- Looking for shm_open - found
-- Looking for shm_unlink
-- Looking for shm_unlink - found
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - found
-- Performing Test C_HAS_THREAD
-- Performing Test C_HAS_THREAD - Success
-- GCC 5.4.1: Adding gcc and gcc_s libs to link line
-- NUMA paths:
-- /usr/include
-- /usr/lib/libnuma.so
disabling CUDA because USE_CUDA is set false
-- Check size of long double
-- Check size of long double - done
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE - Success
-- Performing Test COMPILER_SUPPORTS_FLOAT128
-- Performing Test COMPILER_SUPPORTS_FLOAT128 - Success
-- Performing Test COMPILER_SUPPORTS_SSE2
-- Performing Test COMPILER_SUPPORTS_SSE2 - Success
-- Performing Test COMPILER_SUPPORTS_SSE4
-- Performing Test COMPILER_SUPPORTS_SSE4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX
-- Performing Test COMPILER_SUPPORTS_AVX - Success
-- Performing Test COMPILER_SUPPORTS_FMA4
-- Performing Test COMPILER_SUPPORTS_FMA4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_SVE
-- Performing Test COMPILER_SUPPORTS_SVE - Failed
-- Performing Test COMPILER_SUPPORTS_AVX512F
-- Performing Test COMPILER_SUPPORTS_AVX512F - Failed
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Performing Test COMPILER_SUPPORTS_OPENMP
-- Performing Test COMPILER_SUPPORTS_OPENMP - Success
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES - Success
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH - Success
-- Configuring build for SLEEF-v3.2
Target system: Linux-4.14.94-1-MANJARO
Target processor: x86_64
Host system: Linux-4.14.94-1-MANJARO
Host processor: x86_64
Detected C compiler: GNU # /usr/bin/cc
-- Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : OFF
-- MPFR : /opt/anaconda/lib/libmpfr.so
-- MPFR header file in /opt/anaconda/include
-- GMP : /opt/anaconda/lib/libgmp.so
-- RUNNING_ON_TRAVIS : 0
-- COMPILER_SUPPORTS_OPENMP : 1
-- /usr/bin/c++ /home/manjaro/Downloads/pytorch/torch/abi-check.cpp -o /home/manjaro/Downloads/pytorch/build/abi-check
-- Determined _GLIBCXX_USE_CXX11_ABI=1
-- NCCL operators skipped due to no CUDA support
-- Excluding ideep operators as we are not using ideep
-- Excluding image processing operators due to no opencv
-- Excluding video processing operators due to no opencv
-- MPI operators skipped due to no MPI support
-- Include Observer library
-- Using lib/python3.7/site-packages as python relative installation path
CMake Warning at CMakeLists.txt:416 (message):
Generated cmake files are only fully tested if one builds with system glog,
gflags, and protobuf. Other settings may generate files that are not well
tested.
--
-- ******** Summary ********
-- General:
-- CMake version : 3.12.2
-- CMake command : /opt/anaconda/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 5.4.1
-- BLAS : MKL
-- CXX flags : -fvisibility-inlines-hidden -D_FORCE_INLINES -D_MWAITXINTRIN_H_INCLUDED -D__STRICT_ANSI__ -fopenmp -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-unused-but-set-variable -Wno-maybe-uninitialized
-- Build type : Release
-- Compile definitions : TH_BLAS_MKL;ONNX_NAMESPACE=onnx_torch;USE_GCC_ATOMICS=1;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;HAVE_MALLOC_USABLE_SIZE=1
-- CMAKE_PREFIX_PATH : /opt/anaconda/bin/../
-- CMAKE_INSTALL_PREFIX : /home/manjaro/Downloads/pytorch/torch
--
-- TORCH_VERSION : 1.1.0
-- CAFFE2_VERSION : 1.1.0
-- BUILD_ATEN_MOBILE : OFF
-- BUILD_ATEN_ONLY : OFF
-- BUILD_BINARY : False
-- BUILD_CUSTOM_PROTOBUF : ON
-- Link local protobuf : ON
-- BUILD_DOCS : OFF
-- BUILD_PYTHON : True
-- Python version : 3.7.1
-- Python executable : /opt/anaconda/bin/python
-- Pythonlibs version : 3.7.1
-- Python library : /opt/anaconda/lib/libpython3.7m.so.1.0
-- Python includes : /opt/anaconda/include/python3.7m
-- Python site-packages: lib/python3.7/site-packages
-- BUILD_CAFFE2_OPS : False
-- BUILD_SHARED_LIBS : ON
-- BUILD_TEST : False
-- USE_ASAN : OFF
-- USE_CUDA : False
-- USE_ROCM : False
-- USE_EIGEN_FOR_BLAS :
-- USE_FBGEMM : OFF
-- USE_FFMPEG : False
-- USE_GFLAGS : ON
-- USE_GLOG : ON
-- USE_LEVELDB : False
-- USE_LITE_PROTO : OFF
-- USE_LMDB : False
-- USE_METAL : OFF
-- USE_MKL : ON
-- USE_MKLDNN : OFF
-- USE_NCCL : OFF
-- USE_NNPACK : False
-- USE_NUMPY : ON
-- USE_OBSERVERS : ON
-- USE_OPENCL : OFF
-- USE_OPENCV : False
-- USE_OPENMP : OFF
-- USE_PROF : OFF
-- USE_QNNPACK : False
-- USE_REDIS : OFF
-- USE_ROCKSDB : OFF
-- USE_ZMQ : OFF
-- USE_DISTRIBUTED : False
-- Public Dependencies : Threads::Threads;caffe2::mkl;glog::glog
-- Private Dependencies : cpuinfo;/usr/lib/libnuma.so;fp16;onnxifi_loader;rt;gcc_s;gcc;dl
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
NCCL_EXTERNAL
THD_SO_VERSION
Problem solved.
I found what was wrong and I fixed it. The whole problem lies in the fact that Anaconda distribution comes with its own ld linker that is located in /opt/anaconda/compiler_compat/ and it overshadows system ld residing at /usr/bin.
To fix my error I ran python setup.py clean and then I temporarily renamed Anaconda's ld linker to ld-old to make it invisible during PyTorch installation.

How can I force CMake to look for a library in a specific directory?

Trying to install a Spenvis package and here's the error I'm getting when running the script:
-- Boost version: 1.41.0
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: Desktop/build
make[2]: *** No rule to make target `/usr/local/lib64/libpython2.6.so.1.0', needed by `source/libSpenvis.so'. Stop.
make[1]: *** [source/CMakeFiles/Spenvis.dir/all] Error 2
make: *** [all] Error 2
It's looking for libpython2.6.so.1.0 in /usr/local/lib64, but the library itself is in /usr/lib64.
I'm not a super user, so I can't change/copy the library into the directory nor can I make a link to it. For reference, here's the python script I'm running followed by the CMakeLists.txt file:
"""
Main launch script
"""
import os
import sys
import shutil
from subprocess import call
"""
Define path where to find python packages
"""
loc_dir=os.getcwd()
os.chdir("python_utilities")
#Spenvis csv
#############
os.chdir("spenvis_csv")
if not os.path.exists("build"):
os.mkdir("build")
os.chdir("build")
call("cmake ../", shell=True)
call("make")
os.chdir(loc_dir)
os.chdir("python_utilities")
if not os.path.exists("lib"):
os.mkdir("lib")
for file_name in os.listdir("spenvis_csv/build/source"):
if file_name.find("libSpenvis.") !=-1:
shutil.move("spenvis_csv/build/source/%s" %(file_name),"lib/Spenvis.so")
os.chdir("..")
And the CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
# Make sure the compiler can find include files
include_directories (${PYSPENVIS_SOURCE_DIR})
# get boost
set(Boost_USE_STATIC_LIBS OFF)
#set(Boost_USE_MULTIEADED ON)
find_package(Boost COMPONENTS
python
REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# get python
include(FindPythonLibs)
set(PythonLibs_USE_STATIC_LIBS OFF)
find_package(PythonInterp)
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_DIRS})
link_directories(${PYTHON_LIBRARIES})
add_library(Spenvis SHARED pySpenvisCSV.cc SpenvisCSV.cc SpenvisCSVCollection.cc)
TARGET_LINK_LIBRARIES(Spenvis ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
Taking advice, I ran the following command in the directory with CMakeLists.txt file:
cmake -DPYTHON_LIBRARY='/usr/lib64/libpython2.6.so.1.0'
This churned out:
Boost found.
Found Boost components:
python
-- Found PythonLibs: /usr/lib64/libpython2.6.so.1.0 (found version "2.7.1")
-- Found PythonLibs: /usr/lib64/libpython2.6.so.1.0 (found suitable version "2.7.1", minimum required is "2.6")
-- Configuring done
-- Generating done
-- Build files have been written to: blahblahblah
Going back to run the install.py program now returns:
-- Boost version: 1.41.0
-- Found the following Boost libraries:
-- python
-- Found PythonLibs: /usr/local/lib64/libpython2.6.so.1.0 (found version "2.6.6")
-- Found PythonLibs: /usr/local/lib64/libpython2.6.so.1.0 (found suitable version "2.6.6", minimum required is "2.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/smh/Linux/Desktop/gras original/gras-03-03/python/python_utilities/spenvis_csv/build
make[2]: *** No rule to make target `/usr/local/lib64/libpython2.6.so.1.0', needed by `source/libSpenvis.so'. Stop.
So, the same error is returned, only now it is claiming it's finding python libraries. Strangely, though, the python libraries it is finding don't exist, which is to say, there is no libpython2.6.so.1.0 in /usr/local/lib64 but instead it is located in /usr/lib64.
In the CMakeCache.txt, the lines concerning the desired library are as followed:
//No help, variable specified on the command line.
PYTHON_LIBRARIES:UNINITIALIZED=/usr/lib64/libpython2.6.so.1.0
//Path to a library.
PYTHON_LIBRARY:FILEPATH=/usr/lib64/libpython2.6.so
//Dependencies for the target
Spenvis_LIB_DEPENDS:STATIC=optimized;boost_python-mt-shared;debug;boost_python-mt-shared-debug;general;/usr/lib64/libpython2.6.so;
//Details about finding PythonLibs
FIND_PACKAGE_MESSAGE_DETAILS_PythonLibs:INTERNAL=[/usr/lib64/libpython2.6.so][/usr/local/include/python2.7][v2.7.1(2.6)]
The /usr need to be insert in front of CMAKE_PREFIX_PATH, so it will be found first.
list(INSERT 0 CMAKE_PREFIX_PATH /usr)

Categories