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

tdlib fails to compile on Big-endian platforms #319

Open
barracuda156 opened this issue Dec 5, 2024 · 5 comments
Open

tdlib fails to compile on Big-endian platforms #319

barracuda156 opened this issue Dec 5, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@barracuda156
Copy link

Description:
This is not a bug in nchat, it is a bug in tdlib. However, maybe you or someone will be interested to help fixing it. So I will appreciate if this is allowed to be open for the time-being.

[  8%] Building CXX object lib/ncutil/CMakeFiles/ncutil.dir/src/timeutil.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/build/lib/ncutil && ccache /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DHAVE_EXECINFO_H=1 -D_XOPEN_SOURCE_EXTENDED -Dncutil_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../ncutil/src -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../common/src -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../../ext/apathy -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../../ext/sqlite_modern_cpp/hdr -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../../ext/clip -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/../../ext/cereal/include -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++14 -arch ppc -mmacosx-version-min=10.6 -fPIC -Wall -Wextra -Wpedantic -Wshadow -Wpointer-arith                        -Wcast-qual -Wno-missing-braces -Wswitch-default                        -Wunreachable-code -Wundef -Wuninitialized                        -Wcast-align -MD -MT lib/ncutil/CMakeFiles/ncutil.dir/src/timeutil.cpp.o -MF CMakeFiles/ncutil.dir/src/timeutil.cpp.o.d -o CMakeFiles/ncutil.dir/src/timeutil.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/nchat-5.3.5/lib/ncutil/src/timeutil.cpp
/bin/sh: line 1: 39461 Abort trap              /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/build/bin/generate_common
make[2]: *** [lib/tgchat/ext/td/td/generate/CMakeFiles/tl_generate_common] Error 134
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_nchat/nchat/work/build'
make[1]: *** [lib/tgchat/ext/td/td/generate/CMakeFiles/tl_generate_common.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

How to reproduce it:
Try building on a Big-endian platform (AFAIK, Linux or *BSD will do, this is not Darwin-specific bug).

Environment:

  • Version: 10.6
  • OS / distro: macOS
    (However, the issue affects all Big-endian platforms, specific OS is irrelevant.)
@barracuda156 barracuda156 added the bug Something isn't working label Dec 5, 2024
@barracuda156
Copy link
Author

Upstream issue: tdlib/td#364 (but with no solution there)

@d99kris
Copy link
Owner

d99kris commented Dec 18, 2024

Hi @barracuda156 - I have checked the tdlib code a bit now and it's not a trivial fix to add support for big-endian.

There's quite a bit of low-level message packing/parsing, and it's all assuming little-endian / network byte order.

I can leave this issue open for a while for visibility though.

One thing to consider - nchat could auto-disable Telegram support for big-endian platforms (until tdlib adds support) if that would be useful? At least it would allow building nchat out-of-the-box on such platforms.

@barracuda156
Copy link
Author

@d99kris Thank you very much for looking into that, I appreciate it. (If you or someone will ever consider fixing that in tdlib upstream, I will test that, but perhaps it is not something I am able to fix myself, unfortunately.)
Keeping the issue open is worth, IMO, since it is generally relevant (i.e. not only for an old macOS, but for current *BSD and Linux as well).

One thing to consider - nchat could auto-disable Telegram support for big-endian platforms (until tdlib adds support) if that would be useful?

I am note sure WhatsApp part will build on any powerpc (or arm BE, or mips, or sparc), but perhaps it is sensible. On ppc32 without Telegram there is nothing to build, since WhatsApp here needs Go, and Go is broken (it is broken even on not-too-recent macOS x86_64).

P. S. @glaubitz Just in case, have you looked into tdlib, or maybe someone already fixed it in Debian?

@d99kris
Copy link
Owner

d99kris commented Dec 18, 2024

I am note sure WhatsApp part will build on any powerpc (or arm BE, or mips, or sparc), but perhaps it is sensible. On ppc32 without Telegram there is nothing to build, since WhatsApp here needs Go, and Go is broken (it is broken even on not-too-recent macOS x86_64).

I tested on Debian s390x (in qemu) and nchat with WhatsApp builds fine there. So there would be some rationale for disabling tdlib under BE, but yeah I would not expect many actual users on this platform.

@barracuda156
Copy link
Author

barracuda156 commented Dec 19, 2024

@d99kris Re WhatsApp, have you seen this lib? https://github.com/rodarima/libwa
Could it work to drop depending on Go?

UPD. Looks the lib itself needs some fixes now: rodarima/libwa#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants