/bazel_pybind_sample

Simple example of using pybind11 via Bazel.

Primary LanguageStarlarkApache License 2.0Apache-2.0

Bazel / pybind11 sample

Simple, working pybind11-via-bazel example on Linux/x64 (tested on Ubuntu).

Background info provided by:

If you're observing segfaults, it may be that the DSO is being built for Python2 while the bazel test interpreter is Python 3.

You can observe what Python headers were used for building by observing the file in a path similar to:

bazel-out/k8-fastbuild/bin/external/local_config_python/python_include/patchlevel.h

And you can help point at the right Python binary by providing it to the python_configure.bzl script in pybind11_bazel through an environment variable:

PYTHON_BIN_PATH=/usr/bin/python3 bazel test -c dbg :example_test --test_output=all