stlab / libraries

ASL libraries will be migrated here in the stlab namespace, new libraries will be created here.
https://stlab.cc
Boost Software License 1.0
660 stars 65 forks source link

Build Error for Portable Executor for c++14 #501

Closed aaronalbers closed 1 year ago

aaronalbers commented 1 year ago

There is a build error when building the library for c++14 using Boost shims and the portable executor. This is happening because the copy constructor of the portable task system is implicitly deleted and copy elision is not guaranteed in c++14.

aaronalbers@Aarons-MacBook-Pro stlab_fork % cmake -S . -B ../BUILD -DCMAKE_CXX_STANDARD=14 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DSTLAB_TASK_SYSTEM=portable -DSTLAB_USE_BOOST_CPP17_SHIMS=ON   
CMake Warning at CMakeLists.txt:13 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:

    Qt6Config.cmake
    qt6-config.cmake

  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.

-- stlab: Use Boost C++17 Shims: ON
-- stlab: Disable Coroutines: TRUE
-- stlab: Thread System: pthread-apple
-- stlab: Task System: portable
-- stlab: Main Executor: libdispatch
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/aaronalbers/git/BUILD
aaronalbers@Aarons-MacBook-Pro stlab_fork % cd ..
aaronalbers@Aarons-MacBook-Pro git % cd BUILD 
aaronalbers@Aarons-MacBook-Pro BUILD % cmake --build .                                                                                                                                                     
Consolidate compiler generated dependencies of target stlab.test.channel
[  2%] Building CXX object test/CMakeFiles/stlab.test.channel.dir/channel_functor_tests.cpp.o
In file included from /Users/aaronalbers/git/stlab_fork/test/channel_functor_tests.cpp:12:
/Users/aaronalbers/git/stlab_fork/stlab/concurrency/default_executor.hpp:436:16: error: call to implicitly-deleted copy constructor of 'stlab::detail::priority_task_system'
        return priority_task_system{};
               ^~~~~~~~~~~~~~~~~~~~~~
/Users/aaronalbers/git/stlab_fork/stlab/concurrency/default_executor.hpp:332:27: note: copy constructor of 'priority_task_system' is implicitly deleted because field '_index' has a deleted copy constructor
    std::atomic<unsigned> _index{0};
                          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1816:7: note: copy constructor of 'atomic<unsigned int>' is implicitly deleted because base class '__atomic_base<unsigned int>' has a deleted copy constructor
    : public __atomic_base<_Tp>
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1733:7: note: copy constructor of '__atomic_base<unsigned int, true>' is implicitly deleted because base class '__atomic_base<unsigned int, false>' has a deleted copy constructor
    : public __atomic_base<_Tp, false>
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1716:5: note: '__atomic_base' has been explicitly marked deleted here
    __atomic_base(const __atomic_base&) = delete;
    ^
In file included from /Users/aaronalbers/git/stlab_fork/test/channel_functor_tests.cpp:12:
/Users/aaronalbers/git/stlab_fork/stlab/concurrency/default_executor.hpp:432:33: error: call to implicitly-deleted copy constructor of 'stlab::detail::priority_task_system'
    static priority_task_system only_task_system{[]{
                                ^               ~~~~
/Users/aaronalbers/git/stlab_fork/stlab/concurrency/default_executor.hpp:332:27: note: copy constructor of 'priority_task_system' is implicitly deleted because field '_index' has a deleted copy constructor
    std::atomic<unsigned> _index{0};
                          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1816:7: note: copy constructor of 'atomic<unsigned int>' is implicitly deleted because base class '__atomic_base<unsigned int>' has a deleted copy constructor
    : public __atomic_base<_Tp>
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1733:7: note: copy constructor of '__atomic_base<unsigned int, true>' is implicitly deleted because base class '__atomic_base<unsigned int, false>' has a deleted copy constructor
    : public __atomic_base<_Tp, false>
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/atomic:1716:5: note: '__atomic_base' has been explicitly marked deleted here
    __atomic_base(const __atomic_base&) = delete;
    ^
2 errors generated.
make[2]: *** [test/CMakeFiles/stlab.test.channel.dir/channel_functor_tests.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/stlab.test.channel.dir/all] Error 2
make: *** [all] Error 2
sean-parent commented 1 year ago

Marking as fixed.