Skip to content

pip install fails on AIX #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shubhamhii opened this issue Apr 4, 2025 · 2 comments · May be fixed by #161
Open

pip install fails on AIX #160

shubhamhii opened this issue Apr 4, 2025 · 2 comments · May be fixed by #161

Comments

@shubhamhii
Copy link

Pip install is failing on AIX due to undefined symbol.
Log:

building '_cffi_backend' extension
creating build/temp.aix-7105-9988-64-cpython-39
creating build/temp.aix-7105-9988-64-cpython-39/src
creating build/temp.aix-7105-9988-64-cpython-39/src/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -O2 -Wall -I/opt/freeware/include -I/usr/include -DAIX_GENUINE_CPLUSCPLUS -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT -I/opt/freeware/include -I/usr/include -DAIX_GENUINE_CPLUSCPLUS -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT -maix64 -I/usr/local/include -I/opt/freeware/include -DFFI_BUILDING=1 -DUSE__THREAD -I/opt/freeware/include -I/opt/freeware/include/python3.9 -c src/c/_cffi_backend.c -o build/temp.aix-7105-9988-64-cpython-39/src/c/_cffi_backend.o
src/c/_cffi_backend.c: In function 'cdata_call':
src/c/_cffi_backend.c:3240:30: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'long unsigned int' [-Wsign-compare]
 3240 |         if (fresult->ct_size < sizeof(ffi_arg))
      |                              ^
In file included from src/c/cffi1_module.c:20,
                 from src/c/_cffi_backend.c:8027:
src/c/call_python.c: In function 'cffi_call_python':
src/c/call_python.c:203:28: warning: implicit declaration of function '__lwsync' [-Wimplicit-function-declaration]
  203 | #   define read_barrier()  __lwsync()
      |                            ^~~~~~~~
src/c/call_python.c:252:5: note: in expansion of macro 'read_barrier'
  252 |     read_barrier();
      |     ^~~~~~~~~~~~
/opt/freeware/lib64/python3.9/config-3.9/ld_so_aix gcc -maix64 -fPIC -pthread -O2 -bI:/opt/freeware/lib64/python3.9/config-3.9/python.exp -L/opt/freeware/lib/pthread -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-blibpath:/opt/freeware/lib/pthread:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib -L/opt/freeware/lib/pthread -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-blibpath:/opt/freeware/lib/pthread:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib -L/opt/freeware/lib64 -L/opt/freeware/lib -lgcc -maix64 -I/usr/local/include -I/opt/freeware/include build/temp.aix-7105-9988-64-cpython-39/src/c/_cffi_backend.o -L/opt/freeware/lib64 -L/opt/freeware/lib64 -lffi -o build/lib.aix-7105-9988-64-cpython-39/_cffi_backend.cpython-39.so
ld: 0711-317 ERROR: Undefined symbol: .__lwsync
shubhamhii added a commit to shubhamhii/cffi that referenced this issue Apr 4, 2025
@shubhamhii shubhamhii linked a pull request Apr 4, 2025 that will close this issue
shubhamhii added a commit to shubhamhii/cffi that referenced this issue Apr 4, 2025
@arigo
Copy link
Contributor

arigo commented Apr 4, 2025

This function comes from a block a few lines above that was copied from somewhere long ago:

...
# if defined(HAVE_SYNC_SYNCHRONIZE)
#   define read_barrier()  __sync_synchronize()
# elif defined(_AIX)
#   define read_barrier()  __lwsync()
...

Apparently you're using a C compiler (is that really gcc?) that for some reason doesn't have either __sync_synchronize() nor __lwsync(). Or maybe it does have __sync_synchronize() but the HAVE_SYNC_SYNCHRONIZE is not defined for some reason?

@shubhamhii
Copy link
Author

Hi,

Thanks for the suggestion. By including HAVE_SYNC_SYNCHRONIZE in CFLAGS we are able to build with pip.
However, we are able to build without setting explicitly HAVE_SYNC_SYNCHRONIZE in setup.py build.

Regards,
Shubham

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants