Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find python on OS X #269

Open
paro- opened this issue Aug 22, 2022 · 4 comments
Open

Can't find python on OS X #269

paro- opened this issue Aug 22, 2022 · 4 comments

Comments

@paro-
Copy link

paro- commented Aug 22, 2022

Hello,

My project depends on s2geometry, but now that abseil was made external I can't compile anymore.

Indeed in my CMakeLists.txt I added add_subdirectory(third-party/abseil) before add_subdirectory(third-party/s2geometry) but s2 complained that it couldn't find abslConfig.cmake so I used set(ABSL_ENABLE_INSTALL ON) to have it, but now I'm stuck on the following error:
CMake Error at build/third-party/abseil-cpp/abslConfig.cmake:32 (include):
[cmake] include could not find load file:
[cmake]
[cmake] [...]/build/third-party/abseil-cpp/abslTargets.cmake
[cmake] Call Stack (most recent call first):
[cmake] third-party/s2geometry/CMakeLists.txt:71 (find_package)

The targets don't seem to be installed when add_subdirectory(third-party/abseil) finishes, when s2 launches find_package(absl REQUIRED).
Which brings me to my question: is there a way to compile abseil before s2 in the same CMake, or am I missing something here?

Best regards,
Paul

@jmr
Copy link
Member

jmr commented Sep 9, 2022

I haven't tried. What do the abseil docs say about how to do that?

@aliwo
Copy link

aliwo commented Sep 25, 2022

Same here... 😢

Environment

  • MacOS Catalina 10.15.7
  • cmake version 3.24.2

Output

cmake -DWITH_GFLAGS=ON -WITH_GTEST=ON \
-DGTEST_ROOT=/Users/.../sw_gtest/googletest-release-1.8.0 \
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following features have been enabled:

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

-- The following features have been disabled:

 * PYTHON, provides python interface to S2

CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GLOG) does
  not match the name of the calling package (Glog).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  third_party/cmake/FindGlog.cmake:42 (find_package_handle_standard_args)
  CMakeLists.txt:51 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

output
-- Found GLOG: /usr/local/include
CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GFLAGS)
  does not match the name of the calling package (GFlags).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  third_party/cmake/FindGFlags.cmake:41 (find_package_handle_standard_args)
  CMakeLists.txt:64 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found GFLAGS: /usr/local/include
CMake Error at CMakeLists.txt:71 (find_package):
  By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "absl", but
  CMake did not find one.

  Could not find a package configuration file provided by "absl" with any of
  the following names:

    abslConfig.cmake
    absl-config.cmake

  Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
  "absl_DIR" to a directory containing one of the above files.  If "absl"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/Users/.../s2geometry/CMakeFiles/CMakeOutput.log".

and plus, running cmake command inside build directory (which https://s2geometry.io/about/install guides tells us to) makes an error

(/Users/.../s2geometry/build) $ cmake -DWITH_GFLAGS=ON -WITH_GTEST=ON \
-DGTEST_ROOT=/Users/.../googletest-release-1.8.0 \
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include
cmake -DWITH_GFLAGS=ON -WITH_GTEST=ON \
-DGTEST_ROOT=/Users/.../googletest-release-1.8.0 \
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The source directory "/Users/.../build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

@jmr
Copy link
Member

jmr commented Sep 28, 2022

Same here... cry

Environment

  • MacOS Catalina 10.15.7
  • cmake version 3.24.2

Output

cmake -DWITH_GFLAGS=ON -WITH_GTEST=ON \
-DGTEST_ROOT=/Users/.../sw_gtest/googletest-release-1.8.0 \
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include

This is a separate issue, but I can see why it could appear similar.

You need to specify -DCMAKE_PREFIX_PATH=/path/to/absl/install like here: https://github.com/google/s2geometry#building

You can send a PR to update the Mac instructions after you get it working. You may also need a googletest newer than 1.8.0. See if you get errors from that.

@aliwo
Copy link

aliwo commented Oct 15, 2022

Thank you! I was able to make some progress.
hmm... I found something in the output.

first it finds python3
(Found Python3: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10) but next it finds python2. (-- Found PythonInterp: /usr/bin/python (found version "2.7.16")) is there any way to specify python3 interpreter?

I tried python3 and import pywraps2 and it fails (ModuleNotFoundError)

Below is the full output.

cmake -DWITH_GFLAGS=ON \
-WITH_GTEST=ON \
-DGTEST_ROOT=/Users/.../sw_gtest/googletest-release-1.8.0 \
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include \
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/abseil/20220623.1 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWITH_PYTHON=ON
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following features have been enabled:

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

CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GLOG) does
  not match the name of the calling package (Glog).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  third_party/cmake/FindGlog.cmake:42 (find_package_handle_standard_args)
  CMakeLists.txt:51 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found GLOG: /usr/local/include
CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GFLAGS)
  does not match the name of the calling package (GFlags).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  third_party/cmake/FindGFlags.cmake:41 (find_package_handle_standard_args)
  CMakeLists.txt:64 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found GFLAGS: /usr/local/include
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found OpenSSL: /usr/local/lib/libcrypto.dylib (found version "1.1.1n")
-- Found SWIG: /usr/local/bin/swig (found suitable version "4.0.2", minimum required is "4.0")
-- Found Python3: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 (found version "3.10.4") found components: Interpreter Development Development.Module Development.Embed
GTEST_ROOT: /Users/.../sw_gtest/googletest-release-1.8.0
CMake Deprecation Warning at /Users/.../sw_gtest/googletest-release-1.8.0/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.


CMake Warning (dev) at /Users/.../sw_gtest/googletest-release-1.8.0/CMakeLists.txt:3 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/.../sw_gtest/googletest-release-1.8.0/googlemock/CMakeLists.txt:40 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at /Users/.../sw_gtest/googletest-release-1.8.0/googlemock/CMakeLists.txt:41 (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.


CMake Warning (dev) at /Users/.../sw_gtest/googletest-release-1.8.0/googletest/CMakeLists.txt:47 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at /Users/.../sw_gtest/googletest-release-1.8.0/googletest/CMakeLists.txt:48 (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.


-- Found PythonInterp: /usr/bin/python (found version "2.7.16")
CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/UseSWIG.cmake:775 (message):
  Policy CMP0078 is not set: UseSWIG generates standard target names.  Run
  "cmake --help-policy CMP0078" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

Call Stack (most recent call first):
  src/python/CMakeLists.txt:8 (swig_add_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/UseSWIG.cmake:617 (message):
  Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
  flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
  src/python/CMakeLists.txt:8 (swig_add_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/.../PycharmProjects/s2geometry

@jmr jmr changed the title Can't compile since abseil moved out Can't find python on OS X Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants