d99kris / nchat

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

Error building from downloaded release zip/tar archive #88

Closed 2011 closed 1 year ago

2011 commented 1 year ago

Description:

Had no problem compiling 2.76, but 3.17 produces several errors.

The (I hope) relevant parts of CMakeFiles/CMakeError.log:

Performing C++ SOURCE FILE Test HAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC failed with the following output:
Change Dir: /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-VX9uDE

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_c81cb/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_c81cb.dir/build.make CMakeFile
s/cmTC_c81cb.dir/build
gmake[1]: Entering directory '/tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-VX9uDE'
Building CXX object CMakeFiles/cmTC_c81cb.dir/src.cxx.o
/usr/bin/c++ -DHAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC  -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 -Wc++14-compat-pedantic   -Wc++14-compat-pedantic -std=gnu++14 -o CMakeFiles/cmTC_c81cb.dir/src.cxx.o -c /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-VX9uDE/src.cxx
c++: error: unrecognized command-line option '-Wc++14-compat-pedantic'
c++: error: unrecognized command-line option '-Wc++14-compat-pedantic'
gmake[1]: *** [CMakeFiles/cmTC_c81cb.dir/build.make:78: CMakeFiles/cmTC_c81cb.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-VX9uDE'
gmake: *** [Makefile:127: cmTC_c81cb/fast] Error 2

Source file was:
int main() { return 0; }

Performing C++ SOURCE FILE Test HAVE_CXX_FLAG_WUNUSED_COMMAND_LINE_ARGUMENT failed with the following output:
Change Dir: /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-KctSrU

[...]

c++: error: unrecognized command-line option '-Wunused-command-line-argument'; did you mean '-Wunused-dummy-argument'?

[...]

Performing C++ SOURCE FILE Test HAVE_CXX_FLAG_QUNUSED_ARGUMENTS failed with the following output:
Change Dir: /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-eso4cu

[...]

c++: error: unrecognized command-line option '-Qunused-arguments'
c++: error: unrecognized command-line option '-Qunused-arguments'

[...]

Determining if the function cbreak exists in the /usr/lib64/libncursesw.so failed with the following output:
Change Dir: /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-YCEhjc

[...]

Determining if the function nodelay exists in the /usr/lib64/libncursesw.so failed with the following output:
Change Dir: /tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeScratch/TryCompile-OiBKLg

I don't have much knowledge or experience with cmake, so apologies in advance if I missed something obvious.

How to reproduce it:

$ mkdir cmakebuild/
$ cd cmakebuild/
$ cmake ../

Environment:

d99kris commented 1 year ago

Hi @2011 - the output in CMakeFiles/CMakeError.log might not be that important. It's common for it to contain "errors" as cmake determines the capabilities of the compiler and toolchain.

Can I check what output you see on the terminal when running cmake? Ideally if you could share the entire output, running something like cmake .. &> log.txt and attaching log.txt here, it would be great. But it's possible that just the last output/error message would be sufficient.

d99kris commented 1 year ago

Hi again - I tested on Gentoo amd64 LiveGUI USB Image 2023-03-07 and the cmake step runs fine here.

Btw, If you are building from an old git clone that you updated (git pull), you could try deleting old build files using:

git clean -ffdx

And then try build again. Generally it should be fine to update and building without cleaning, but there can sometimes be issues between versions when third-party libraries have been updated.

2011 commented 1 year ago

Hi @2011 - the output in CMakeFiles/CMakeError.log might not be that important. It's common for it to contain "errors" as cmake determines the capabilities of the compiler and toolchain.

I don't know cmake well enough to recognize non-fatal errors, but the second gap (output in red that includes "Call Stack") led me to believe that something didn't work.

Can I check what output you see on the terminal when running cmake? Ideally if you could share the entire output, running something like cmake .. &> log.txt and attaching log.txt here, it would be great. But it's possible that just the last output/error message would be sufficient.

No problem (thanks for the quick reply).

Btw, If you are building from an old git clone that you updated (git pull), you could try deleting old build files using:

I downloaded the latetest release, and unpacked it in a net directory.

$ cmake ../
-- The CXX compiler identification is GNU 12.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using build type 'Release' (default).
-- Dummy: ON
-- Telegram: ON
-- WhatsApp: ON
-- Dynamic Load: ON
bash: line 1: go: command not found
CMake Warning at CMakeLists.txt:61 (message):
  Go version (need v1.16 to build WhatsApp).

-- Found SQLite3: /usr/include (found version "3.40.1") 
-- Performing Test HAVE_BUILTIN_ATOMIC
-- Performing Test HAVE_BUILTIN_ATOMIC - Success
-- Using built-in atomic.
-- The C compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find ccache (this is NOT an error)
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.1.1t")  
-- Found OpenSSL: /usr/include /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STD14
-- Performing Test HAVE_STD14 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WIMPLICIT_FALLTHROUGH_2
-- Performing Test HAVE_CXX_FLAG_WIMPLICIT_FALLTHROUGH_2 - Success
-- Performing Test HAVE_CXX_FLAG_WPOINTER_ARITH
-- Performing Test HAVE_CXX_FLAG_WPOINTER_ARITH - Success
-- Performing Test HAVE_CXX_FLAG_WCAST_QUAL
-- Performing Test HAVE_CXX_FLAG_WCAST_QUAL - Success
-- Performing Test HAVE_CXX_FLAG_WSIGN_COMPARE
-- Performing Test HAVE_CXX_FLAG_WSIGN_COMPARE - Success
-- Performing Test HAVE_CXX_FLAG_WDUPLICATED_BRANCHES
-- Performing Test HAVE_CXX_FLAG_WDUPLICATED_BRANCHES - Success
-- Performing Test HAVE_CXX_FLAG_WDUPLICATED_COND
-- Performing Test HAVE_CXX_FLAG_WDUPLICATED_COND - Success
-- Performing Test HAVE_CXX_FLAG_WALLOC_ZERO
-- Performing Test HAVE_CXX_FLAG_WALLOC_ZERO - Success
-- Performing Test HAVE_CXX_FLAG_WLOGICAL_OP
-- Performing Test HAVE_CXX_FLAG_WLOGICAL_OP - Success
-- Performing Test HAVE_CXX_FLAG_WTAUTOLOGICAL_COMPARE
-- Performing Test HAVE_CXX_FLAG_WTAUTOLOGICAL_COMPARE - Success
-- Performing Test HAVE_CXX_FLAG_WVLA
-- Performing Test HAVE_CXX_FLAG_WVLA - Success
-- Performing Test HAVE_CXX_FLAG_WNON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_FLAG_WNON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_FLAG_WUNUSED_PARAMETER
-- Performing Test HAVE_CXX_FLAG_WUNUSED_PARAMETER - Success
-- Performing Test HAVE_CXX_FLAG_WCONVERSION
-- Performing Test HAVE_CXX_FLAG_WCONVERSION - Success
-- Performing Test HAVE_CXX_FLAG_WSIGN_CONVERSION
-- Performing Test HAVE_CXX_FLAG_WSIGN_CONVERSION - Success
-- Performing Test HAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC - Failed
-- Performing Test HAVE_CXX_FLAG_WDEPRECATED
-- Performing Test HAVE_CXX_FLAG_WDEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WUNUSED_COMMAND_LINE_ARGUMENT
-- Performing Test HAVE_CXX_FLAG_WUNUSED_COMMAND_LINE_ARGUMENT - Failed
-- Performing Test HAVE_CXX_FLAG_QUNUSED_ARGUMENTS
-- Performing Test HAVE_CXX_FLAG_QUNUSED_ARGUMENTS - Failed
-- Performing Test HAVE_CXX_FLAG_WODR
-- Performing Test HAVE_CXX_FLAG_WODR - Success
-- Performing Test HAVE_CXX_FLAG_FLTO_ODR_TYPE_MERGING
-- Performing Test HAVE_CXX_FLAG_FLTO_ODR_TYPE_MERGING - Success
-- Performing Test HAVE_CXX_FLAG_WMAYBE_UNINITIALIZED
-- Performing Test HAVE_CXX_FLAG_WMAYBE_UNINITIALIZED - Success
-- Performing Test HAVE_CXX_FLAG_WREDUNDANT_MOVE
-- Performing Test HAVE_CXX_FLAG_WREDUNDANT_MOVE - Success
-- Performing Test HAVE_CXX_FLAG_WSTRINGOP_OVERFLOW
-- Performing Test HAVE_CXX_FLAG_WSTRINGOP_OVERFLOW - Success
CMake Error at lib/tgchat/ext/td/CMake/GetGitRevisionDescription.cmake:61 (file):
  file RELATIVE_PATH must be passed a full path to the file:
Call Stack (most recent call first):
  lib/tgchat/ext/td/CMakeLists.txt:156 (get_git_head_revision)

-- Git state: 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.13") 
-- Found ZLIB: /usr/include /usr/lib64/libz.so
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Performing Test GNU_READLINE_FOUND
-- Performing Test GNU_READLINE_FOUND - Success
-- Found Readline: /usr/include  
-- Found Readline: /usr/include /usr/lib64/libreadline.so
-- Performing Test USABLE_READLINE_FOUND
-- Performing Test USABLE_READLINE_FOUND - Success
-- Looking for include file xcb/xcb.h
-- Looking for include file xcb/xcb.h - found
-- Looking for include file png.h
-- Looking for include file png.h - found
-- Looking for cbreak in /usr/lib64/libncursesw.so
-- Looking for cbreak in /usr/lib64/libncursesw.so - not found
-- Looking for nodelay in /usr/lib64/libncursesw.so
-- Looking for nodelay in /usr/lib64/libncursesw.so - not found
-- Found Curses: /usr/lib64/libncursesw.so  
-- Using fallback man dir: /usr/local/man
-- Configuring incomplete, errors occurred!
See also "/tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeOutput.log".
See also "/tmp/nchat-3.17/cmakebuild/CMakeFiles/CMakeError.log".
d99kris commented 1 year ago

Thanks for providing the additional details 👍

Looks like there's an issue when building from a downloaded file archive (zip/tar), while if you use a git clone it builds fine. As a workaround you can try git clone https://github.com/d99kris/nchat

It's the third-party library tdlib that now appears to need to be built from a git clone. I will look into fixing it.

d99kris commented 1 year ago

This should be fixed in above commit. One can download latest master as a file archive from https://github.com/d99kris/nchat/archive/refs/heads/master.zip and extract and build it.

The fix will be included in the next release planned for end-March (the project is on a quarterly release cycle).

Thanks for reporting this! 👍 Let me know if you still encounter issues.