d99kris / nchat

Terminal-based Telegram / WhatsApp client for Linux and macOS
MIT License
670 stars 47 forks source link

Build error at MessagesManager.cpp.o #301

Open retroflexivity opened 2 days ago

retroflexivity commented 2 days ago

Hi,

An error occurs while building on Arch.

The log is

[400/522] Building CXX object lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/MessagesManager.cpp.o
FAILED: lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/MessagesManager.cpp.o 
/usr/bin/c++ -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/td/generate/auto -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/tdnet -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/tdutils -I/home/retroflexivity/.cache/yay/nchat-git/src/build/lib/tgchat/ext/td/tdutils -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/tdactor -I/home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/tddb -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wimplicit-fallthrough=2 -Wpointer-arith -Wcast-qual -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Walloc-zero -Wlogical-op -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wdeprecated -Wodr -flto-odr-type-merging -Wno-psabi -Wno-maybe-uninitialized -Wno-redundant-move -Wno-stringop-overflow -std=gnu++14 -fPIC -MD -MT lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/MessagesManager.cpp.o -MF lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/MessagesManager.cpp.o.d -o lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/MessagesManager.cpp.o -c /home/retroflexivity/.cache/yay/nchat-git/src/nchat/lib/tgchat/ext/td/td/telegram/MessagesManager.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[409/522] Building CXX object lib/tgchat/ext/td/CMakeFiles/tdcore.dir/td/telegram/NotificationManager.cpp.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: nchat-git-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
nchat-git - exit status 4

I have no idea what it means, but I'll be glad to provide more details.

Environment:

d99kris commented 1 day ago

Hi @retroflexivity - can I check how much RAM your system has?

For the Telegram protocol nchat used the official tdlib which requires a bit of RAM - around ~3.5GB RAM to build using G++ and ~1.5GB RAM with clang++. If your RAM is around those sizes please see Building on Low Memory / RAM Systems or if you're only interested in WhatsApp support, you can disable Telegram protocol altogether - see Feature Flags.

retroflexivity commented 1 day ago

It has 8 GB, I guess this should be enough? But I'll try

The manual for Arch says I should Change the_install_modetoslow``, but I don't see the parameter in PKGBUILD. Where do I put it?

d99kris commented 1 day ago

8 GB should be enough, then it's not likely to be a memory problem, so ignore those suggestions I shared in the previous reply.

d99kris commented 1 day ago

What command are you using to build / install nchat btw?

retroflexivity commented 1 day ago

I've tried yay -S and makepkg -s. In fact, RAM usage does seem to reach 100%.

d99kris commented 1 day ago

Is that yay -S nchat-git or yay -S nchat?

I suspect there could be some issue with the Arch packaging build script, I am not maintaining that myself, but I can try check its code.

If you need a quick workaround, building from source may work:

git clone https://github.com/d99kris/nchat && cd nchat
./make.sh deps
./make.sh build && ./make.sh install

The reason being that the source build script make.sh tries to adjust the build memory usage based on system RAM and compiler in use.

retroflexivity commented 1 day ago

Is that yay -S nchat-git or yay -S nchat?

I'm pretty certain I've tried both.

I've just built it from source, it worked fine. Thank you

d99kris commented 21 hours ago

I've just built it from source, it worked fine. Thank you

Good to hear! 👍

I'll leave this issue open until I've checked if the AUR package PKGBUILD script can be updated to fix this.

MNkoder commented 16 hours ago

hey! which one is more updated? the git one should be the latest and most upto-date right? but looks like the non git version is more updated? can you guide me on that? I'm talking about the aur packages btw

d99kris commented 16 hours ago

nchat-git is the latest yes, it uses head of master branch from this source repository.

nchat points to current stable release (generally released at the end of each quarter).

I am not 100% sure about Arch Linux AUR packaging, but I believe the Last Updated fields in their respective pages (nchat and nchat-git) refers to when the package "formula" was updated. For nchat I suspect it needs to be updated for every new stable release, but for nchat-git it always points to just "latest", so it seldom needs to be updated (unless say the dependencies of nchat upstream has changed).

MNkoder commented 15 hours ago

ah no worries, i was just confused as the git package showed v4.5 and stable showed v5.2

MNkoder commented 15 hours ago

also i just installed the git package and didnt face any error

d99kris commented 13 hours ago

also i just installed the git package and didnt face any error

Ok thanks for the data point. The out of memory issue encountered by the OP is due to having less than 3.5 GB RAM per logical CPU core (or thread), required by tdlib (a nchat dependency). The AUR package scripts do not take into account this memory requirement. I'll check with the package maintainers if we can add handling for it.

MNkoder commented 12 hours ago

weirdly enough my laptop also has 8 gb ram just like op, but idk about the cpu tho, mine might be better?

retroflexivity commented 9 hours ago

mine is i5-1135G7