SpatioTemporal / STARE

SpatioTemporal Adaptive Resolution Encoding, a unifying index for geo-located data.
Other
10 stars 7 forks source link

how to build static library #103

Open NiklasPhabian opened 2 years ago

NiklasPhabian commented 2 years ago

If I am seeing correctly, we switched over to shared libraries. But it seems that pystare still requires a static library / libSTARE.a How do I build it?

NiklasPhabian commented 2 years ago

from https://github.com/SpatioTemporal/staged-recipes/blob/STARE/recipes/stare/build.sh

#!/bin/bash

cmake -S $SRC_DIR \
      -DBUILD_SHARED_LIBS=YES \
      -DCMAKE_INSTALL_PREFIX=${PREFIX} \
      -DSTARE_INSTALL_LIBDIR=lib

make
make test
make install
NiklasPhabian commented 2 years ago

well; I guess DBUILD_SHARED_LIBS has to be set to NO. How would I build both the shared and the static libraries?

michaelleerilee commented 2 years ago

Go through the process twice.

mbauer288 commented 2 years ago

OS : Ubuntu 22.04 LTS (Jammy) Kernel : 5.15.0-41-generic Python : 3.10.5

Rather than use conda I chose a manual install.

To do this I first needed to add a few things.

$ sudo apt install cmake
$ sudo apt install g++
$ sudo apt-get install graphviz
$ sudo apt-get install doxygen

However I ran into a permission problem at the install stage as the default /usr/local requires sudo privileges.

  $ make install
      ...
      -- Install configuration: ""
      CMake Error at include/cmake_install.cmake:46 (file):
        file cannot create directory: /usr/local/include/STARE.  Maybe need administrative privileges.

Redirecting the install to a local directory fixed the problem.

    $ export CMAKE_INSTALL_PREFIX="/home/mbauer/.local"
    $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/mbauer/.local .. 
    $ make install
        ..
        [100%] Linking CXX executable tests
        [100%] Built target tests

This made Shared library files

/home/mbauer/.local/include/STARE/
    STARE.h
    ...

/home/mbauer/.local/OFF/
    libSTARE.so  
    libSTARE.so.1  
    libSTARE.so.1.2.5

However, as noted above this only made the shared library files. Borrowing from the above solution I was able to generate the static lib as well.

    $ cmake -DBUILD_SHARED_LIBS=No -DCMAKE_INSTALL_PREFIX:PATH=/home/mbauer/.local ..

    $ make install
        ...
        -- Installing: /home/mbauer/.local/OFF/libSTARE.a
        ...

Mike