scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

AIX 7.2.0.0 core dump

Open AAB94 opened this issue 2 months ago • 30 comments

SKBUILD_BUILD_VERBOSE=1 pip install -v scikit-build-core/docs/examples/getting_started/c

Attempting to build the above, after building I get Core dump error when I try and import example Tried with both IBM compiler and gcc compiler.

cmake version 3.30.3 gcc 10, IBM AIX compiler 16.1.0 Python is version 3.11.3

Anyway to debug why the core dump is happening

AAB94 avatar Sep 02 '25 13:09 AAB94

I would test if compiling a similar pure-cmake hello-world project works, then try a python-based one without scikit-build-core, and then with scikit-build-core (with --no-build-isolation just to be safe). Where in those steps it fails would be helpful to understand.

LecrisUT avatar Sep 02 '25 13:09 LecrisUT

Hi @LecrisUT Thanks for replying:

int main(void) {
        std::cout<<"Hello World!\n";
        return 0;
}
cmake_minimum_required (VERSION 3.0)
project (CMakeHelloWorld)
set (CMakeHelloWorld_VERSION_MAJOR 1)

add_executable(Hello hello_world.cpp)
target_link_libraries(Hello)
install (TARGETS Hello DESTINATION /<path>/build)
bash-5.2$ export CC=/opt/IBM/xlC/16.1.0/bin/xlclang
bash-5.2$ export CXX=/opt/IBM/xlC/16.1.0/bin/xlclang++
bash-5.2$ cmake ../
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is XLClang 16.1.0.6
-- The CXX compiler identification is XLClang 16.1.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/IBM/xlC/16.1.0/bin/xlclang++ - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/IBM/xlC/16.1.0/bin/xlclang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (3.2s)
-- Generating done (0.2s)
-- Build files have been written to: /disks/drm_lonestar/benjaa2/85b/build
bash-5.2$ cmake --build . --target install --config Release
[ 50%] Building CXX object CMakeFiles/Hello.dir/hello_world.cpp.o
[100%] Linking CXX executable Hello
[100%] Built target Hello
Install the project...
-- Install configuration: ""
-- Set non-toolchain portion of runtime path of "/<path>/build/Hello" to "/usr/lib:/lib"
bash-5.2$ ./Hello
Hello World!

The cmake is installed via AIX freeware tool chain dnf install cmake, the gcc lib available on this machine is gcc 10

bash-5.2$ /opt/freeware/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/freeware/bin/gcc
COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.2.0.0/10/lto-wrapper
Target: powerpc-ibm-aix7.2.0.0
Configured with: ../gcc-10.3.0/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --enable-languages=c,c++,fortran,go --enable-version-specific-runtime-libs --disable-nls --disable-libstdcxx-pch --disable-werror --enable-libstdcxx-filesystem-ts --with-gcc-major-version-only --program-suffix=-10 --with-cpu=default32 --host=powerpc-ibm-aix7.2.0.0
Thread model: aix
Supported LTO compression algorithms: zlib
gcc version 10.3.0 (GCC)

bash-5.2$ file Hello
Hello: 64-bit XCOFF executable or object module not stripped

I am not familiar "then try a python-based one without scikit-build-core" can you explain how to build one?

AAB94 avatar Sep 03 '25 08:09 AAB94

(I've edited your post to be more readable)

Great, one source is ruled out

I am not familiar "then try a python-based one without scikit-build-core" can you explain how to build one?

Sure, just compile one of the example projects like https://github.com/scikit-build/scikit-build-core/tree/main/docs/examples/getting_started/c. It should work as normal. To test it without installing use PYTHON_PATH, e.g. it would be something like

$ cmake -B build
$ cmake --build ./build
$ PYTHON_PATH=$(pwd)/build python3
>>> import example
>>> example.square(2)
4

LecrisUT avatar Sep 03 '25 08:09 LecrisUT

Hi @LecrisUT

bash-5.2$ cmake -B build
-- The C compiler identification is XLClang 16.1.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/IBM/xlC/16.1.0/bin/xlclang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python: /opt/pyenv/versions/3.11.3/include/python3.11 (found version "3.11.3") found components: Development.Module
-- Configuring done (1.2s)
-- Generating done (0.1s)
-- Build files have been written to: /disks/drm_lonestar/benjaa2/85b/Test_sk/scikit-build-core/docs/examples/getting_started/c/build
bash-5.2$ cmake --build ./build
[ 50%] Building C object CMakeFiles/example.dir/example.c.o
[100%] Linking C shared module example.cpython-311.so
[100%] Built target example
bash-5.2$ export PYTHONPATH=$(pwd)/build
bash-5.2$ /opt/pyenv/versions/3.11.3/bin/python3
Python 3.11.3 (main, Nov 22 2024, 16:34:57) [GCC 10.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>>  os.environ['PYTHONPATH']
  File "<stdin>", line 1
    os.environ['PYTHONPATH']
IndentationError: unexpected indent
>>> os.environ['PYTHONPATH']
'/disks/drm_lonestar/benjaa2/85b/Test_sk/scikit-build-core/docs/examples/getting_started/c/build'
>>> import example
Illegal instruction (core dumped)
bash-5.2$

So, are we looking at an issue with python3.11 we have on our machine?

AAB94 avatar Sep 03 '25 11:09 AAB94

Unfortunately, probably yes. A few tips you can try:

  • check the python changelog history between 3.11.3 and latest 3.11.13.
  • try out a different python version, compilers
  • check if the different compilers are ABI compatible (your python was built with GCC 10.3.0, while you are using XLClang 16.1.0.6)
  • check up with your cluster admin, this should be a fairly common issue for them
  • worst-case try to build your own python environment locally

LecrisUT avatar Sep 03 '25 11:09 LecrisUT

bash-5.2$ export CC=/opt/freeware/bin/gcc
bash-5.2$ export CXX=/opt/freeware/bin/g++
bash-5.2$ export AR="ar -X64"
bash-5.2$ export OBJECT_MODE=64
bash-5.2$ ls
CMakeLists.txt  example.c  main.fmf  pyproject.toml
bash-5.2$ echo $PATH
/opt/pyenv/versions/3.11.3/bin:/opt/freeware/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin
bash-5.2$ cmake -B build
-- The C compiler identification is GNU 10.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/pyenv/versions/3.11.3/include/python3.11 (found version "3.11.3") found components: Development.Module
-- Configuring done (1.6s)
-- Generating done (0.1s)
-- Build files have been written to: /<path>/Test_sk/scikit-build-core/docs/examples/getting_started/c/build
bash-5.2$ cmake --build ./build
[ 50%] Building C object CMakeFiles/example.dir/example.c.o
In file included from /opt/pyenv/versions/3.11.3/include/python3.11/Python.h:38,
                 from /<path>/Test_sk/scikit-build-core/docs/examples/getting_started/c/example.c:2:
/opt/pyenv/versions/3.11.3/include/python3.11/pyport.h:601:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  601 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~
gmake[2]: *** [CMakeFiles/example.dir/build.make:76: CMakeFiles/example.dir/example.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/example.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
bash-5.2$ export CFLAGS="-maix64 -fPIC"
bash-5.2$ export CXXFLAGS="-maix64 -fPIC"
bash-5.2$ rm -rf build/
bash-5.2$ cmake --build ./build
Error: /<path>/Test_sk/scikit-build-core/docs/examples/getting_started/c/build is not a directory
bash-5.2$ cmake -B build
-- The C compiler identification is GNU 10.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/pyenv/versions/3.11.3/include/python3.11 (found version "3.11.3") found components: Development.Module
-- Configuring done (1.5s)
-- Generating done (0.1s)
-- Build files have been written to: /<path>/Test_sk/scikit-build-core/docs/examples/getting_started/c/build
bash-5.2$ cmake --build ./build
[ 50%] Building C object CMakeFiles/example.dir/example.c.o
[100%] Linking C shared module example.cpython-311.so
[100%] Built target example
bash-5.2$ echo $PYTHONPATH
/<path>/Test_sk/scikit-build-core/docs/examples/getting_started/c/build
bash-5.2$ python3
Python 3.11.3 (main, Nov 22 2024, 16:34:57) [GCC 10.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
Illegal instruction (core dumped)
bash-5.2$

AAB94 avatar Sep 03 '25 12:09 AAB94

@LecrisUT it fails even with gcc, any compiler flag since we are building a shared object I supplied .so and 64 bit OS so maix64 any other flag needed?

AAB94 avatar Sep 03 '25 12:09 AAB94

🤷 I would question if the python interpreter itself is in a functional state. It seems that even pre-compiled binaries will break it, if not even pure-python ones. There should be some pre-compiled ppc binary packages in pypi, but I don't know how to search for them.

You can also check the flags used to build the python interpreter itself. I think it is sysconfig.get_config_vars

LecrisUT avatar Sep 03 '25 12:09 LecrisUT

Hi @LecrisUT 1 more possibility

In the example a share object is created is it possible something is going wrong while linking so the .so created has some issue, Say the python downloaded from https://www.ibm.com/support/pages/node/883796 also crashes would that mean the .so is built wrongly

AAB94 avatar Sep 04 '25 07:09 AAB94

is it possible something is going wrong while linking so the .so created has some issue,

Shouldn't be. It would probably fail during the CMake build if that were an issue. The only linkage in the example is to glibc (if even). You can investigate the built library with readelf -d. One thing that can happen is that it is building and linking to different glibc libraries. Try running readelf -d on the python executable/libraries as well.

Say the python downloaded from https://www.ibm.com/support/pages/node/883796 also crashes would that mean the .so is built wrongly

Then it would be an issue you need to file with IBM, although the package might be managed on RedHat/Fedora, at least the ppc64le is done there, not sure if it is equivalent. However, you would not be able to install it directly as a non-admin user, and if you are an admin user, I would check first your package manager (most likely dnf) directly.

LecrisUT avatar Sep 04 '25 08:09 LecrisUT

Hi @LecrisUT

AIX uses XCOFF instead of ELF format/spec for binaries/so's :(

(venv) bash-5.2$ dump -Tv example.cpython-311.so .

example.cpython-311.so:

                        ***Loader Section***

                        ***Loader Symbol Table Information***
[Index]      Value      Scn     IMEX Sclass   Type           IMPid Name

[0]     0x20000cf8    .data              RW SECdef        [noIMid] __rtinit
[1]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) __cxa_finalize
[2]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) _GLOBAL__AIXI_shr_o
[3]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) _GLOBAL__AIXD_shr_o
[4]     0x00000000    undef      IMP     UA EXTref libc.a(shr_64.o) errno
[5]     0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) strtod
[6]     0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) __fd_select
[7]     0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) __fd_getdtablesize
[8]     0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) rint
[9]     0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) __iso_wcsftime
[10]    0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) __iso_wcstok
[11]    0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) fp_swap_rnd
[12]    0x00000000    undef      IMP     DS EXTref libc.a(shr_64.o) wcstod
[13]    0x00000000    undef      IMP     RW EXTref libc.a(shr_64.o) __multi_threaded
[14]    0x00000000    undef      IMP     RW EXTref libc.a(shr_64.o) _DBLINF
[15]    0x00000000    undef      IMP     RW EXTref libc.a(shr_64.o) _libc_data_funcs
[16]    0x20000de0    .data      EXP     DS   Ldef        [noIMid] _GLOBAL__AIXI_example_cpython_311_so
[17]    0x20000df8    .data      EXP     DS   Ldef        [noIMid] _GLOBAL__AIXD_example_cpython_311_so
[18]    0x20000e10    .data      EXP     DS   Ldef        [noIMid] square
[19]    0x20000e40    .data      EXP     DS   Ldef        [noIMid] PyInit_example
[20]    0x00000000    undef      IMP     DS EXTref        [noIMid] _PyArg_ParseTuple_SizeT
[21]    0x00000000    undef      IMP     DS EXTref        [noIMid] PyFloat_FromDouble
[22]    0x00000000    undef      IMP     DS EXTref        [noIMid] PyModule_Create2
dump: .: dump: 0654-105 The file is not in a recognized format.
        Specify an executable file, object file, or archive file.
(venv) bash-5.2$ dump -Hv example.cpython-311.so

example.cpython-311.so:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000017       0x0000003b       0x000000c4

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00000610       0x00000194       0x000006d4


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64:/opt/freeware/lib/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10:/opt/freeware/lib:/usr/lib:/lib:
1                                    libgcc_s.a          shr.o
2                                    libc.a              shr_64.o
(venv) bash-5.2$

I hope the above 2 outputs are useful though I am confused about the libgcc_s.a it seems to use 32 bit object

AAB94 avatar Sep 04 '25 08:09 AAB94

(venv) bash-5.2$ dump -Tv example.cpython-311.so

example.cpython-311.so:

                        ***Loader Section***

                        ***Loader Symbol Table Information***
[Index]      Value      Scn     IMEX Sclass   Type           IMPid Name

[0]     0x1100004c8    .data      EXP     DS SECdef        [noIMid] square
[1]     0x1100004f8    .data      EXP     DS SECdef        [noIMid] PyInit_example
[2]     0x00000000    undef      IMP     DS EXTref        [noIMid] _PyArg_ParseTuple_SizeT
[3]     0x00000000    undef      IMP     DS EXTref        [noIMid] PyFloat_FromDouble
[4]     0x00000000    undef      IMP     DS EXTref        [noIMid] PyModule_Create2
(venv) bash-5.2$ dump -Hv example.cpython-311.so

example.cpython-311.so:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000005       0x00000010       0x00000011

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000001       0x000001b0       0x0000005c       0x000001c1


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /usr/lib:/lib:
(venv) bash-5.2$

This for the binary with IBM compiler..

AAB94 avatar Sep 04 '25 08:09 AAB94

What I was hoping to see from the readelf -d is the libraries that it is trying to load and what RPATH and equivalents it is using, e.g.

$ readelf -d /usr/lib64/libpython3.13.so.1.0 

Dynamic section at offset 0x4cb740 contains 30 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libpython3.13.so.1.0]

LecrisUT avatar Sep 04 '25 09:09 LecrisUT

Hi @LecrisUT

bash-5.2$ dump -H example.cpython-311.so

example.cpython-311.so:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000017       0x0000003b       0x000000c4

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00000610       0x00000194       0x000006d4


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64:/opt/freeware/lib/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10:/opt/freeware/lib:/usr/lib:/lib:
1                                    libgcc_s.a          shr.o
2                                    libc.a              shr_64.o
bash-5.2$ ldd example.cpython-311.so
example.cpython-311.so needs:
         /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64/libgcc_s.a(shr.o)
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
bash-5.2$

Does the output from ldd help?

I think this is equivalent of RPAH /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64:/opt/freeware/lib/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10:/opt/freeware/lib:/usr/lib:/lib

Interesting part is I dont libpython.so anywhere here, should this be linking with python .so?

AAB94 avatar Sep 04 '25 10:09 AAB94

Interesting part is I dont libpython.so anywhere here, should this be linking with python .so?

You should find it when you run the readelf or equivalent on the python executable.

Does the output from ldd help?

Partially, but I am making assumptions on what I'm reading. It is weird that it is linking to .a files which would be used for static linking. It is also linking to both your compiler's libgcc and the system's libc, maybe because of a fallback. Would be good to reference against the hello-world example that worked for you.

LecrisUT avatar Sep 04 '25 11:09 LecrisUT

bash-5.2$ ldd Hello
Hello needs:
         /usr/lib/libc.a(shr.o)
         /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/libstdc++.a(libstdc++.so.6)
         /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/libgcc_s.a(shr.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)
bash-5.2$

AAB94 avatar Sep 04 '25 13:09 AAB94

bash-5.2$ export CXXFLAGS="-maix64"
bash-5.2$ ls
CMakeCache.txt       CMakeFiles           Hello                Makefile             cmake_install.cmake
bash-5.2$ cd ..
bash-5.2$ rm -rf build/
bash-5.2$ /opt/freeware/bin/cmake -B ./build
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/freeware/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (5.0s)
-- Generating done (0.1s)
-- Build files have been written to: /disks/drm_lonestar/benjaa2/85b/build
bash-5.2$ /opt/freeware/bin/cmake --build ./build/ --verbose
Change Dir: '/disks/drm_lonestar/benjaa2/85b/build'

Run Build Command(s): /opt/freeware/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile
/opt/freeware/bin/cmake -S/disks/drm_lonestar/benjaa2/85b -B/disks/drm_lonestar/benjaa2/85b/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/freeware/bin/cmake -E cmake_progress_start /disks/drm_lonestar/benjaa2/85b/build/CMakeFiles /disks/drm_lonestar/benjaa2/85b/build//CMakeFiles/progress.marks
/usr/bin/gmake  -f CMakeFiles/Makefile2 all
gmake[1]: Entering directory '/disks/drm_lonestar/benjaa2/85b/build'
/usr/bin/gmake  -f CMakeFiles/Hello.dir/build.make CMakeFiles/Hello.dir/depend
gmake[2]: Entering directory '/disks/drm_lonestar/benjaa2/85b/build'
cd /disks/drm_lonestar/benjaa2/85b/build && /opt/freeware/bin/cmake -E cmake_depends "Unix Makefiles" /disks/drm_lonestar/benjaa2/85b /disks/drm_lonestar/benjaa2/85b /disks/drm_lonestar/benjaa2/85b/build /disks/drm_lonestar/benjaa2/85b/build /disks/drm_lonestar/benjaa2/85b/build/CMakeFiles/Hello.dir/DependInfo.cmake "--color="
gmake[2]: Leaving directory '/disks/drm_lonestar/benjaa2/85b/build'
/usr/bin/gmake  -f CMakeFiles/Hello.dir/build.make CMakeFiles/Hello.dir/build
gmake[2]: Entering directory '/disks/drm_lonestar/benjaa2/85b/build'
[ 50%] Building CXX object CMakeFiles/Hello.dir/hello_world.cpp.o
/opt/freeware/bin/g++   -maix64 -MD -MT CMakeFiles/Hello.dir/hello_world.cpp.o -MF CMakeFiles/Hello.dir/hello_world.cpp.o.d -o CMakeFiles/Hello.dir/hello_world.cpp.o -c /disks/drm_lonestar/benjaa2/85b/hello_world.cpp
[100%] Linking CXX executable Hello
/opt/freeware/bin/cmake -E cmake_link_script CMakeFiles/Hello.dir/link.txt --verbose=1
/opt/freeware/bin/g++ -maix64 -Wl,-bnoipath -Wl,-bexpall CMakeFiles/Hello.dir/hello_world.cpp.o -o Hello  -Wl,-blibpath:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64:/opt/freeware/lib/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10:/opt/freeware/lib:/usr/lib:/lib:
gmake[2]: Leaving directory '/disks/drm_lonestar/benjaa2/85b/build'
[100%] Built target Hello
gmake[1]: Leaving directory '/disks/drm_lonestar/benjaa2/85b/build'
/opt/freeware/bin/cmake -E cmake_progress_start /disks/drm_lonestar/benjaa2/85b/build/CMakeFiles 0

bash-5.2$ ldd build/Hello
build/Hello needs:
         /usr/lib/libc.a(shr_64.o)
         /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64/libstdc++.a(libstdc++.so.6)
         /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/ppc64/libgcc_s.a(shr.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
bash-5.2$ ./build/Hello
Hello World!

I updated CXXFLAGS to maix64 to get 64 bit binary for the Hello World program too the above is the result for that

AAB94 avatar Sep 04 '25 14:09 AAB94

Well, at this point I have no more ideas. Best to take it up with your cluster provider and/or whoever configured the python environment there.

LecrisUT avatar Sep 04 '25 14:09 LecrisUT

Hi @LecrisUT

bash-5.2$ dbx /opt/pyenv/versions/3.11.3/bin/python3.11 core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...internal error: assertion failed at line 6685 in file object.c


Illegal instruction (illegal opcode) in . at 0x0 ($t1)
warning: Unable to access address 0x0 from core
(dbx) where
.() at 0x0
PyInit_example() at 0x90000000879f300
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;_base:7,64,64;_bufendp:7,128,64;__newbase:9=*10=@s8;r10;0;255;,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_base:7,64,64;_bufendp:7,128,64;__newbase:9=*10=@s8;r10;0;255;,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found '=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found '@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-232 index("s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;", ':') failed
internal error: unexpected value 120 at line 5201 in file stabstring.c
_PyImport_LoadDynamicModuleWithSpec(??, ??), line 169 in "importdl.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;_base:42,64,64;_bufendp:42,128,64;__newbase:44=*22,192,64;_lock:45=*7,256,64;_cnt:8,320,32;_file:8,352,32;__stdioid:8,384,32;_flag:46=@s16;r46;-32768;32767;,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_base:42,64,64;_bufendp:42,128,64;__newbase:44=*22,192,64;_lock:45=*7,256,64;_cnt:8,320,32;_file:8,352,32;__stdioid:8,384,32;_flag:46=@s16;r46;-32768;32767;,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ',', found ';,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ';', found ',16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;data:57=ar33;0;00000000000000000000007;22,0,64;;'
internal error: 1283-228 expected char ';', found ',64;data:57=ar33;0;00000000000000000000007;22,0,64;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
unnamed block in _imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009ff70), line 2385 in "import.c"
unnamed block in _imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009ff70), line 2385 in "import.c"
_imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009ff70), line 2385 in "import.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found 'sPyMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: 1283-228 expected char ',', found 'PyMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: 1283-228 expected char ';', found 'yMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: unexpected value 44 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found '128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
cfunction_vectorcall_FASTCALL(func = 0x0a0000000008a7f0, args = 0x0a000000000cdd98, nargsf = ??, kwnames = ??), line 427 in "methodobject.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
unnamed block in _PyObject_Call(tstate = 0x09001000a085dcd0, callable = 0x0a0000000008a7f0, args = 0x0a000000000cdd80, kwargs = 0x0a000000000f0ec0, callable = [internal error: nil paramlist for function containing callable]
(dbx)

Not sure but dbx equivalent of gdb on AIX gave this output

Does this mean something

[using memory image in core] reading symbolic information ...internal error: assertion failed at line 6685 in file object.c ??

The binary and python both were buitl with gcc though

AAB94 avatar Sep 04 '25 16:09 AAB94

🤷 wouldn't know how to read it, but it still feels like its an issue with your python environment. You could still build python from source

LecrisUT avatar Sep 04 '25 16:09 LecrisUT

Hi @LecrisUT

at 0x0
PyInit_example(), line 24 in "example.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;_base:7,64,64;_bufendp:7,128,64;__newbase:9=*10=@s8;r10;0;255;,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_base:7,64,64;_bufendp:7,128,64;__newbase:9=*10=@s8;r10;0;255;,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,192,64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_lock:11=*12=12,256,64;_cnt:13=r13;-2147483648;2147483647;,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,320,32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',32;_file:13,352,32;__stdioid:13,384,32;_flag:14=@s16;r14;-32768;32767;,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';,416,16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found ',16;_unused:14,432,16;_unused1:15=ar16=@s64;r16;0;01777777777777777777777;;0;00000000000000000000003;17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found ';17=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ',', found '=@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-228 expected char ';', found '@s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;'
internal error: 1283-232 index("s64;r17;01000000000000000000000;00777777777777777777777;,448,256;;", ':') failed
internal error: unexpected value 120 at line 5201 in file stabstring.c
_PyImport_LoadDynamicModuleWithSpec(??, ??), line 169 in "importdl.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;_base:42,64,64;_bufendp:42,128,64;__newbase:44=*22,192,64;_lock:45=*7,256,64;_cnt:8,320,32;_file:8,352,32;__stdioid:8,384,32;_flag:46=@s16;r46;-32768;32767;,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ';', found ',64;_base:42,64,64;_bufendp:42,128,64;__newbase:44=*22,192,64;_lock:45=*7,256,64;_cnt:8,320,32;_file:8,352,32;__stdioid:8,384,32;_flag:46=@s16;r46;-32768;32767;,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ',', found ';,416,16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: 1283-228 expected char ';', found ',16;_unused:46,432,16;_unused1:47=ar33;0;00000000000000000000003;38,448,256;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found ';,0,64;data:57=ar33;0;00000000000000000000007;22,0,64;;'
internal error: 1283-228 expected char ';', found ',64;data:57=ar33;0;00000000000000000000007;22,0,64;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
unnamed block in _imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009fef0), line 2385 in "import.c"
unnamed block in _imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009fef0), line 2385 in "import.c"
_imp_create_dynamic(module = ??, args = 0x0a00000000245630, nargs = @0x0a0000000009fef0), line 2385 in "import.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found 'sPyMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: 1283-228 expected char ',', found 'PyMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: 1283-228 expected char ';', found 'yMethodDef:,128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: unexpected value 44 at line 5201 in file stabstring.c
internal error: 1283-228 expected char ',', found '128,64;m_self:1,192,64;m_module:1,256,64;m_weakreflist:1,320,64;vectorcall:10=11=*12=f1,384,64;;'
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
cfunction_vectorcall_FASTCALL(func = 0x0a0000000008a7f0, args = 0x0a000000000cdd98, nargsf = ??, kwnames = ??), line 427 in "methodobject.c"
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
internal error: unexpected value 120 at line 5201 in file stabstring.c
unnamed block in _PyObject_Call(tstate = 0x09001000a08dbcd0, callable = 0x0a0000000008a7f0, args = 0x0a000000000cdd80, kwargs = 0x0a000000000f0e40, callable = [internal error: nil paramlist for function containing callable]

You can ignore the internal error lines they are probably some dbx related issue, but I found 2 things interesting at 0x0 PyInit_example(), line 24 in "example.c"

does this mean the module is not created or found?

AAB94 avatar Sep 04 '25 16:09 AAB94

@LecrisUT is it possible to specify the location of the libpython librariy header files manually in cmake 3.30

AAB94 avatar Sep 04 '25 17:09 AAB94

bash-5.2$ /opt/freeware/bin/gdb --args /opt/pyenv/versions/3.11.3/bin/python3.11 -c 'import example;'
GNU gdb (GDB) 15.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.1.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/pyenv/versions/3.11.3/bin/python3.11...
(gdb) run
Starting program: /opt/pyenv/versions/3.11.3/bin/python3.11 -c import\ example\;

Program received signal SIGILL, Illegal instruction.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x090000000b066974 in ?? ()
#2  0x0900000009226798 in text () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#3  0x090000000905ada4 in _imp_create_dynamic () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#4  0x090000000904ae30 in cfunction_vectorcall_FASTCALL () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#5  0x0900000009045394 in _PyObject_Call () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#6  0x09000000090455b8 in PyObject_Call () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#7  0x090000000916ba20 in _PyEval_EvalFrameDefault () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#8  0x0900000008fbd660 in _PyEval_Vector () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#9  0x09000000090456a0 in _PyFunction_Vectorcall () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#10 0x09000000090466c4 in object_vacall () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#11 0x090000000904690c in PyObject_CallMethodObjArgs () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#12 0x090000000905fa1c in PyImport_ImportModuleLevelObject () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#13 0x090000000916eca8 in _PyEval_EvalFrameDefault () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#14 0x0900000008fbd300 in PyEval_EvalCode () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#15 0x09000000091b2f70 in run_mod () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#16 0x09000000091b5c00 in PyRun_StringFlags () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#17 0x09000000091b5cfc in PyRun_SimpleStringFlags () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#18 0x0900000009244a94 in Py_RunMain () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#19 0x090000000924579c in Py_BytesMain () from /opt/pyenv/versions/3.11.3/lib/libpython3.11.so
#20 0x00000001000004f8 in main ()

AAB94 avatar Sep 04 '25 17:09 AAB94

@LecrisUT is it possible to specify the location of the libpython librariy header files manually in cmake 3.30

Yes, you have many options^1, the most basic of them is Python_ROOT_DIR.

The gdb output again is indicating that it would be an issue with the python library itself. Trying out different more recent python versions or compiling it locally should be your best bet. Although it is odd that the last 2 traces do not have debug symbols while the python ones are clearly there. Did you build it with CMAKE_BUILD_TYPE=Debug?

LecrisUT avatar Sep 05 '25 08:09 LecrisUT

Hi @LecrisUT

no I added -g under CFLAGS manually, for the C binary, I assume CMAKE_BUILD_TYPE=Debug would do the same, I tried with python3.12 same result :(

bash-5.2# rm -rf build/
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: /benjaa2/c/build
bash-5.2# camke --build ./build/ --verbose
bash: camke: command not found
bash-5.2# cmake --build ./build/ --verbose
Change Dir: '/benjaa2/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/benjaa2/c -B/benjaa2/c/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/freeware/bin/cmake -E cmake_progress_start /benjaa2/c/build/CMakeFiles /benjaa2/c/build//CMakeFiles/progress.marks
/opt/freeware/bin/gmake  -f CMakeFiles/Makefile2 all
gmake[1]: Entering directory '/benjaa2/c/build'
/opt/freeware/bin/gmake  -f CMakeFiles/example.dir/build.make CMakeFiles/example.dir/depend
gmake[2]: Entering directory '/benjaa2/c/build'
cd /benjaa2/c/build && /opt/freeware/bin/cmake -E cmake_depends "Unix Makefiles" /benjaa2/c /benjaa2/c /benjaa2/c/build /benjaa2/c/build /benjaa2/c/build/CMakeFiles/example.dir/DependInfo.cmake "--color="
gmake[2]: Leaving directory '/benjaa2/c/build'
/opt/freeware/bin/gmake  -f CMakeFiles/example.dir/build.make CMakeFiles/example.dir/build
gmake[2]: Entering directory '/benjaa2/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 /benjaa2/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 '/benjaa2/c/build'
[100%] Built target example
gmake[1]: Leaving directory '/benjaa2/c/build'
/opt/freeware/bin/cmake -E cmake_progress_start /benjaa2/c/build/CMakeFiles 0

bash-5.2# echo $PYTHONPATH
/benjaa2/c/build
bash-5.2# gdb --args python3.12 -c 'import example;'
GNU gdb (GDB) 15.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.1.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3.12...
(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)
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)

I installed python with dnf install python3.12 python3.12-dev So option now is to build python myself and try right and is it possible to file a bug with who builds and manages packages for AIX OpenSource toolbox

AAB94 avatar Sep 05 '25 09:09 AAB94

If it is an issue with dnf installed packages than yes raise it with IBM, they need to know about this. Can you run dnf info python3.12 to check which repository provides it specifically?

LecrisUT avatar Sep 05 '25 10:09 LecrisUT

bash-5.2# dnf info python3.12
Last metadata expiration check: 2:55:08 ago on Fri Sep  5 02:53:41 CDT 2025.
Installed Packages
Name         : python3.12
Version      : 3.12.11
Release      : 2
Architecture : ppc
Size         : 199 M
Source       : python3.12-3.12.11-2.src.rpm
Repository   : @System
From repo    : AIX_Toolbox
Summary      : Version 3.12 of the Python interpreter
URL          : https://www.python.org/
License      : Modified CNRI Open Source License
Description  : Python 3.12 is an accessible, high-level, dynamically typed, interpreted
             : programming language, designed with an emphasis on code readability.
             : It includes an extensive standard library, and has a vast ecosystem of
             : third-party libraries.
             :
             : The python3.12 package provides the python3.12 executable: the reference
             : interpreter for the Python language, version 3 and majority of its standard library.
             : The remaining parts of the Python standard library are broken out into the
             : python3.12-tkinter and python3.12-test packages, which may need to be installed
             : separately.
             :
             : IDLE for Python 3.12 is provided in the python3.12-idle package and
             : development files are provided through python3.12-devel package

bash-5.2#

From IBM's site

Important Tips!!!

The AIX Toolbox team recommends using DNF to install and manage Open Source software packages and dependencies Visit Get Started to learn more about DNF and the dnf_aixtoolbox.sh install script. The AIX Toolbox packages are not supported through IBM AIX support cases. Visit Get Help to learn how to report issues or get answers.

Well let me open topic on the forum and see,

AAB94 avatar Sep 05 '25 10:09 AAB94

Hi @LecrisUT

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"

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.

from https://community.ibm.com/community/user/discussion/python-having-issues-on-aix-73-72

It worked now :)

AAB94 avatar Sep 05 '25 12:09 AAB94

Ok, can you make one more issue at https://gitlab.kitware.com/cmake/cmake and cross-link with the IBM issue (both ways).

CMake wise, you are building it as a MODULE through

python_add_library(MODULE)

which is the correct way of building and packaging these because the python library is supposed to take care of making the current python library available at load time. The issue is that without this SABI packages (built with one python version but reusable across many) are impossible on that architecture.

Some discussion is needed back-and-forth between CMake and IBM to figure out how to deal with this properly. You can tag me over at kitware to be kept in the loop there.

LecrisUT avatar Sep 05 '25 13:09 LecrisUT

Hi @LecrisUT

The AIX toolbox does not allow creating support tickets only community forum is allowed, https://community.ibm.com/community/user/discussion/python-having-issues-on-aix-73-72 posted the request

AAB94 avatar Sep 05 '25 14:09 AAB94