Skip to content

idraw from PyPI wheel (v9.0.1) fails with “invalid ELF header: RTLD_GLOBAL” on Linux (non-PIE executable) #3769

Description

@nrnhines

Problem

After pip install neuron (version 9.0.1) in a Python 3.13 virtual environment, launching idraw fails immediately:

invalid ELF header: RTLD_GLOBAL for /path/to/.../neuron/.data/bin/idraw
Could not dynamically link to Xlib.h. Is X11 installed?
can't open DISPLAY

The wrapper ~/env/bin/idraw produces the same error. nrniv starts without issue.

Diagnosis

The wheel-shipped idraw is a non-PIE executable:

file .../neuron/.data/bin/idraw
# ELF 64-bit LSB executable, x86-64, ... 

readelf -h .../idraw | grep Type
# Type:                              EXEC (Executable file)

It contains the InterViews self-dlopen code:

strings .../idraw | grep -E 'RTLD_GLOBAL|dlopen'
# dlopen
# %s: RTLD_GLOBAL for %s

nrniv from the same wheel does not contain those strings, so it is unaffected.

In contrast, a local build from source produces a proper PIE binary for idraw:

readelf -h $(which idraw) | grep Type
# Type:                              DYN (Position-Independent Executable file)

The legacy InterViews idraw performs dlopen(argv[0], RTLD_GLOBAL|...) for its dynamic widget/class registration. Modern glibc rejects RTLD_GLOBAL on non-PIE (ET_EXEC) executables.

Environment

NEURON version: 9.0.1 (HEAD b12a541+ 2025-11-14)
Python: 3.13 (venv)
OS: Linux x86_64 (recent glibc)
Installation: official PyPI wheel (pip install neuron)
X11 libraries are present (ldd succeeds).

Workaround

Build from source (the default CMake configuration already produces working PIE binaries for idraw).

Suggested Fix

The wheel build process (manylinux Docker image + CMake) is not applying POSITION_INDEPENDENT_CODE to the InterViews targets, while a normal local cmake build does.

Please ensure the wheel CI always sets:

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

(or explicitly on the iv / idraw targets) so that the shipped binaries match the behavior of a local build.

Issue discussed with and mostly prepared by Grok

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions