From fa96b13e4333d11983ff41c47694f9a977d8f203 Mon Sep 17 00:00:00 2001 From: Michael Hines Date: Thu, 14 May 2026 19:22:34 -0400 Subject: [PATCH 1/4] cmake: force PIE executables + disable dynamic X11 on Linux wheels This fixes the long-standing "invalid ELF header: RTLD_GLOBAL for idraw" error that occurred with PyPI Linux wheels. - Force CMAKE_POSITION_INDEPENDENT_CODE=ON for all executables. InterViews/idraw does dlopen(self, RTLD_GLOBAL|...), which modern glibc rejects for non-PIE (ET_EXEC) binaries. - Disable IV_ENABLE_X11_DYNAMIC on Linux wheels only (SKBUILD && UNIX && NOT APPLE). The dynamic X11 loading path (ivx11_dynam.cpp) was the actual trigger of the (null) error. macOS wheels and local builds are unaffected. No functional change for normal source builds or macOS. --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 281b79b399..1f804a4a89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,22 @@ project( LANGUAGES C CXX HOMEPAGE_URL "https://nrn.readthedocs.io/") +# ============================================================================= +# Fixes for Linux wheels +# ============================================================================= + +# Force PIE for all executables (idraw, nrniv, etc.) +# This was the root cause of the original "invalid ELF header: RTLD_GLOBAL" error. +cmake_policy(SET CMP0083 NEW) +set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Force PIE for NEURON + InterViews" FORCE) + +# Disable fragile dynamic X11 loading *only* for Linux wheels. +# This was triggering the (null) RTLD_GLOBAL error. +# macOS wheels and normal/local Linux builds keep the original default (ON). +if(SKBUILD AND UNIX AND NOT APPLE) + set(IV_ENABLE_X11_DYNAMIC OFF CACHE BOOL "Disable on Linux wheels" FORCE) +endif() + # ============================================================================= # CMake common project settings # ============================================================================= From c6e37fab586cdef237fcfbb6790a07e70f774bfd Mon Sep 17 00:00:00 2001 From: Michael Hines Date: Fri, 15 May 2026 14:25:20 -0400 Subject: [PATCH 2/4] TEMP: test wheel build from hines/nrn-PIE-idraw-fix --- .github/workflows/wheels-nightly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/wheels-nightly.yml b/.github/workflows/wheels-nightly.yml index a3e7d79605..0ca1b73f1f 100644 --- a/.github/workflows/wheels-nightly.yml +++ b/.github/workflows/wheels-nightly.yml @@ -32,6 +32,11 @@ jobs: - name: Save commit ref id: save-commit run: | + + # === TEMPORARY: build hines/nrn-PIE-idraw-fix === + echo "commit=hines/nrn-PIE-idraw-fix" >> "$GITHUB_OUTPUT" + # =============================================== + commit="${{ github.event.inputs.commit }}" if [[ -n "${commit}" ]]; then echo "commit=${commit}" >> "$GITHUB_OUTPUT" From d15a3a1e200505baee69d3e6ce6f717200f2e985 Mon Sep 17 00:00:00 2001 From: Michael Hines Date: Fri, 15 May 2026 15:21:48 -0400 Subject: [PATCH 3/4] Revert "TEMP: test wheel build from hines/nrn-PIE-idraw-fix" This reverts commit c6e37fab586cdef237fcfbb6790a07e70f774bfd. --- .github/workflows/wheels-nightly.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/wheels-nightly.yml b/.github/workflows/wheels-nightly.yml index 0ca1b73f1f..a3e7d79605 100644 --- a/.github/workflows/wheels-nightly.yml +++ b/.github/workflows/wheels-nightly.yml @@ -32,11 +32,6 @@ jobs: - name: Save commit ref id: save-commit run: | - - # === TEMPORARY: build hines/nrn-PIE-idraw-fix === - echo "commit=hines/nrn-PIE-idraw-fix" >> "$GITHUB_OUTPUT" - # =============================================== - commit="${{ github.event.inputs.commit }}" if [[ -n "${commit}" ]]; then echo "commit=${commit}" >> "$GITHUB_OUTPUT" From f0bdff08be512feddcd2a9cf47c6ab15769feb11 Mon Sep 17 00:00:00 2001 From: Michael Hines Date: Fri, 15 May 2026 15:34:24 -0400 Subject: [PATCH 4/4] format --- CMakeLists.txt | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f804a4a89..ca17e61e6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,16 +25,21 @@ project( # Fixes for Linux wheels # ============================================================================= -# Force PIE for all executables (idraw, nrniv, etc.) -# This was the root cause of the original "invalid ELF header: RTLD_GLOBAL" error. +# Force PIE for all executables (idraw, nrniv, etc.) This was the root cause of the original +# "invalid ELF header: RTLD_GLOBAL" error. cmake_policy(SET CMP0083 NEW) -set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Force PIE for NEURON + InterViews" FORCE) - -# Disable fragile dynamic X11 loading *only* for Linux wheels. -# This was triggering the (null) RTLD_GLOBAL error. -# macOS wheels and normal/local Linux builds keep the original default (ON). -if(SKBUILD AND UNIX AND NOT APPLE) - set(IV_ENABLE_X11_DYNAMIC OFF CACHE BOOL "Disable on Linux wheels" FORCE) +set(CMAKE_POSITION_INDEPENDENT_CODE + ON + CACHE BOOL "Force PIE for NEURON + InterViews" FORCE) + +# Disable fragile dynamic X11 loading *only* for Linux wheels. This was triggering the (null) +# RTLD_GLOBAL error. macOS wheels and normal/local Linux builds keep the original default (ON). +if(SKBUILD + AND UNIX + AND NOT APPLE) + set(IV_ENABLE_X11_DYNAMIC + OFF + CACHE BOOL "Disable on Linux wheels" FORCE) endif() # =============================================================================