d99kris / nchat

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

Problem with Ncurses linking in Ubuntu 16.04 #28

Closed EmelyanenkoK closed 4 years ago

EmelyanenkoK commented 4 years ago

During building I get the following problem:

[ 98%] Building CXX object CMakeFiles/nchat.dir/src/uicommon.cpp.o
[ 98%] Building CXX object CMakeFiles/nchat.dir/src/uidefault.cpp.o
[ 98%] Building CXX object CMakeFiles/nchat.dir/src/uilite.cpp.o
[100%] Building CXX object CMakeFiles/nchat.dir/src/util.cpp.o
[100%] Linking CXX executable bin/nchat
CMakeFiles/nchat.dir/src/uicommon.cpp.o: In function `UiCommon::RedrawInputWin()':
uicommon.cpp:(.text+0x4455): undefined reference to `waddnwstr'
CMakeFiles/nchat.dir/src/uicommon.cpp.o: In function `UiCommon::RedrawOutputWin()':
uicommon.cpp:(.text+0x4c99): undefined reference to `waddnwstr'
uicommon.cpp:(.text+0x53f7): undefined reference to `waddnwstr'
uicommon.cpp:(.text+0x542a): undefined reference to `waddnwstr'
CMakeFiles/nchat.dir/src/uicommon.cpp.o: In function `UiCommon::Run()':
uicommon.cpp:(.text+0x6b6d): undefined reference to `wget_wch'
CMakeFiles/nchat.dir/src/uidefault.cpp.o: In function `UiDefault::RedrawContactWin()':
uidefault.cpp:(.text+0x900): undefined reference to `waddnwstr'
collect2: error: ld returned 1 exit status
CMakeFiles/nchat.dir/build.make:341: recipe for target 'bin/nchat' failed
make[2]: *** [bin/nchat] Error 1
CMakeFiles/Makefile2:73: recipe for target 'CMakeFiles/nchat.dir/all' failed
make[1]: *** [CMakeFiles/nchat.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Googling says that it is related to problem with linking ncurses. Low memory way of compilation is used (with SplitSource.php). The problem occur both with gcc and clang. I'm using Ubuntu 16.04. Currently I have the following version libncursesw5-dev installed.

Package: libncursesw5-dev
Version: 6.0+20160213-1ubuntu1
d99kris commented 4 years ago

I set up an Ubuntu 16.04 system now and tested. It appears Ubuntu 16.04 comes with CMake 3.5, while nchat needs a feature in CMake >= 3.10 to correctly detect the wide-version of the dependency libncursesw.

If possible, try upgrading CMake to a version >= 3.10, alternatively as a workaround you can change the following line in CMakeLists.txt: target_link_libraries(nchat PUBLIC tdclientshared ${CURSES_NCURSES_LIBRARY}) to: target_link_libraries(nchat PUBLIC tdclientshared ncursesw) and try build again.

For my own reference; previously encountered in #13.

EmelyanenkoK commented 4 years ago

Thanks, trying CMakeLists.txt update right now.

EmelyanenkoK commented 4 years ago

target_link_libraries update works. Thanks again!