Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pybind] Add back extension suffix for portable lib shared object in pip wheel #6363

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions build/executorch-wheel-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,41 @@
#
cmake_minimum_required(VERSION 3.19)

# Find prebuilt _portable_lib.so. This file should be installed under
# Find prebuilt _portable_lib.<EXT_SUFFIX>.so. This file should be installed under
# <site-packages>/executorch/share/cmake
find_library(_portable_lib_LIBRARY _portable_lib.so PATHS "${CMAKE_CURRENT_LIST_DIR}/../../extension/pybindings/")

# Find python
if(DEFINED ENV{CONDA_DEFAULT_ENV} AND NOT $ENV{CONDA_DEFAULT_ENV} STREQUAL "base")
set(PYTHON_EXECUTABLE
python
)
else()
set(PYTHON_EXECUTABLE
python3
)
endif()

# Get the Python version and platform information
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
OUTPUT_VARIABLE EXT_SUFFIX
RESULT_VARIABLE SYSCONFIG_RESULT
ERROR_VARIABLE SYSCONFIG_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(RESULT_VARIABLE EQUAL 0)
message(STATUS "Sysconfig extension suffix: ${EXT_SUFFIX}")
else()
message(FATAL_ERROR "Failed to retrieve sysconfig config var EXT_SUFFIX: ${SYSCONFIG_ERROR}")
endif()

find_library(
_portable_lib_LIBRARY
NAMES _portable_lib${EXT_SUFFIX}
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../extension/pybindings/"
)

set(EXECUTORCH_LIBRARIES)
set(EXECUTORCH_FOUND OFF)
if(_portable_lib_LIBRARY)
Expand Down
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,6 @@ def get_ext_modules() -> List[Extension]:
return ext_modules


# Override extension suffix to be ".so", skipping package info such as
# "cpython-311-darwin"
os.environ["SETUPTOOLS_EXT_SUFFIX"] = ".so"

setup(
version=Version.string(),
# TODO(dbort): Could use py_modules to restrict the set of modules we
Expand Down
Loading