AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system


#Operatingsystems
#Opensource
#AIX
#AIX Open Source
 View Only
  • 1.  Python having issues on AIX 7.3, 7.2

    Posted yesterday
    Edited by Shivaraj Abbigeri yesterday

    Hi all,

    I am trying to build an example package and import it on

    AIX 7.3  7300-02-02-2420, AIX 7.2 7200-04-01-1939

    In both machine with Python 3.11 and python 3.12 (installed via dnf from toolbox) I get a coredump the moment I do an import.

    Here are the steps to reproduce

    export CC=/opt/freeware/bin/gcc

    export CXX=/opt/freeware/bin/g++

    export CFLAGS="-maix64 -g"

    export CXXFLAGS="-maix64 -g"

    export AR="ar -X64"

    export OBJECT_MODE=64

    Use this as source scikit-build-core/docs/examples/getting_started/c at main · scikit-build/scikit-build-core

    Then run

    cmake -B ./build

    cmake --build ./build --verbose

    bash-5.2# cmake -DCMAKE_BUILD_TYPE=Debug -B build
    -- The C compiler identification is GNU 13.3.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /opt/freeware/bin/gcc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Found Python: /opt/freeware/include/python3.12 (found version "3.12.11") found components: Development.Module
    -- Configuring done (0.8s)
    -- Generating done (0.0s)
    -- Build files have been written to: /path/c/build

    bash-5.2# cmake --build ./build/ --verbose
    Change Dir: '/path/c/build'
     
    Run Build Command(s): /opt/freeware/bin/cmake -E env VERBOSE=1 /opt/freeware/bin/gmake -f Makefile
    /opt/freeware/bin/cmake -S/path/c -B/path/c/build --check-build-system CMakeFiles/Makefile.cmake 0
    /opt/freeware/bin/cmake -E cmake_progress_start /path/c/build/CMakeFiles /path/c/build//CMakeFiles/progress.marks
    /opt/freeware/bin/gmake  -f CMakeFiles/Makefile2 all
    gmake[1]: Entering directory '/path/c/build'
    /opt/freeware/bin/gmake  -f CMakeFiles/example.dir/build.make CMakeFiles/example.dir/depend
    gmake[2]: Entering directory '/path/c/build'
    cd /path/c/build && /opt/freeware/bin/cmake -E cmake_depends "Unix Makefiles" /path/c /path/c /path/c/build /path/c/build /path/c/build/CMakeFiles/example.dir/DependInfo.cmake "--color="
    gmake[2]: Leaving directory '/path/c/build'
    /opt/freeware/bin/gmake  -f CMakeFiles/example.dir/build.make CMakeFiles/example.dir/build
    gmake[2]: Entering directory '/path/c/build'
    [ 50%] Building C object CMakeFiles/example.dir/example.c.o
    /opt/freeware/bin/gcc -Dexample_EXPORTS -isystem /opt/freeware/include/python3.12 -maix64 -g -g -fPIC -MD -MT CMakeFiles/example.dir/example.c.o -MF CMakeFiles/example.dir/example.c.o.d -o CMakeFiles/example.dir/example.c.o -c /path/c/example.c
    [100%] Linking C shared module example.cpython-312.so
    /opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/example.dir/link.txt --verbose=1
    "/opt/freeware/share/cmake-4.0/Modules/Platform/AIX/ExportImportList" -o CMakeFiles/example.dir/exports.exp -c /opt/freeware/bin/gcc CMakeFiles/example.dir/example.c.o
    /opt/freeware/bin/gcc -fPIC -Wl,-bE:CMakeFiles/example.dir/exports.exp -maix64 -g -g -Wl,-b,erok -shared -Wl,-bnoipath  -o example.cpython-312.so CMakeFiles/example.dir/example.c.o  -Wl,-blibpath:/opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13:/opt/freeware/lib:/usr/lib:/lib:
    gmake[2]: Leaving directory '/path/c/build'
    [100%] Built target example
    gmake[1]: Leaving directory '/path/c/build'
    /opt/freeware/bin/cmake -E cmake_progress_start /path/c/build/CMakeFiles 0
     
    bash-5.2# echo $PYTHONPATH
    /path/c/build
    bash-5.2# gdb --args python3.12 -c 'import example;'

    (gdb) run
    Starting program: /opt/freeware/bin/python3.12 -c import\ example\;
     
    Program received signal SIGILL, Illegal instruction.
    0x0000000000000000 in ?? ()
    (gdb) bt full
    #0  0x0000000000000000 in ?? ()
    No symbol table info available.
    #1  0x090000000867cbc0 in ?? ()
    No symbol table info available.
    #2  0x0900000006c7df78 in _PyImport_LoadDynamicModuleWithSpec () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #3  0x0900000006b4b428 in _imp_create_dynamic () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #4  0x0900000006aaf7f8 in cfunction_vectorcall_FASTCALL () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #5  0x0900000006ab3b08 in _PyVectorcall_Call () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #6  0x0900000006ab41a8 in PyObject_Call () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #7  0x0900000006b7efc8 in _PyEval_EvalFrameDefault () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #8  0x0900000006b00194 in _PyEval_Vector () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #9  0x0900000006ab0fd4 in _PyFunction_Vectorcall () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #10 0x0900000006ab1ac4 in object_vacall () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #11 0x0900000006ab1cc8 in PyObject_CallMethodObjArgs () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #12 0x0900000006b4dea4 in PyImport_ImportModuleLevelObject () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #13 0x0900000006b87a94 in _PyEval_EvalFrameDefault () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #14 0x0900000006b00194 in _PyEval_Vector () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #15 0x0900000006b0027c in PyEval_EvalCode () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #16 0x0900000006cb2364 in run_eval_code_obj () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)benj
    No symbol table info available.
    #17 0x0900000006cb2518 in run_mod () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #18 0x0900000006cb72d8 in PyRun_StringFlags () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #19 0x0900000006cb73d4 in PyRun_SimpleStringFlags () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #20 0x0900000006d174b8 in Py_RunMain () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #21 0x0900000006d18190 in pymain_main () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #22 0x0900000006d182c0 in Py_BytesMain () from /opt/freeware/lib64/libpython3.12.a(libpython3.12.so)
    No symbol table info available.
    #23 0x0000000100000538 in main ()
    No symbol table info available.
    (gdb) quit

    running normally results in this

    bash-5.2# python3.12
    Python 3.12.11 (main, Aug  1 2025, 03:47:31) [GCC 10.3.0] on aix
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import example
    Illegal instruction (core dumped)
    bash-5.2#

    The env is 

    bash-5.2# env
    SHELL=/usr/bin/ksh
    LC__FASTMSG=true
    ODMDIR=/etc/objrepos
    CLCMD_PASSTHRU=1
    AUTHSTATE=compat
    PWD=/path/c
    LOGNAME=root
    TZ=CST6CDT
    HOME=/
    LANG=en_US
    SSH_CONNECTION=
    PYTHONPATH=/path/c/build
    TERM=xterm
    USER=root
    LOGIN=root
    SHLVL=1
    LOCPATH=/usr/lib/nls/loc
    MAILMSG=[YOU HAVE NEW MAIL]
    SSH_CLIENT=
    PATH=/opt/freeware/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin
    CFLAGS=-maix64 -g
    MAIL=/usr/spool/mail/root
    SSH_TTY=/dev/pts/0
    A__z=! LOGNAME
    OLDPWD=/path
    _=/opt/freeware/bin/env
    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/msg/%l.%c/%N:/usr/lib/nls/msg/%l.%c/%N.cat

    1 more question why python is not built using IBM xlclang compiler but gcc any reason for that as well?



    Avinesh Benjamin



  • 2.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Python in AIX / AIX Toolbox is not built with runtime linking enabled ( unlike other platforms like Linux), So when you build these kind of python embedding C programs, you need to explicitly link to python library. Try setting below LDFLAGS and do a fresh cmake build., 
    export LDFLAGS="-L/opt/freeware/lib64 -lpython3.12" 



    ------------------------------
    Ayappan P
    ------------------------------



  • 3.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Hi Ayyapan

    So, whenever I do a pip install of something from pyenv its better to have this flag exported to be on the safe side?

    Thank you what you suggested worked



    ------------------------------
    Shivaraj Abbigeri
    ------------------------------



  • 4.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Not always required., It depends on the package build files. 
    We haven't seen any pypi c/c++ python modules that explicit requires this flag as setuptools/meson build system based packages takes care of this automatically. 



    ------------------------------
    Ayappan P
    ------------------------------



  • 5.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Hi Ayyapan

    pyzmq26 and above have this issue not sure where the issue is, but I originally ran into this problem

    when I did pip install pyzmq==27.0.2 it insalled fine, but the moment I did import zmq core dump.



    ------------------------------
    Shivaraj Abbigeri
    ------------------------------



  • 6.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Okay. Try exporting the above LDFLAGS and check., 



    ------------------------------
    Ayappan P
    ------------------------------



  • 7.  RE: Python having issues on AIX 7.3, 7.2

    Posted yesterday

    Hi @Ayappan P

    I tried the LDFLAGS="-L" you suggested yes pyzmq is not crashing at import zmq..

    I originally created an issue here https://github.com/scikit-build/scikit-build-core/issues/1139#issuecomment-3258315727

    If you read the last comment the person wants some clarification, I have created an issue at cmake too as requested AIX 7.2, 7.3 cmake not linking python library (#27200) · Issue · cmake/cmake



    ------------------------------
    Shivaraj Abbigeri
    ------------------------------