protomaps / OSMExpress

Fast database file format for OpenStreetMap
BSD 2-Clause "Simplified" License
229 stars 19 forks source link

Fix macOS programming guide #41

Closed brawer closed 1 year ago

brawer commented 1 year ago

The previous macOS build intructions don’t seem to work anymore.

bdon commented 1 year ago

where was OpenSSL installed from on your Mac? I don't think specifying a directory here is general enough for different package managers. Unfortunately I think S2 is still stuck with the OpenSSL dependency. We should either

brawer commented 1 year ago

where was OpenSSL installed from on your Mac?

I’ve installed OpenSSL with Homebew 3.6.15 on macOS 13.0.1, by running brew install cmake bzip2 zlib openssl expat as described in the OSMExpress programming guide.

bdon commented 1 year ago

Does it work without specifying that optional at all? Maybe S2's cmake config can find it: https://github.com/google/s2geometry/blob/master/CMakeLists.txt#L77

brawer commented 1 year ago

Does it work without specifying that optional at all?

No, see log below. Note that cmake ships a rule to find OpenSSL, which takes OPENSSL_ROOT_DIR as its input and sets OPENSSL_INCLUDE_DIR as a result. Given that, I wonder if the OSMExpress build instructions should recommend setting OPENSSL_ROOT_DIR instead of OPENSSL_INCLUDE_DIR? Hence this pull request. (Of course I don’t have strong opinions about such things, I’m just trying to save the next person the time that it took me to figure out how to build OSMExpress. Which is an awesome project, by the way — thanks for doing it!)

$ cmake .
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include initializer_list
-- Looking for C++ include initializer_list - found
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libz.tbd (found version "1.2.11") 
-- The following OPTIONAL packages have been found:

 * ZLIB

-- The following features have been disabled:

 * GFLAGS, allows changing command line flags.
 * GLOG, provides logging configurability.
 * SHARED_LIBS, builds shared libraries instead of static.

CMake Error at /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args)
  vendor/s2geometry/CMakeLists.txt:62 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/sascha/src/osmexpress-build/OSMExpress/CMakeFiles/CMakeOutput.log".

Same error with the build instructions in the current programming guide:

$ cmake -DOPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl\@3/3.0.7/include/* .
-- The following OPTIONAL packages have been found:

 * ZLIB

-- The following features have been disabled:

 * GFLAGS, allows changing command line flags.
 * GLOG, provides logging configurability.
 * SHARED_LIBS, builds shared libraries instead of static.

CMake Error at /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.25.1/share/cmake/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args)
  vendor/s2geometry/CMakeLists.txt:62 (find_package)

-- Configuring incomplete, errors occurred!

But the following works fine (also the subsequent compile):

$ cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl\@3 .
-- The following OPTIONAL packages have been found:

 * ZLIB

-- The following features have been disabled:

 * GFLAGS, allows changing command line flags.
 * GLOG, provides logging configurability.
 * SHARED_LIBS, builds shared libraries instead of static.

-- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) 
GTEST_ROOT: 
CMake Deprecation Warning at vendor/CRoaring/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- BENCHMARK_DATA_DIR: /Users/sascha/src/osmexpress-build/OSMExpress/vendor/CRoaring/benchmarks/realdata/
-- TEST_DATA_DIR: /Users/sascha/src/osmexpress-build/OSMExpress/vendor/CRoaring/tests/testdata/
-- Building a static library.
-- ROARING_LIB_TYPE: STATIC
-- Library output directory (does not apply to Visual Studio): /Users/sascha/src/osmexpress-build/OSMExpress
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- CMAKE_BUILD_TYPE: Release
-- ROARING_DISABLE_X64: OFF
-- ROARING_DISABLE_AVX: OFF
-- ROARING_DISABLE_NEON: OFF
-- ROARING_DISABLE_NATIVE: OFF
-- ROARING_ARCH: native
-- ROARING_BUILD_STATIC: ON
-- ROARING_LINK_STATIC: ON
-- ROARING_BUILD_LTO: OFF
-- ROARING_SANITIZE: OFF
-- CMAKE_C_COMPILER: /usr/bin/clang
-- CMAKE_C_FLAGS:  -std=c11 -fPIC -march=native  -Wall -Wextra -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self  
-- CMAKE_C_FLAGS_DEBUG: -ggdb
-- CMAKE_C_FLAGS_RELEASE: -O3
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sascha/src/osmexpress-build/OSMExpress
bdon commented 1 year ago

OK, thanks for investigating this! (although I am sad OpenSSL is still a thorn in our sides, S2 should really find a lighter dependency)