Skip to content
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

Runtime tests can't be run on Linux #1201

Open
mhsmith opened this issue Jul 6, 2024 · 1 comment
Open

Runtime tests can't be run on Linux #1201

mhsmith opened this issue Jul 6, 2024 · 1 comment
Labels

Comments

@mhsmith
Copy link
Member

mhsmith commented Jul 6, 2024

There have been various issues with this over the years, usually caused by differences in the way libpython is linked on Linux vs Mac vs Windows. In 2023 I fixed it on Mac by making runtime/build.gradle run a Python script that prints sys.base_prefix. But the build is still failing on Linux:

> Task :runtime:cmakeBuild-host
[1/4] Building C object CMakeFiles/chaquopy_java.dir/build/cython/chaquopy_java.c.o
[2/4] Linking C shared library libchaquopy_java.so
FAILED: libchaquopy_java.so
: && /usr/bin/cc -fPIC -g   -shared -Wl,-soname,libchaquopy_java.so -o libchaquopy_java.so CMakeFiles/chaquopy_java.dir/build/cython/chaquopy_java.c.o -L/home/smith/.pyenv/versions/3.8.12/lib -Wl,-rpath,/home/smith/.pyenv/versions/3.8.12/lib  -lpython3.8 && :
/usr/bin/ld: /home/smith/.pyenv/versions/3.8.12/lib/libpython3.8.a(abstract.o): relocation R_X86_64_PC32 against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/smith/.pyenv/versions/3.8.12/lib/libpython3.8.a(boolobject.o): relocation R_X86_64_PC32 against symbol `_Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/smith/.pyenv/versions/3.8.12/lib/libpython3.8.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
...
/usr/bin/ld: /home/smith/.pyenv/versions/3.8.12/lib/libpython3.8.a(parser.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/smith/.pyenv/versions/3.8.12/lib/libpython3.8.a(myreadline.o): relocation R_X86_64_PC32 against symbol `_PyOS_ReadlineTState' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status  
@mhsmith mhsmith added the bug label Jul 6, 2024
@mhsmith
Copy link
Member Author

mhsmith commented Jul 6, 2024

In this case it's using libpython3.8.a, but on Linux, Python modules shouldn't be linking against libpython at all.

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

No branches or pull requests

1 participant