bjia56 / portable-python-cmake-buildsystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linking errors under Ubuntu 20

dbrnz opened this issue · comments

My first attempt building under Ubuntu 20 resulted in:

/usr/bin/ld: lib/libpython3.12.so: undefined reference to `be64toh'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `le64toh'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `htobe32'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `htobe64'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `be32toh'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `le32toh'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `htole64'
/usr/bin/ld: lib/libpython3.12.so: undefined reference to `htole32'

The fix is to set -D_DEFAULT_SOURCE in CMAKE_C_FLAGS. The compile then succeeds with the build subsequently failing because of issue #9.

Do you see this on MacOS, or just Ubuntu/Linux?

Also, which compiler did you use? gcc/clang/other?

Under Ubuntu 20 with gcc -- macOS with clang was fine.

See here for details of the fix.

Hi @dbrnz, if you get a chance can you please test if #13 resolves the issue? The CMake definitions in this repo now add that macro when GCC is detected.

All is good under Ubuntu 20 with your default-source-macro branch, thanks!