Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building via cmake #216

Closed
wants to merge 1 commit into from

Conversation

marcinsulikowski
Copy link

Commit fdbc543 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 fdbc543 replaced folly::SpinLockGuard with
bare std::unique_lock.

Commit fdbc543 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 fdbc543 replaced `folly::SpinLockGuard` with
bare `std::unique_lock`.
michel-slm referenced this pull request Apr 20, 2021
Summary:
Per D27390136 (fdbc543) / fdbc543, WDT requires
C++17 to build (for the refactor replacing `folly::SpinLockGuard` with
`std::unique_lock`).

Bump the language standard declared in `CMakeLists.txt` so public builds
can succeed.

Reviewed By: davide125

Differential Revision: D27867115

fbshipit-source-id: 38e9237d31b3750647279e9a5e227249923406f5
@davide125
Copy link
Member

I don't think this is needed anymore with 0f100c6

@davide125 davide125 closed this Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants