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!
Related
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.
I tried to compile an old codebase. My environments are (as required by the codebase):
Python 2.7
CMake 2.8.10.1
The provided CMakeLists.txt looks like this:
cmake_minimum_required(VERSION 2.6)
project(KOL)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
#IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})
#ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
#check if Eigen exists
find_path(EIGEN_PATH NAMES Eigen PATHS ${EIGEN_DIR} REQUIRED)
if (NOT EIGEN_DIR)
message(FATAL_ERROR "Eigen is not found, please specify by: -DEIGEN_DIR=<eigen_path>")
endif (NOT EIGEN_DIR)
FILE(GLOB data_files src/data/*.h)
FILE(GLOB loss_files src/loss/*.h)
FILE(GLOB opti_files src/kernel/*.h)
FILE(GLOB comm_files src/common/*.h)
set (data_files ${data_files}
src/data/basic_io.cpp
)
include_directories(
${EIGEN_PATH}
)
#set (data_files ${datafiles}
# src/data/basic_io.cpp
# src/data/zlib_io.cpp
# src/data/gzip_io.cpp
# )
source_group("data" FILES ${data_files})
source_group("loss" FILES ${loss_files})
source_group("kernel" FILES ${opti_files})
source_group("common" FILES ${comm_files})
set (SRC_LIST
${data_files} ${loss_files} ${opti_files} ${comm_files}
)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -O2 -s")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
add_executable(KOL src/Params.cpp src/Params.h
src/main.cpp ${SRC_LIST})
IF(UNIX)
target_link_libraries(KOL pthread)
ENDIF(UNIX)
add_executable(Cacher src/data/Cacher.cpp ${data_files})
IF(UNIX)
target_link_libraries(Cacher pthread)
ENDIF(UNIX)
install(TARGETS KOL Cacher
DESTINATION .)
And my command is: cmake -EIGEN_DIR=../Eigen -CMAKE_CXX_FLAGS='-std=c++0x -O3' ..
The error is:
loading initial cache file MAKE_CXX_FLAGS=-std=c++0x -O3
CMake Error: Error processing file:MAKE_CXX_FLAGS=-std=c++0x -O3
-- The C compiler identification is Clang 10.0.1
-- The CXX compiler identification is Clang 10.0.1
-- 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
-- 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
CMake Error at CMakeLists.txt:13 (message):
Eigen is not found, please specify by: -DEIGEN_DIR=<eigen_path>
My project structure is like this:
--Master
|--build
|--Eigen
|--CMakeLists.txt
I ran the command inside of the build directory. It kept saying that EIGEN_PATH is not defined and Eigen is not found.
I tried -EIGEN_DIR=`pwd`/../Eigen. I also tried to use -DEIGEN_DIR but still got the same error. Please help.
You should use -DEIGEN_DIR from command line specifying the folder in Eigen library containing the FindEigen.cmake file (search for it with `find ../Eigen -name "*.CMake").
Be careful, the package name should match exactly (case sensitive):
the name of the find module or config script (FindPackageName.cmake or PackageNameConfig.cmake)
in find_package call
the name of the PackageName_DIR
To specify a cache variable via the CMake command line, use the -D flag before the variable names EIGEN_DIR and CMAKE_CXX_FLAGS. Here is the documentation for the cmake command line options and flags. Because this creates cached entries, try clearing your CMake cache before running the command, to get rid of any stale paths retained within.
Also, be sure to use double quotes " ... " when enclosing the flags for the CMAKE_CXX_FLAGS variable:
cmake -DEIGEN_DIR=Eigen -DCMAKE_CXX_FLAGS="-std=c++0x -O3" ..
I'm trying to create a Python binding for a Qt C++ class with Shiboken2. As far as I can tell, there's no official example on how to do so (the only example on the Qt Blog deals with a generic C++ class https://www.qt.io/blog/2018/05/31/write-python-bindings). So I'm following this blog post instead: https://blog.basyskom.com/2019/using-shiboken2-to-create-python-bindings-for-a-qt-library/
The example works on Linux, but Shiboken2 fails to build on a Mac with the error qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
This is a log of what happens:
(pyside2build) MacBook-Pro-i7:build andreac$ cmake ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- QtCore include folders: /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework;/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers;/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang
-- Using python interpreter: /Users/andreac/pyside2build/bin/python
-- Found Python3: /Users/andreac/pyside2build/bin/python3.7 (found version "3.7.5") found components: Interpreter Development
-- Using PySide2 installation: /Users/andreac/pyside2build/lib/python3.7/site-packages/PySide2
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/andreac/pyside2build/src/binding-example/build
(pyside2build) MacBook-Pro-i7:build andreac$ make
Scanning dependencies of target libexamplebinding_autogen
[ 9%] Automatic MOC for target libexamplebinding
[ 9%] Built target libexamplebinding_autogen
Scanning dependencies of target libexamplebinding
[ 18%] Building CXX object CMakeFiles/libexamplebinding.dir/libexamplebinding_autogen/mocs_compilation.cpp.o
[ 27%] Building CXX object CMakeFiles/libexamplebinding.dir/qobjectwithenum.cpp.o
[ 36%] Linking CXX shared library libexamplebinding.dylib
[ 36%] Built target libexamplebinding
Scanning dependencies of target Shiboken2QtExample_autogen
[ 45%] Running generator for /Users/andreac/pyside2build/src/binding-example/bindings.xml.
(bindings) clang_parseTranslationUnit2(0x0, cmd[17]=-nostdinc -isystem/opt/X11/include -isystem/usr/local/include -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -iframework/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -fPIC -Wno-expansion-to-defined -Wno-constant-logical-operand -std=c++14 -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -I/Users/andreac/Qt/5.12.6/clang_64/mkspecs/macx-clang -I/Users/andreac/pyside2build/src/binding-example /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp)
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal error: 'QtCore/qobjectdefs.h' file not found
(bindings) Errors in /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
/private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:10: note: in file included from /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:
/Users/andreac/pyside2build/src/binding-example/bindings.h:3:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/bindings.h:3:
/Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:10: note: in file included from /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:
(bindings) Clang: 1 diagnostic messages:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
/private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:10: note: in file included from /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:
/Users/andreac/pyside2build/src/binding-example/bindings.h:3:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/bindings.h:3:
/Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:10: note: in file included from /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:
Keeping temporary file: /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp
shiboken: Error running ApiExtractor.
Command line: --generator-set=shiboken --enable-parent-ctor-heuristic --enable-return-value-heuristic --use-isnull-as-nb_nonzero --avoid-protected-hack -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -I/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang -T/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -T/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -T/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang -I/Users/andreac/pyside2build/src/binding-example -T/Users/andreac/pyside2build/src/binding-example --output-directory=/Users/andreac/pyside2build/src/binding-example/build /Users/andreac/pyside2build/src/binding-example/bindings.h /Users/andreac/pyside2build/src/binding-example/bindings.xml
make[2]: *** [Shiboken2QtExample/qobjectwithenum_wrapper.cpp] Error 1
make[1]: *** [CMakeFiles/Shiboken2QtExample_autogen.dir/all] Error 2
make: *** [all] Error 2
Any ideas on how to fix the problem?
It looks like I need to use the -F option for Shiboken2 to specify the location of a Framework. Adding the following to the invocation command solves the issue:
-F/Users/andreac/Qt/5.12.6/clang_64/lib/
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)
I am trying to install this python package on my cygwin(last available version) setup, using gcc and no windows/microsoft components at all. The package has many dependencies so it can take a while for you to try to install it. I guess the error is generic and you don't require to replicate the issue to provide insights on how to fix it.
I have found this error for several(all?) .la libraries on the package:
Making all in centrality
make[4]: Entering directory '/cygdrive/d/gdrive/Thesis/tech/urv tech/graph-tool-2.2.31/src/graph/centrality'
CXX graph_betweenness.lo
CXX graph_centrality_bind.lo
CXX graph_closeness.lo
CXX graph_eigentrust.lo
CXX graph_eigenvector.lo
CXX graph_hits.lo
CXX graph_katz.lo
CXX graph_pagerank.lo
CXX graph_trust_transitivity.lo
CXXLD libgraph_tool_centrality.la
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?
.libs/graph_betweenness.o:graph_betweenness.cc:(.text+0x182b): undefined reference to `graph_tool::GraphInterface::GetNumberOfVertices()'
.libs/graph_betweenness.o:graph_betweenness.cc:(.text+0x19bd): undefined reference to `graph_tool::GraphInterface::GetNumberOfVertices()'
.libs/graph_betweenness.o:graph_betweenness.cc:(.text+0x1a68): undefined reference to `graph_tool::ValueException::ValueException(std::string const&)'
.libs/graph_betweenness.o:graph_betweenness.cc:(.text+0x1a87): undefined reference to `graph_tool::ValueException::~ValueException()'
.libs/graph_betweenness.o:graph_betweenness.cc:(.text+0x1ad1): undefined reference to `graph_tool::ValueException::ValueException(std::string const&)'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld: .libs/graph_betweenness.o: bad reloc address 0x6 in section `.text$_ZN5boost16exception_detail10clone_baseD1Ev[__ZN5boost16exception_detail10clone_baseD1Ev]'
collect2: error: ld returned 1 exit status
Makefile:474: recipe for target 'libgraph_tool_centrality.la' failed
As I see .lo files are built, probably not correctly, and when it comes to generate the .la file is when I get the 'bad reloc address' error. In other words, my assumption is that because the .lo files are not correctly generated the .la built fails.
Doing some research I have found this bug reported and fixed back in 2009:
https://www.mail-archive.com/bug-binutils#gnu.org/msg07150.html
Based on it, I understand that an approach to try to fix the problem would be to replace the -export-dynamic flag by -export-all-symbols in the configure file the python library uses to install itself. There are two files that I modify: configure and [configure.ac][2]
Configure has this kind of export-dynamic mentions, related to other settings:
export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
Configure.ac has this one only:
[MOD_LDFLAGS="-module -avoid-version -export-dynamic -no-undefined -Wl,-E -Wl,--as-needed"]
that I think is the key one because it refers to LD flags.
But if I do this, the project seems to break an I receive messages saying the files used in the build have the wrong version of libtool.
make[4]: Entering directory '/cygdrive/d/gdrive/Thesis/tech/urv tech/graph-tool-2.2.31/src/graph/centrality'
CXX graph_betweenness.lo
libtool: Version mismatch error. This is libtool 2.4.2, but the
libtool: definition of this LT_INIT comes from libtool 2.4.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2
libtool: and run autoconf again.
Makefile:507: recipe for target 'graph_betweenness.lo' failed
There are mentions also in aclocal.m4 that if I try to change cause additional problems related to build files version.
In addition, in ltmain.sh it is verified for some libraries if they have been generated with the flag export-dynamic.
So, several points here:
what is the difference between the .la and the .lo libraries that the module tries to generate?
I think the problem is related to differences in static and dynamic link but really don't know how to fix it. Are there other settings involved?
In general, any hints on what to try?