Setuptools fails to build C extensions on z/OS when using ibm-clang compiler
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 59
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
Issue
Problem
When building Python packages with C extensions on z/OS using the ibm-clang compiler (without the 64 suffix), setuptools fails during the linking stage with AMODE mismatch errors.
Steps to Reproduce
- On z/OS with Python installed, attempt to build a Python package with C extensions using
ibm-clang:
export CC=/usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang
export CXX=/usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang++
python setup.py build
Error Output
/usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang zos_util.o -o zos_util.so libpython3.13.x
IEW2456E 9207 SYMBOL CELQTLOC UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
THE DESIGNATED CALL LIBRARY.
IEW2456E 9207 SYMBOL CELQSTRT UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM
THE DESIGNATED CALL LIBRARY.
IEW2470E 9511 ORDERED SECTION CEESTART NOT FOUND IN MODULE.
IEW2665S 40FF MODULE *NULL* IS NON-EXECUTABLE AND WAS NOT SAVED BECAUSE
STORENX=NEVER.
IEW5033 The binder ended with return code 12.
ibm-clang: error: linker command failed with exit code 12
Root Cause
The ibm-clang compiler on z/OS defaults to 31-bit mode. While setuptools correctly adds -m64 during compilation, this flag is missing from the linker stage, causing AMODE mismatch between 64-bit object files and 31-bit linking mode.
Note
This issue does not affect ibm-clang64, which defaults to 64-bit mode.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported python setup.py build command on z/OS with CC set to ibm-clang, then trace how setuptools handles compiler and linker flags for C extensions. The change is done when the linker receives -m64 for ibm-clang, the reported AMODE errors are resolved, and ibm-clang64 behavior remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100