cmake_example icon indicating copy to clipboard operation
cmake_example copied to clipboard

This example does not compile when following instructions in the README

Open kovalp opened this issue 4 months ago • 1 comments

`(pybind11) kovalp@kovalp-ThinkPad-T460:~/programs/github/pybind11$ pip install ./cmake_example Processing ./cmake_example Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: cmake_example Building wheel for cmake_example (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for cmake_example (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [107 lines of output] running bdist_wheel running build running build_ext CMake Error at CMakeLists.txt:4 (add_subdirectory): The source directory

      /home/kovalp/programs/github/pybind11/cmake_example/pybind11
  
    does not contain a CMakeLists.txt file.
  
  
  CMake Error at CMakeLists.txt:5 (pybind11_add_module):
    Unknown CMake command "pybind11_add_module".
  
  
  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "/home/kovalp/.pyenv/versions/3.13.7/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
      main()
      ~~~~^^
    File "/home/kovalp/.pyenv/versions/3.13.7/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
      json_out["return_val"] = hook(**hook_input["kwargs"])
                               ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/kovalp/.pyenv/versions/3.13.7/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel
      return _build_backend().build_wheel(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
          wheel_directory, config_settings, metadata_directory
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 435, in build_wheel
      return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 423, in _build
      return self._build_with_temp_dir(
             ~~~~~~~~~~~~~~~~~~~~~~~~~^
          cmd,
          ^^^^
      ...<3 lines>...
          self._arbitrary_args(config_settings),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 404, in _build_with_temp_dir
      self.run_setup()
      ~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
      exec(code, locals())
      ~~~~^^^^^^^^^^^^^^^^
    File "<string>", line 128, in <module>
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/__init__.py", line 115, in setup
      return distutils.core.setup(**attrs)
             ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 186, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
      dist.run_commands()
      ~~~~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands
      self.run_command(cmd)
      ~~~~~~~~~~~~~~~~^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/dist.py", line 1102, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/command/bdist_wheel.py", line 370, in run
      self.run_command("build")
      ~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command
      self.distribution.run_command(command)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/dist.py", line 1102, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
      ~~~~~~~~~~~~~~~~^^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command
      self.distribution.run_command(command)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/dist.py", line 1102, in run_command
      super().run_command(command)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
      cmd_obj.run()
      ~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/command/build_ext.py", line 96, in run
      _build_ext.run(self)
      ~~~~~~~~~~~~~~^^^^^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/command/build_ext.py", line 368, in run
      self.build_extensions()
      ~~~~~~~~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/command/build_ext.py", line 484, in build_extensions
      self._build_extensions_serial()
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    File "/tmp/pip-build-env-p5xpj2u7/overlay/lib/python3.13/site-packages/setuptools/_distutils/command/build_ext.py", line 510, in _build_extensions_serial
      self.build_extension(ext)
      ~~~~~~~~~~~~~~~~~~~~^^^^^
    File "<string>", line 118, in build_extension
    File "/home/kovalp/.pyenv/versions/3.13.7/lib/python3.13/subprocess.py", line 577, in run
      raise CalledProcessError(retcode, process.args,
                               output=stdout, stderr=stderr)
  subprocess.CalledProcessError: Command '['cmake', '/home/kovalp/programs/github/pybind11/cmake_example', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/kovalp/programs/github/pybind11/cmake_example/build/lib.linux-x86_64-cpython-313/', '-DPYTHON_EXECUTABLE=/home/kovalp/.pyenv/versions/3.13.7/bin/python3.13', '-DCMAKE_BUILD_TYPE=Release', '-DEXAMPLE_VERSION_INFO=0.0.1', '-GNinja', '-DCMAKE_MAKE_PROGRAM:FILEPATH=ninja']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cmake_example Failed to build cmake_example error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects ╰─> cmake_example `

kovalp avatar Aug 30 '25 14:08 kovalp