python-greenlet / greenlet

Lightweight in-process concurrent programming
Other
1.63k stars 247 forks source link

Greenlet 2.0.2/3.0.1 installation is failing on AIX 7.2 platform #386

Open Chandana2296 opened 9 months ago

Chandana2296 commented 9 months ago

Encountered an error when trying to install greenlet 2.0.2/3.0.1 on AIX 7.2 platform with the below error:

command: pip install greenlet==3.01 / pip install greenlet==2.0.2

Error:

/opt/pyenv/versions/3.11.3/lib/python3.11/config-3.11/ld_so_aix /opt/freeware/bin/g++ -pthread -bI:/opt/pyenv/versions/3.11.3/lib/python3.11/config-3.11/python.exp -L/opt/pyenv/versions/3.11.3/lib -maix64 -L/opt/openssl111n/aixpower/lib -L/opt/freeware/lib64 -L/opt/pyenv/versions/3.11.3/lib -maix64 -L/opt/openssl111n/aixpower/lib -L/opt/freeware/lib64 -maix64 -pthread build/temp.aix-7204-9988-64-cpython-311/src/greenlet/tests/_test_extension_cpp.o -L/opt/pyenv/versions/3.11.3/lib -o build/lib.aix-7204-9988-64-cpython-311/greenlet/tests/_test_extension_cpp.cpython-311.so

  ld: 0711-418 ERROR: Import or export file _test_extension_cpp.cpython-311.exp at line 11:
          A symbol name may only be followed by an export attribute
          or an address. The line is being ignored.

  ld: 0711-418 ERROR: Import or export file _test_extension_cpp.cpython-311.exp at line 12:
          A symbol name may only be followed by an export attribute
          or an address. The line is being ignored.

  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]

Environment Details: OS: AIX 7.2 Python Version: 3.11.3 Exported Flags:

    export CC="/opt/freeware/bin/gcc -fPIC"
    export CXX="/opt/freeware/bin/g++"
    export CFLAGS="-pthread"
    export CXXFLAGS="-std=c++11"
    export LDFLAGS="-maix64 "
    export AR="ar -X64 "

please help me to solve this error..

Also let me know is there any flag which can skip the cpp test extensions like earlier GREENLET_TEST_CPP.

Thanks, Chandana

Chandana2296 commented 9 months ago

Also I am getting the below error :

Error :

  /opt/freeware/bin/gcc -fPIC -Wsign-compare -DNDEBUG -O3 -Wall -maix64 -I/opt/openssl111n/aixpower/include -I/opt/freeware/include -maix64 -I/opt/openssl111n/aixpower/include -I/opt/freeware/include -maix64 -I/opt/pyenv/versions/3.11.3/include/python3.11 -c src/greenlet/greenlet.cpp -o build/temp.aix-7204-9988-64-cpython-311/src/greenlet/greenlet.o
  In file included from /opt/pyenv/versions/3.11.3/include/python3.11/Python.h:29,
                   from src/greenlet/greenlet.cpp:16:
  /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/unistd.h:210:16: error: conflicting declaration of C function 'off64_t lseek64(int, off64_t, int)'
   extern off64_t lseek64(int, off64_t, int);
                  ^~~~~~~
  /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/unistd.h:208:14: note: previous declaration 'off_t lseek64(int, off_t, int)'
   extern off_t lseek(int, off_t, int);
                ^~~~~
  In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/unistd.h:866,
                   from /opt/pyenv/versions/3.11.3/include/python3.11/Python.h:29,
                   from src/greenlet/greenlet.cpp:16:
  /usr/include/sys/lockf.h:64:13: error: conflicting declaration of C function 'int lockf64(int, int, off64_t)'
    extern int lockf64 (int, int, off64_t);
               ^~~~~~~
  /usr/include/sys/lockf.h:62:13: note: previous declaration 'int lockf64(int, int, off_t)'
    extern int lockf (int, int, off_t);
               ^~~~~
  In file included from /opt/pyenv/versions/3.11.3/include/python3.11/Python.h:29,
                   from src/greenlet/greenlet.cpp:16:
  /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/unistd.h:939:14: error: conflicting declaration of C function 'int ftruncate64(int, off64_t)'
    extern int  ftruncate64(int, off64_t);
                ^~~~~~~~~~~
  In file included from /opt/pyenv/versions/3.11.3/include/python3.11/Python.h:29,
                   from src/greenlet/greenlet.cpp:16:
  /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/unistd.h:937:14: note: previous declaration 'int ftruncate64(int, off_t)'
    extern int  ftruncate(int, off_t);

If I export the below Flags:


    export CC="/opt/freeware/bin/gcc -fPIC"
    export CXX="/opt/freeware/bin/g++"
    export CFLAGS="-maix64"
    export CXXFLAGS="-std=c++11"
    export LDFLAGS="-maix64 -lstdc++"
    export AR="ar -X64 "
    export OBJECT_MODE=64
jamadden commented 9 months ago

I'm afraid I can't help you. The only thing I know about compilation on AIX comes from reading the porting guide for AIX 5L for fun; I've never had access to an AIX system. I have no idea where _test_extension_cpp.cpython-311.exp is coming from --- it's certainly not something that ships with greenlet, so I have no idea what's creating it or how to debug it.

No, you can't disable the C++ tests --- greenlet is written in C++ so it's important that they pass.

The other errors about redefined functions suggest conflicting C preprocessor definitions. This can be caused by many things; sometimes it is the result of compiling Python with one set of flags, and then compiling extensions with a different set of flags.

Chandana2296 commented 8 months ago

Greenlet is exporting the C++ name symbols to this file _test_extension_cpp.cpython-311.exp, while exporting the c++ name symbols getting the error mentioned in the issue.

Chandana2296 commented 8 months ago

Content of the file _test_extension_cpp.cpython-311.exp

+1 #!build/lib.aix-7204-1937-64-3.10/greenlet/tests/_test_extension_cpp.cpython-310.so +2 +3 Generated automatically by makexp_aix (Sat Aug 26 05:16:35 UTC 2023) +4 +5 Base Directory: /disks/drm_lonestar/abbigs/greenlet-2.0.2 +6 Input File(s) : build/temp.aix-7204-1937-64-3.10/src/greenlet/tests/_test_extension_cpp.o +7 +8 NOTE: lists all global symbols defined in the above file(s). +9 +10 PyInit__test_extension_cpp +11 typeinfo for exception_t +12 typeinfo name for exception_t

The last two lines(11 and 12) have the method names with spaces leading to this error.

jamadden commented 8 months ago

It's hard to tell because you pasted a PICTURE instead of the ACTUAL TEXT (never do that!) but 1) I don't see any spaces in the names on line 11 or 12 2) Those aren't methods, they're a type.

Chandana2296 commented 8 months ago

Edited the above comment with actual text.

In line No 11, here I can see the spaces in between typeinfo for exception_t , the symbols (complete line) should be without space, you can see line no 10, there the symbol is without spaces PyInit__test_extension_cpp, so no error from line 10.

jamadden commented 8 months ago

I interpret that to mean that this is the symbol of kind typeinfo for the class exception_t, in the same way that the line 12 is the name for that typeinfo. That's something the compiler generates automatically.