tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

[FreeBSD Build Issue] ld: error: undefined symbol: my_api::messages_dhConfig::ID #2699

Closed schrodyn closed 11 months ago

schrodyn commented 11 months ago

When building td on FreeBSD 13.2 I get the following error:

[ 92%] Linking CXX executable run_all_tests
cd /home/schrodinger/src/git/td/build/test && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/run_all_tests.dir/link.txt --verbose=1
ccache /usr/bin/c++  -pthread -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wpointer-arith -Wcast-qual -Wsign-compare -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wc++14-compat-pedantic -Wdeprecated -Wno-unused-command-line-argument -Qunused-arguments -Wno-unknown-warning-option -Wodr -g  -Wl,--gc-sections -Wl,--exclude-libs,ALL -fsanitize=undefined -fno-sanitize=vptr CMakeFiles/run_all_tests.dir/main.cpp.o CMakeFiles/run_all_tests.dir/country_info.cpp.o CMakeFiles/run_all_tests.dir/db.cpp.o CMakeFiles/run_all_tests.dir/http.cpp.o CMakeFiles/run_all_tests.dir/link.cpp.o CMakeFiles/run_all_tests.dir/message_entities.cpp.o CMakeFiles/run_all_tests.dir/mtproto.cpp.o CMakeFiles/run_all_tests.dir/poll.cpp.o CMakeFiles/run_all_tests.dir/query_merger.cpp.o CMakeFiles/run_all_tests.dir/secret.cpp.o CMakeFiles/run_all_tests.dir/secure_storage.cpp.o CMakeFiles/run_all_tests.dir/set_with_position.cpp.o CMakeFiles/run_all_tests.dir/string_cleaning.cpp.o CMakeFiles/run_all_tests.dir/tdclient.cpp.o CMakeFiles/run_all_tests.dir/tqueue.cpp.o CMakeFiles/run_all_tests.dir/data.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/bitmask.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/buffer.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/ChainScheduler.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/ConcurrentHashMap.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/crypto.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/emoji.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/Enumerator.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/EpochBasedMemoryReclamation.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/filesystem.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/gzip.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/HazardPointers.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/HashSet.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/heap.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/HttpUrl.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/json.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/List.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/log.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/misc.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/MpmcQueue.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/MpmcWaiter.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/MpscLinkQueue.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/OptionParser.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/OrderedEventsProcessor.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/port.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/pq.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/SharedObjectPool.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/SharedSlice.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/StealingQueue.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/variant.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/WaitFreeHashMap.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/WaitFreeHashSet.cpp.o CMakeFiles/run_all_tests.dir/__/tdutils/test/WaitFreeVector.cpp.o CMakeFiles/run_all_tests.dir/__/tdactor/test/actors_main.cpp.o CMakeFiles/run_all_tests.dir/__/tdactor/test/actors_simple.cpp.o CMakeFiles/run_all_tests.dir/__/tdactor/test/actors_workers.cpp.o CMakeFiles/run_all_tests.dir/__/tdactor/test/actors_bugs.cpp.o -o run_all_tests  ../libtdcore.a ../libtdclient.a ../libtdcore.a ../tdnet/libtdnet.a /usr/lib/libssl.so ../tddb/libtddb.a ../tdactor/libtdactor.a ../sqlite/libtdsqlite.a ../libtdapi.a ../tdutils/libtdutils.a /usr/lib/libcrypto.so /usr/lib/libz.so -pthread
ld: error: undefined symbol: my_api::messages_dhConfig::ID
>>> referenced by utils.h:32 (/home/schrodinger/src/git/td/td/mtproto/utils.h:32)
>>>               CMakeFiles/run_all_tests.dir/secret.cpp.o:(td::TLObjectStorer<my_api::messages_dhConfig>::size() const)
>>> referenced by utils.h:40 (/home/schrodinger/src/git/td/td/mtproto/utils.h:40)
>>>               CMakeFiles/run_all_tests.dir/secret.cpp.o:(td::TLObjectStorer<my_api::messages_dhConfig>::store(unsigned char*) const)

ld: error: undefined symbol: my_api::encryptedChat::ID
>>> referenced by utils.h:32 (/home/schrodinger/src/git/td/td/mtproto/utils.h:32)
>>>               CMakeFiles/run_all_tests.dir/secret.cpp.o:(td::TLObjectStorer<my_api::encryptedChat>::size() const)
>>> referenced by utils.h:40 (/home/schrodinger/src/git/td/td/mtproto/utils.h:40)
>>>               CMakeFiles/run_all_tests.dir/secret.cpp.o:(td::TLObjectStorer<my_api::encryptedChat>::store(unsigned char*) const)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [test/CMakeFiles/run_all_tests.dir/build.make:925: test/run_all_tests] Error 1
gmake[2]: Leaving directory '/usr/home/schrodinger/src/git/td/build'
gmake[1]: *** [CMakeFiles/Makefile2:1321: test/CMakeFiles/run_all_tests.dir/all] Error 2
gmake[1]: Leaving directory '/usr/home/schrodinger/src/git/td/build'
gmake: *** [Makefile:146: all] Error 2

Following the build instructions for Go and FreeBSD here:

https://tdlib.github.io/td/build.html?language=Go

Here is a gist of the current steps to reproduce and build system information:

https://gist.github.com/schrodyn/9824727d211f93f69c2075b25bdfdaaf

schrodyn commented 11 months ago

Just to update, I was able to successfully build v1.8.0.

[100%] Building CXX object benchmark/CMakeFiles/bench_queue.dir/bench_queue.cpp.o
cd /home/schrodinger/src/td-1.8.0/build/benchmark && ccache /usr/bin/c++ -D_FILE_OFFSET_BITS=64 -I/home/schrodinger/src/td-1.8.0/tdutils -I/home/schrodinger/src/td-1.8.0/build/tdutils -pthread -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wpointer-arith -Wcast-qual -Wsign-compare -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wc++14-compat-pedantic -Wdeprecated -Wno-unused-command-line-argument -Qunused-arguments -Wodr -g -fPIE -Wno-deprecated-declarations -MD -MT benchmark/CMakeFiles/bench_queue.dir/bench_queue.cpp.o -MF CMakeFiles/bench_queue.dir/bench_queue.cpp.o.d -o CMakeFiles/bench_queue.dir/bench_queue.cpp.o -c /home/schrodinger/src/td-1.8.0/benchmark/bench_queue.cpp
[100%] Linking CXX executable bench_queue
cd /home/schrodinger/src/td-1.8.0/build/benchmark && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/bench_queue.dir/link.txt --verbose=1
ccache /usr/bin/c++  -pthread -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wpointer-arith -Wcast-qual -Wsign-compare -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wc++14-compat-pedantic -Wdeprecated -Wno-unused-command-line-argument -Qunused-arguments -Wodr -g  -Wl,--gc-sections -Wl,--exclude-libs,ALL CMakeFiles/bench_queue.dir/bench_queue.cpp.o -o bench_queue  ../tdutils/libtdutils.a -pthread /usr/lib/libcrypto.so /usr/lib/libz.so
gmake[2]: Leaving directory '/usr/home/schrodinger/src/td-1.8.0/build'
[100%] Built target bench_queue
gmake[1]: Leaving directory '/usr/home/schrodinger/src/td-1.8.0/build'
/usr/local/bin/cmake -E cmake_progress_start /home/schrodinger/src/td-1.8.0/build/CMakeFiles 0
/usr/local/bin/gmake  -f CMakeFiles/Makefile2 preinstall
gmake[1]: Entering directory '/usr/home/schrodinger/src/td-1.8.0/build'
gmake[1]: Nothing to be done for 'preinstall'.
gmake[1]: Leaving directory '/usr/home/schrodinger/src/td-1.8.0/build'
Install the project...
/usr/local/bin/cmake -P cmake_install.cmake
-- Install configuration: "Debug"
-- Installing: /usr/local/lib/libtdjson.so.1.8.0
-- Installing: /usr/local/lib/libtdjson.so
-- Installing: /usr/local/lib/libtdjson_static.a
-- Installing: /usr/local/lib/libtdjson_private.a
-- Installing: /usr/local/lib/libtdclient.a
-- Installing: /usr/local/lib/libtdcore.a
-- Installing: /usr/local/lib/libtdapi.a
-- Installing: /usr/local/lib/pkgconfig/tdutils.pc
-- Installing: /usr/local/lib/pkgconfig/tdactor.pc
-- Installing: /usr/local/lib/pkgconfig/tdnet.pc
-- Installing: /usr/local/lib/pkgconfig/tdsqlite.pc
-- Installing: /usr/local/lib/pkgconfig/tddb.pc
-- Installing: /usr/local/lib/pkgconfig/tdcore.pc
-- Installing: /usr/local/lib/pkgconfig/tdclient.pc
-- Installing: /usr/local/lib/pkgconfig/tdapi.pc
-- Installing: /usr/local/lib/pkgconfig/tdjson_private.pc
-- Installing: /usr/local/lib/pkgconfig/tdjson.pc
-- Installing: /usr/local/lib/pkgconfig/tdjson_static.pc
-- Installing: /usr/local/lib/cmake/Td/TdTargets.cmake
-- Installing: /usr/local/lib/cmake/Td/TdTargets-debug.cmake
-- Installing: /usr/local/include/td/telegram/td_json_client.h
-- Installing: /usr/local/include/td/telegram/td_log.h
-- Installing: /usr/local/include/td/telegram/tdjson_export.h
-- Installing: /usr/local/include/td/telegram/Client.h
-- Installing: /usr/local/include/td/telegram/Log.h
-- Installing: /usr/local/include/td/tl/TlObject.h
-- Installing: /usr/local/include/td/telegram/td_api.h
-- Installing: /usr/local/include/td/telegram/td_api.hpp
-- Installing: /usr/local/lib/cmake/Td/TdConfig.cmake
-- Installing: /usr/local/lib/cmake/Td/TdConfigVersion.cmake
-- Installing: /usr/local/lib/libtdutils.a
-- Installing: /usr/local/lib/libtdactor.a
-- Installing: /usr/local/lib/libtdnet.a
-- Installing: /usr/local/lib/libtdsqlite.a
-- Installing: /usr/local/lib/libtddb.a
levlam commented 11 months ago

Thank you for detailed report. I have pushed a fix to master.