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

Fails to build with pybind11 2.6.0 #147

Closed
sebastic opened this issue Oct 30, 2020 · 3 comments
Closed

Fails to build with pybind11 2.6.0 #147

sebastic opened this issue Oct 30, 2020 · 3 comments

Comments

@sebastic
Copy link
Contributor

The pybind11 package in Debian was recently updated to 2.6.0 which causes the pyosmium build to fail:

CMake Warning (dev) at /usr/lib/cmake/pybind11/pybind11Common.cmake:167 (if):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  /usr/lib/cmake/pybind11/pybind11Config.cmake:249 (include)
  CMakeLists.txt:19 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/lib/cmake/pybind11/pybind11Common.cmake:167 (if):
  if given arguments:

    "11" "IN_LIST" "supported_standards"

  Unknown arguments specified
Call Stack (most recent call first):
  /usr/lib/cmake/pybind11/pybind11Config.cmake:249 (include)
  CMakeLists.txt:19 (find_package)


-- Configuring incomplete, errors occurred!
See also "/build/pyosmium-3.0.1/build/temp.linux-x86_64-3.9/CMakeFiles/CMakeOutput.log".
See also "/build/pyosmium-3.0.1/build/temp.linux-x86_64-3.9/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "/build/pyosmium-3.0.1/setup.py", line 121, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.9/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/build/pyosmium-3.0.1/setup.py", line 67, in run
    self.build_extension(ext)
  File "/build/pyosmium-3.0.1/setup.py", line 110, in build_extension
    subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
  File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/build/pyosmium-3.0.1', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/build/pyosmium-3.0.1/.pybuild/cpython3_3.9_pyosmium/build', '-DPYTHON_EXECUTABLE=/usr/bin/python3.9', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
@sebastic
Copy link
Contributor Author

The following patch fixes the issue:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,9 @@ include_directories(SYSTEM ${OSMIUM_INCL
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
 
 if(MSVC)
-    set(PYBIND11_CPP_STANDARD /std:c++14)
+    set(CMAKE_CXX_STANDARD 14)
 else()
-    set(PYBIND11_CPP_STANDARD -std=c++11)
+    set(CMAKE_CXX_STANDARD 11)
 endif()
 
 if(PYBIND11_PREFIX)

Per: https://github.com/pybind/pybind11/blob/v2.6.0/docs/upgrade.rst#cmake-support

PYBIND11_CPP_STANDARD=<platform-flag> is deprecated, please use CMAKE_CXX_STANDARD=<number> instead, or any other valid CMake CXX or CUDA standard selection method, like target_compile_features.

@lonvia
Copy link
Member

lonvia commented Oct 31, 2020

Thanks for tracking this down. I'll do a proper release with support for pybind11 2.6 in the next couple of days.

@lonvia lonvia closed this as completed in dc21692 Oct 31, 2020
@lonvia
Copy link
Member

lonvia commented Oct 31, 2020

I went for setting both PYBIND11_CPP_STANDARD and CMAKE_CXX_STANDARD to be backwards compatible with older pybind11 versions.

You can now also set CMAKE_CXX_STANDARD=14 via an environment variable for setup.py. Only 11 and 14 are known to work at the moment.

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

No branches or pull requests

2 participants