pybind11_bazel icon indicating copy to clipboard operation
pybind11_bazel copied to clipboard

doesn't seem to work

Open cjolivier01 opened this issue 9 months ago • 1 comments

Well, like most Bazel things I try, this doesn't seem to work at all:

DEBUG: Rule 'pybind11_bazel' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "9df284330336958c837fb70dc34c0a6254dac52a5c983b3373a8c2bbb79ac35e"
DEBUG: Repository pybind11_bazel instantiated at:
  /home/colivier/src/hm-cupano/WORKSPACE:43:13: in <toplevel>
Repository rule http_archive defined at:
  /home/colivier/.cache/bazel/_bazel_colivier/c6bb00f9e8f790cdd03a2ec44db149ec/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
ERROR: /home/colivier/.cache/bazel/_bazel_colivier/c6bb00f9e8f790cdd03a2ec44db149ec/external/pybind11/BUILD.bazel: no such target '@pybind11//:msvc_compiler': target 'msvc_compiler' not declared in package '' defined by /home/colivier/.cache/bazel/_bazel_colivier/c6bb00f9e8f790cdd03a2ec44db149ec/external/pybind11/BUILD.bazel (Tip: use `query "@pybind11//:*"` to see all the targets in that package)
ERROR: /home/colivier/src/hm-cupano/hmcupano/BUILD.bazel:3:17: errors encountered resolving select() keys for //hmcupano:hello_ext.so
ERROR: Analysis of target '//hmcupano:hello_ext' failed; build aborted: 
INFO: Elapsed time: 0.685s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (39 packages loaded, 140 targets configured)
  • The terminal process "/usr/bin/bash '-c', 'bazelisk build --config=debug //...'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

cjolivier01 avatar Feb 09 '25 12:02 cjolivier01

How did you test ? pybind11_bazel is basically a "wrapper" on top of pybind11 for bazel so you don't build it directly...

BTW I've tested some ci using the "examples/basic" sub project to test windows build using github windows runner -> seems to work as expected.... see: https://github.com/Mizux/pybind11_bazel/actions

For using it in your project take a look at the pybind11_abseil or pybind11_protobuf project if using bzlmod aka MODULE.bazel (default with bazel 8.0):

  • https://github.com/pybind/pybind11_abseil/blob/b6c3c8fd5377ae891875f6443bd455b66582574d/MODULE.bazel#L14 if using legacy WORKSPACE:
  • https://github.com/pybind/pybind11_abseil/blob/b6c3c8fd5377ae891875f6443bd455b66582574d/WORKSPACE#L110-L127

Mizux avatar Feb 12 '25 12:02 Mizux