facebook / wdt

Warp speed Data Transfer (WDT) is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths.
https://www.facebook.com/WdtOpenSource
Other
2.86k stars 392 forks source link

Fix building via cmake #216

Closed marcinsulikowski closed 3 years ago

marcinsulikowski commented 3 years ago

Commit fdbc543223 adds code that relies on C++17-only class template argument deduction to wdt. However, CMakeLists.txt specifies the C++ standard used by the project as set(CMAKE_CXX_STANDARD 14). As a result, the project can no longer be built by following the steps from the project's documentation because the compilation fails with an error:

[ 36%] Building CXX object CMakeFiles/wdt_min.dir/util/FileCreator.cpp.o
In file included from wdt/util/FileCreator.cpp:9:0:
wdt/util/FileCreator.h: In member function ‘void facebook::wdt::FileCreator::clearAllocationMap()’:
wdt/util/FileCreator.h:81:22: error: missing template arguments before ‘guard’
     std::unique_lock guard(lock_);
                      ^~~~~
wdt/util/FileCreator.cpp: In member function ‘int facebook::wdt::FileCreator::openForFirstBlock(facebook::wdt::ThreadCtx&, const facebook::wdt::BlockDetails*)’:
wdt/util/FileCreator.cpp:98:22: error: missing template arguments before ‘guard’
     std::unique_lock guard(lock_);
                      ^~~~~
wdt/util/FileCreator.cpp: In member function ‘bool facebook::wdt::FileCreator::waitForAllocationFinish(int, int64_t)’:
wdt/util/FileCreator.cpp:113:24: error: missing template arguments before ‘guard’
       std::unique_lock guard(lock_);
                        ^~~~~
CMakeFiles/wdt_min.dir/build.make:206: recipe for target 'CMakeFiles/wdt_min.dir/util/FileCreator.cpp.o' failed
make[2]: *** [CMakeFiles/wdt_min.dir/util/FileCreator.cpp.o] Error 1
CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/wdt_min.dir/all' failed
make[1]: *** [CMakeFiles/wdt_min.dir/all] Error 2

We fix the issue by providing explicit template argument for std::unique_lock where fdbc543223 replaced folly::SpinLockGuard with bare std::unique_lock.

davide125 commented 3 years ago

I don't think this is needed anymore with https://github.com/facebook/wdt/commit/0f100c6f38220378fcfbc672b007f4272c416a03