ton-blockchain / ton

Main TON monorepo
Other
2.95k stars 891 forks source link

rocksdb::CreateIOUring() undefined references #456

Open 2ico opened 2 years ago

2ico commented 2 years ago

Expected: Successful build of the ton toolchain.

Actual behavior:

[100%] Linking CXX executable fift
/usr/bin/ld: ../third-party/rocksdb/librocksdb.a(fs_posix.cc.o): in function `rocksdb::CreateIOUring()':
/home/george/Documents/TON/ton-spycheese/third-party/rocksdb/env/io_posix.h:163: undefined reference to `io_uring_queue_init'
/usr/bin/ld: ../third-party/rocksdb/librocksdb.a(io_posix.cc.o): in function `io_uring_wait_cqe_nr':
/usr/include/liburing.h:985: undefined reference to `__io_uring_get_cqe'
/usr/bin/ld: ../third-party/rocksdb/librocksdb.a(io_posix.cc.o): in function `rocksdb::PosixRandomAccessFile::MultiRead(rocksdb::FSReadRequest*, unsigned long, rocksdb::IOOptions const&, rocksdb::IODebugContext*)':
/home/george/Documents/TON/ton-spycheese/third-party/rocksdb/env/io_posix.cc:686: undefined reference to `io_uring_submit_and_wait'
collect2: error: ld returned 1 exit status
make[3]: *** [crypto/CMakeFiles/fift.dir/build.make:142: crypto/fift] Error 1
make[2]: *** [CMakeFiles/Makefile2:9055: crypto/CMakeFiles/fift.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:9062: crypto/CMakeFiles/fift.dir/rule] Error 2
make: *** [Makefile:2558: fift] Error 2
$ sudo ldconfig -v | grep uring
liburing.so.2 -> liburing.so.2.2

To reproduce: cmake --build . --target fift Follow the steps on https://ton.org/docs/#/compile?id=how-to-compile

Version: Self-compiled from tesnet branch. I've also tried master and the SpyCheese fork.

OS: 5.10.136-1-MANJARO #1 SMP PREEMPT Thu Aug 11 13:14:01 UTC 2022 x86_64 GNU/Linux

awesome-doge commented 1 year ago

This operating system looks interesting 0.0 https://manjaro.org/

Looks like a kind of Arch Linux Maybe you can try to install these dependencies

pacman -S --noconfirm git make cmake clang gflags zlib openssl readline libmicrohttpd python python-pip
samgiz commented 1 year ago

I got the exact same issue on Arch Linux, the issue is that the uring library is not being linked. Didn't look at the code so I'm not sure why this is an issue on Arch and not on Ubuntu, but the following patch fixes the issue for fift specifically:

--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -294,7 +294,7 @@ target_link_libraries(fift-lib PUBLIC ton_crypto ton_db tdutils ton_block)
 set_target_properties(fift-lib PROPERTIES OUTPUT_NAME fift)

 add_executable(fift fift/fift-main.cpp)
-target_link_libraries(fift PUBLIC fift-lib git)
+target_link_libraries(fift PUBLIC fift-lib git uring)
 if (WINGETOPT_FOUND)
   target_link_libraries_system(fift wingetopt)
 endif()

That being said, there's many targets that fail to build without uring, and also a few that require gsl and gslcblas. I can share a PR that fixes all the targets on Arch if that's desirable, and someone who's more familiar with the code could then take a look at what's going on.