I have a Rust crate built with Maturin, using pyo3 for Python bindings. I use the zig linker so as to provide simple cross platform code. So, the rough flow is:
Rust crate
Built using zig linker (using cargo-zigbuild)
Has Python bindings using pyo3.
Maturin bundles into Python wheel.
When this crate is imported in a Python library with lots of dependencies, upon startup loading fails, claiming cannot allocate memory in static TLS block. I can work around by setting LD_PRELOAD=my_library.so though this is inconvinent as the library references Python symbols, so any Python program must unset LD_PRELOAD or child processes will fail to launch. We are on glibc2.31 since using Ubuntu 20.04.
Zig Version
0.10.1.post1 (python wheel)
Steps to Reproduce and Observed Behavior
I have a Rust crate built with Maturin, using pyo3 for Python bindings. I use the zig linker so as to provide simple cross platform code. So, the rough flow is:
When this crate is imported in a Python library with lots of dependencies, upon startup loading fails, claiming
cannot allocate memory in static TLS block
. I can work around by settingLD_PRELOAD=my_library.so
though this is inconvinent as the library references Python symbols, so any Python program must unset LD_PRELOAD or child processes will fail to launch. We are on glibc2.31 since using Ubuntu 20.04.Wondering if this is caused by https://github.com/ziglang/zig/issues/16152 but given size of intervening stack, no smoking gun.
Expected Behavior
Linking succeeds.