Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Tue September 09, 2025 06:15 AM

    Hi,

    (venv) bash-5.2$ oslevel -s
    7200-04-01-1939

    I am using python 3.11.3 to create a venv, then pip install cffi and pip install pyinstaller.

    The issue is when trying to install cffi I get an error for undefined symbol __lwsync, this is if I export CC=gcc

    If export CC= IBM xlclang I dont get any error.

    Similarly, for pyinstaller xlclang no error but for gcc I get an error saying to build bootloader and set --target 64 bit or 32 bit.

    When using gcc I set cflags to have -maix64 OBJECT_MODE=64 and AR=ar -X64

    The endgoal is to build a binary using pyinstaller

    Is it safe to use IBM compiler as python has been built using gcc 10.3, and some other packages we use gets built fine using gcc

    Is ABI from gcc and IBM compiler interoperable?

     



    ------------------------------
    Avinesh Benjamin
    ------------------------------

    #AIXOpenSource


  • 2.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Tue September 09, 2025 07:37 AM
    (ld): er full
      ld: 0711-318 ERROR: Undefined symbols were found.
              The following symbols are in error:
       Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}
                                    RLD: Address  Section  Rld-type Referencing Symbol
       ----------------------------------------------------------------------------------------------
      ld: 0711-317 ERROR: Undefined symbol: .__lwsync
       .__lwsync                 [450]   ER PR src/c/_cffi_backend.c(build/temp.aix-7204-9988-64-cpython-311/src/c/_cffi_backend.o)
                                         00026dd0 .text    R_RBR    [1316]  <.cffi_call_python>
      ER: The return code is 8.
      collect2: error: ld returned 8 exit status
      error: command '/opt/pyenv/versions/3.11.3/lib/python3.11/config-3.11/ld_so_aix' failed with exit code 1
      [end of output]
     
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for cffi
    Failed to build cffi
    ERROR: Could not build wheels for cffi, which is required to install pyproject.toml-based projects

    error message for pip install cffi



    ------------------------------
    Avinesh Benjamin
    ------------------------------



  • 3.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Tue September 09, 2025 09:52 AM

    Hi Avinesh,

    It seems like you are using aixbase provided python. Can you please try with toolbox python(/opt/freeware/bin/python3)
    We have a CFFI built with toolbox python. You can install using the below command.

    dnf install python3-cffi

    Regards,
    Shubham



    ------------------------------
    Shubham Gupta
    ------------------------------



  • 4.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Tue September 09, 2025 01:16 PM

    Hi Shubham

    I want to use it with python3.11.3 only, python3-cffi installs is for python 3.9, I need cffi on my venv only.



    ------------------------------
    Avinesh Benjamin
    ------------------------------



  • 5.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc
    Best Answer

    Posted Wed September 10, 2025 01:10 AM

    Hi Avinesh,

    Please pass -DHAVE_SYNC_SYNCHRONIZE in CFLAGS while building.

    Regards,
    Shubham



    ------------------------------
    Shubham Gupta
    ------------------------------



  • 6.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Wed September 10, 2025 09:16 AM

    Hi Avinesh,

    Please pass "-maix64" in CC flag while building.
    Also please discard the previously shared fix.

    Explaination:
    By default the object mode is 32bit in AIX. Since in CFLAGS we are passing -maix64, so it is creating 64bit object file. But in linking phase, CFLAGS aren't used and hence giving error initially shown below.

    Getting requirements to build wheel ... done
      Running command Preparing metadata (pyproject.toml)
      ld: 0711-736 ERROR: Input file _configtest.o:
            XCOFF64 object files are not allowed in 32-bit mode.
      collect2: error: ld returned 8 exit status
      Note: will not use '__sync_synchronize()' in the C code
      ***** The above error message can be safely ignored.

    > Note: will not use '__sync_synchronize()' in the C code
    In setup.py, due to this error, pip wasn't able to pick the flag -DHAVE_SYNC_SYNCHRONIZE automatically. Hence passing it manually had worked.

    Regards,
    Shubham



    ------------------------------
    Shubham Gupta
    ------------------------------



  • 7.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Wed September 10, 2025 10:51 AM

    Hi Shubham

    On AIX 7.2 gcc 10 it fails, only after using option  -DHAVE_SYNC_SYNCHRONIZE 

    Which compiler version on OS did you try on?

    I always set OBJECT_MODE=64, AR="ar -X64" CFLAGS="-maix64" before running



    ------------------------------
    Avinesh Benjamin
    ------------------------------



  • 8.  RE: AIX 7.2 install cffi, pyinstaller gives error when using gcc

    Posted Thu September 11, 2025 02:14 AM

    Hi Avinesh,

    If you are exporting gcc, you have to add -maix64 along with it in the CC flag itself.
    If not it will automatically export all these symbols.

    Regards,
    Shubham



    ------------------------------
    Shubham Gupta
    ------------------------------