Skip to content

Failing to build c packages on z/OS #215

Closed
pypa/setuptools
#4298

Description

@pitmanst

Hi. Currently, distutils/setuptools does not provide the ability to build C/C++ packages on z/OS Unix System Services, and there's a few changes / additions that are needed to make it work:

  1. On z/OS, to use the functions provided by a shared library you need to specify the side deck file that is created with the shared library. Without this, you'll hit an error declaring all of these functions unresolved. For example, trying to build the PyPI package hello-c-extension will hit the following errors when trying to pip install it:
IEW2456E 9207 SYMBOL PyModule_Create2 UNRESOLVED.  MEMBER COULD NOT BE INCLUDED
         FROM THE DESIGNATED CALL LIBRARY.
IEW2456E 9207 SYMBOL PyLong_FromLong UNRESOLVED.  MEMBER COULD NOT BE INCLUDED
         FROM THE DESIGNATED CALL LIBRARY.
IEW2665S 40FF MODULE *NULL*  IS NON-EXECUTABLE AND WAS NOT SAVED BECAUSE
         STORENX=NEVER.
  1. There's multiple different supported c compilers available on z/OS, but none are installed by default. Along side this, the different compilers accept different flags / different styles of flags. For example:

To specify changing the c standard being used to c99:
IBM z/OS XL C/C++: -qlanglvl=c99
IBM XL C/C++ V2.4.1 for z/OS 2.4 and 2.5: -qlanglvl=c99 or -std=c99
IBM Open XL C/C++ 1.1 for z/OS and IBM C/C++ For Open Enterprise Languages on z/OS 2.0: -std=c99

So the flags for each compiler need to be set depending on which compiler the user is attempting to use.

  1. On z/OS, there's two ways that a user can install Python on their system. The first is through an installer to the predefined/prefixed location. The second method is simply a pax archive, which can be extracted and used at any location. In the former, there's no issue. In the latter, distutils will pick up the expected installation path rather than where it actually is.

I do have a PR which fixes these issues which I'll be creating shortly.

Activity

  1. added a commit that references this issue on Oct 2, 2023
    89b3831
  2. added 3 commits that reference this issue on Feb 12, 2024
    2b8bf7b
    47d4117
    a55a441
  3. added a commit that references this issue on Feb 12, 2024
    06d5663
  4. added a commit that references this issue on Apr 15, 2024
    f880685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions