Skip to content
Open
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
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this implied by cmake_minimum_required(VERSION 3.19 FATAL_ERROR)? I think it's only 3.13 and earlier that use the old behavior?

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way we could add a test for this, so we aren't bitten by it again?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so. I'll look into adding a readelf -h $NRNHOME/bin/idraw | grep Type that ought to return

$ readelf -h $NRNHOME/bin/idraw | grep Type
  Type:                              DYN (Position-Independent Executable file)

instead of

$ readelf -h $NRNHOME/bin/idraw | grep Type
  Type:                              EXEC (Executable file)

Ironically, I need to investigate this PR more thoroughly as, on the surface, 100% of the fix is the "Disable fragile dynamic X11 loading". (I.e. a wheel created by

$ bash packaging/python/build_wheels.bash linux 314

still shows

  Type:                              EXEC (Executable file)

wheras one created by

$ python3.14 -m build --wheel --no-isolation --outdir /tmp/testwheel   --config-setting=build.verbose=true

shows

  Type:                              DYN (Position-Independent Executable file)

# 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
# =============================================================================
Expand Down
Loading