Commit 4e50875
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: 344dd256cf42e96a1a2b943d9f9cb7a059a352381 parent 1621910 commit 4e50875
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
0 commit comments