• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Python "find_library" isn't - how to fix?



Thanks: 8
Messages: 87

As part of a larger clusterfudge of trying to get nominatim working, I'm trying to get the python bindings for osmium built.

That project lives here: https://github.com/osmcode/pyosmium

If I try to manually build that, I end up with an error indicating that the setup/build script can't find the required boost libraries:

[spork@nominatim ~/osmium-2.13.0]$ python setup.py
Traceback (most recent call last):
  File "setup.py", line 74, in <module>
    raise Exception("Cannot find boost_python library")
Exception: Cannot find boost_python library
The library is there:

[nominatim@nominatim ~]$ pkg info boost-python-libs-1.65.1
Name           : boost-python-libs
Version        : 1.65.1
Installed on   : Fri Feb 23 23:07:50 2018 EST
Origin         : devel/boost-python-libs
Files are there:

[nominatim@nominatim ~]$ ls -la /usr/local/lib/libboost_python.*
-rw-r--r--  1 root  wheel  650658 Jan  1 21:25 /usr/local/lib/libboost_python.a
lrwxr-xr-x  1 root  wheel      25 Jan  1 21:23 /usr/local/lib/libboost_python.so -> libboost_python.so.1.65.1
-rwxr-xr-x  1 root  wheel  311664 Jan  1 21:25 /usr/local/lib/libboost_python.so.1.65.1
[nominatim@nominatim ~]$
And if I comment out all the nonsense where the python "find_library" routine attempts to locate those and I simply let it use "/usr/local/" as a library directory, it builds.

I'm not a python guy, I'm just building this because a larger project depends on it. Should this chunk of code find the above listed libraries?

includes.append(os.path.join(boost_prefix, 'include'))

if 'BOOST_VERSION' in os.environ:

    includes.append(os.path.join(boost_prefix, 'include',

                                 "boost-%s" %os.environ['BOOST_VERSION']))

if 'BOOST_VERSION' in os.environ:

    libdirs.append(os.path.join(boost_prefix, 'lib'))

elif osplatform in ["linux", "linux2"]:



    libdirs.append(os.path.join(boost_prefix, 'lib'))

# try to find the boost library matching the python version

suffixes = [ # Debian naming convention for version installed in parallel

             "-py%d%d" % (pyversion.major, pyversion.minor),

             # Gentoo naming convention for version installed in parallel

             "-%d.%d" % (pyversion.major, pyversion.minor),

             # standard suffix for Python3

             "%d" % (pyversion.major),

             # standard naming


             # former naming schema?



for suf in suffixes:

    lib = find_library("boost_python%s" % suf)

    print ("boost_python%s" % suf)

    if lib is not None:

        libs.append("boost_python%s" % suf)



    # Visual C++ supports auto-linking, no library needed

    if osplatform != "win32":
    raise Exception("Cannot find boost_python library")
That last line is where it dies...