Skip to content

Instantly share code, notes, and snippets.

@sibosend
Forked from bugorz/s2-geometry-on-macos.md
Last active April 15, 2020 12:24
Show Gist options
  • Save sibosend/58b539e52a1ebc75e28a184131977a55 to your computer and use it in GitHub Desktop.
Save sibosend/58b539e52a1ebc75e28a184131977a55 to your computer and use it in GitHub Desktop.

Prerequisite

# For Mac

brew install openssl
# For ubuntu
sudo apt-get install build-essential
sudo apt-get install libgflags-dev libgoogle-glog-dev libgtest-dev libssl-dev
sudo apt-get install python-dev

git clone https://github.com/google/googletest
# Note, there are 'googlemock' and 'googletest' under the root 'googletest' dir, please use 'googletest/googletest' as the GTEST_ROOT.
cd googletest/googletest
GTEST_ROOT=`pwd`

Build s2geometry

cmake -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
-DPYTHON_LIBRARY=/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so \
-DOPENSSL_INCLUDE_DIR=/usr/include/openssl -DGTEST_ROOT=${GTEST_ROOT} ../
make
make test
sudo make install
make install

Run s2geometry tests in CLion

  • Please go to Preferences... -> Build, Execution, Deployment -> CMake
  • Select the Debug Profile, then add -DDOPENSSL_INCLUDE_DIR=${path_to_openssl_include} and -DGTEST_ROOT=${path_to_gtest_root} to CMake options.
  • Reload project in CLion then you should be able to run all unit tests.
@sibosend
Copy link
Author

virtualenv -p python2.7 --system-site-packages venv

@sibosend
Copy link
Author

sibosend commented Nov 19, 2019

for error: ImportError: libs2.so: cannot open shared object file: No such file or directory

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.

or

ln -s /usr/local/lib/libs2.so /usr/lib/libs2.so

@sibosend
Copy link
Author

sibosend commented Dec 9, 2019

delete your_venv_dir/lib/pythonXXX/no-global-site-packages.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment