The CPython extension module build configuration should provide extra_compile_args=["-fvisibility=hidden"] to be equivalent to the Bazel build and to prevent upb symbols leaking into the public interface of the Python extension module. This can create segfaults for applications linking against libprotobuf.so which have duplicate upb symbols and duplicate extension registries
|
ext_modules=[ |
|
Extension( |
|
'google._upb._message', |
|
srcs, |
|
include_dirs=[current_dir, os.path.join(current_dir, 'utf8_range')], |
|
language='c', |
|
extra_link_args=extra_link_args, |
|
) |
The Bazel configuration (note copts):
|
cc_binary( |
|
name = name + "_binary", |
|
srcs = srcs, |
|
copts = copts + ["-fvisibility=hidden"], |
|
linkopts = selects.with_or({ |
|
( |
|
"//python/dist:osx_x86_64", |
|
"//python/dist:osx_aarch64", |
|
): ["-Wl,-undefined,dynamic_lookup"], |
|
"//python/dist:windows_x86_32": ["-static-libgcc"], |
|
"//conditions:default": [], |
|
}), |
The CPython extension module build configuration should provide
extra_compile_args=["-fvisibility=hidden"]to be equivalent to the Bazel build and to prevent upb symbols leaking into the public interface of the Python extension module. This can create segfaults for applications linking against libprotobuf.so which have duplicate upb symbols and duplicate extension registriesprotobuf/python/dist/setup.py
Lines 82 to 89 in 58f02be
The Bazel configuration (note
copts):protobuf/python/py_extension.bzl
Lines 16 to 27 in 58f02be