Skip to content

Commit 4e50875

Browse files
Satish Kumarmeta-codesync[bot]
authored andcommitted
Fix Python bindings build order and installation for OSS
Summary: These changes fix the folly Python bindings build in OSS environments, specifically to support building thrift-python (the modern Python bindings for Apache Thrift). **Background**: As part of making thrift-python available in OSS (T235311085), we discovered that the folly Python build had several issues that prevented successful builds outside of Meta's internal Buck environment. **Key fixes**: 1. **Build order**: Separated Cython API header generation from linking. Previously, `setup.py build_ext` would try to link before `folly_python_cpp` was built, causing undefined symbol errors. Now: - `--api-only` mode generates just the API headers (iobuf_api.h) - C++ library (folly_python_cpp) builds against these headers - Python extensions link against the built C++ library 2. **Library path**: Added CMAKE_CURRENT_BINARY_DIR to library search path so the linker can find folly_python_cpp.so in the build directory. 3. **Installation**: Switched from deprecated `setup.py install` to `pip install` on the built wheel. The old method created eggs (zip archives) that don't work in custom install directories without .pth file support. 4. **Package structure**: Creates `__init__.py` for the folly package and installs .pxd files for downstream Cython code (thrift uses `from folly.iobuf cimport IOBuf`). 5. **Dependencies**: Added libaio to Linux dependencies (required by folly). Reviewed By: vitaut Differential Revision: D90277822 fbshipit-source-id: 344dd256cf42e96a1a2b943d9f9cb7a059a35238
1 parent 1621910 commit 4e50875

File tree

1 file changed

+1
-0
lines changed
  • build/fbcode_builder/manifests

1 file changed

+1
-0
lines changed

build/fbcode_builder/manifests/folly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ openssl
4545
zlib
4646

4747
[dependencies.os=linux]
48+
libaio
4849
libiberty
4950
libunwind
5051

0 commit comments

Comments
 (0)