3

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)]
13
  • Did yo try including /usr/lib64/libpython2.6.so.1.0 into TARGET_LINK_LIBRARIES? Jun 9, 2015 at 21:00
  • It may help to add the "VERBOSE=1" after your make command: "make VERBOSE=1". You'll see every option it thinks it's using, i.e., what cmake passed along.
    – donjuedo
    Jun 9, 2015 at 21:11
  • Damian, how would I add that specific library correctly? Jun 9, 2015 at 21:21
  • have you tried adding /usr to cmake search path by: list(APPEND CMAKE_PREFIX_PATH /usr)?
    – squid
    Jun 10, 2015 at 5:25
  • Squid: unfortunately, that didn't work. Jun 10, 2015 at 21:34

1 Answer 1

0

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)
1
  • Sorry, I got moved to a different task for awhile, but I'm now back to this one. I added this towards the beginning of my CmakeLists.txt file, but it still produced this error. Should it go elsewhere? Sep 18, 2015 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.