From 16208ae0da7c0f6228fa02450a9b7ccf6bf0e471 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 14 Oct 2026 23:47:44 +0200 Subject: [PATCH] Prevent executable-stack requirement on Linux (PyPartMC seem to fail to load with newer Glibc versions) Added linker option to prevent executable stack on Linux. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b15456c7..db9338f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -561,6 +561,12 @@ endif() nanobind_add_module(_PyPartMC ${PYPARTMC_MODULE_TYPE} STABLE_ABI ${PyPartMC_sources}) add_dependencies(_PyPartMC partmclib) + +# Prevent an executable-stack requirement on Linux +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_link_options(_PyPartMC PRIVATE "LINKER:-z,noexecstack") +endif() + set(PYPARTMC_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/include;" "${CMAKE_SOURCE_DIR}/gitmodules/json/include;"