Linking errors under Ubuntu 20
dbrnz opened this issue · comments
David Brooks commented
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.
Brett Jia commented
Do you see this on MacOS, or just Ubuntu/Linux?
Brett Jia commented
Also, which compiler did you use? gcc/clang/other?
David Brooks commented
Under Ubuntu 20 with gcc -- macOS with clang was fine.
See here for details of the fix.
Brett Jia commented
David Brooks commented
All is good under Ubuntu 20 with your default-source-macro
branch, thanks!