Skip to content

Commit 1c038fd

Browse files
fix(swig): remove explicit libpython linkage from _utils.so (#65)
## Problem The SWIG extension `_utils.so` was linked with `$(PYLIBRARY)` (e.g. `-lpython3.11`), creating a hard shared library dependency on a specific Python version. Debian's `${shlibs:Depends}` then auto-generated a dependency like `libpython3.11 (>= 3.11.0)`, making the `.deb` uninstallable on systems with a different Python version than the build environment. ## Fix Removed `$(PYLIBRARY)` from the SWIG link command in the Makefile. On Linux, Python C extensions do not need to link against libpython — the interpreter provides all necessary symbols at runtime. ## Testing - Built with `make all` — all 5 C++ tests pass - Verified with `ldd` that `_utils.so` no longer has a libpython dependency Signed-off-by: Lawrence Lee <lawlee@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 18a29c1 commit 1c038fd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ compile_py_proto:
3838

3939
swig: compile_cpp_proto
4040
swig -c++ -python -py3 -outdir $(PYPKG_DIR) -o $(BUILD_DIR)/utils_wrap.cpp $(MISC_DIR)/utils.i
41-
g++ $(CXX_FLAGS) -shared -I$(PYINCLUDE) -fPIC -I$(MISC_DIR) -o $(PYPKG_DIR)/_utils.so $(MISC_DIR)/utils.cpp $(BUILD_DIR)/utils_wrap.cpp $(wildcard $(BUILD_DIR)/*.pb.cc) $(PYLIBRARY) -lprotobuf
41+
g++ $(CXX_FLAGS) -shared -I$(PYINCLUDE) -fPIC -I$(MISC_DIR) -o $(PYPKG_DIR)/_utils.so $(MISC_DIR)/utils.cpp $(BUILD_DIR)/utils_wrap.cpp $(wildcard $(BUILD_DIR)/*.pb.cc) -lprotobuf
4242

4343
clean:
4444
$(RM) $(BUILD_DIR)

0 commit comments

Comments
 (0)