Skip to content

Commit

Permalink
Build the xnnpack backend and libraries with -fPIC
Browse files Browse the repository at this point in the history
This fixes a linking problem on some x86_64 systems when building
extension/pybindings.
  • Loading branch information
dbort committed Apr 2, 2024
1 parent daa217f commit 67f9392
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backends/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
endif()

# Build with -fPIC for targets in this directory and in all subdirectories that
# it includes. This is required to link libXNNPACK.a into shared libraries on
# some x86_64 systems.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(_common_include_directories ${EXECUTORCH_ROOT}/..)
set(_common_compile_options -Wno-deprecated-declarations)

Expand Down

0 comments on commit 67f9392

Please sign in to comment.