I'm building the lib s2-geometry-library with Python wrapper on Ubuntu (14.04). It goes well until I import the lib in Python:
import s2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "s2.py", line 28, in <module>
    _s2 = swig_import_helper()
  File "s2.py", line 24, in swig_import_helper
    _mod = imp.load_module('_s2', fp, pathname, description)
ImportError: libs2.so: cannot open shared object file: No such file or directory
I've checked plenty of similar questions but no answers work. In fact, I do have libs2.so:
ldd /usr/local/lib/libs2.so
    linux-vdso.so.1 =>  (0x00007ffdfbbfe000)
    libs2cellid.so => not found
    libs2util.so => not found
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e7cf6f000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7e7cc6b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e7c965000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7e7c74e000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e7c385000)
    /lib64/ld-linux-x86-64.so.2 (0x000055b5cdcec000)
The strange thing here is that it said libs2cellid.so and libs2util.so not found. In fact, I have the three libs in the same folder:
ls -l /usr/local/lib/
total 1808
-rw-r--r-- 1 root root    98096 Aug  1 12:05 libs2cellid.so
-rw-r--r-- 1 root root  1446781 Aug  1 12:05 libs2.so
-rw-r--r-- 1 root root   284388 Aug  1 12:05 libs2util.so
drwxr-xr-x 2 root root     4096 Aug  1 11:59 pkgconfig
drwxrwsr-x 4 root staff    4096 Nov 23  2016 python2.7
drwxrwsr-x 3 root staff    4096 Jul 29  2016 python3.4
drwxr-xr-x 3 root root     4096 Aug  1 11:56 site_ruby
Here is my lib path:
$LD_LIBRARY_PATH
/usr/local/lib/libs2util.so:/usr/local/lib/libs2.so:/usr/local/lib/libs2cellid.so:/usr/lib/python2.7/dist-packages/s2/libs2.so:
So what's wrong here? Thanks.
Since you are using Ubuntu, the prefix path needs to be /usr rather than /usr/local. You can change that in s2-geometry-library/geometry/CMakeCache.txt. Set the value as follows: CMAKE_INSTALL_PREFIX:PATH=/usr. You still need to rerun all the installation steps for this to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With