I'm trying to build a minimal Cobalt library sample. I'm getting link errors:
Build and installed Boost with:
./bootstrap.sh --prefix=$HOME/.local
./b2 install
Sample:
#include
CMake doesn't support cobalt (even the latest cmake 3.28.1 doesn't support it). On 12/21/23 22:29, Josué Andrade Gomes via Boost-users wrote:
cmake_minimum_required(VERSION 3.20) project(coro_study)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_VERBOSE_MAKEFILE ON)
set(Boost_VERBOSE 1) set(Boost_DEBUG 1)
find_package(Boost REQUIRED COMPONENTS system)
add_executable(sample sample.cpp)
target_include_directories(sample4 PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(sample4 PRIVATE ${Boost_LIBRARIES})
Same error when building manually:
$ g++ -I~/.local/include -L~/.local/lib -o sample ../sample4.cpp
-std=c++20 -fcoroutines -lboost_system
/usr/bin/ld: /tmp/ccr6j1MG.o: in function `co_main(co_main(int,
char**)::_Z7co_mainiPPc.Frame*) [clone .actor]':
sample4.cpp:(.text+0x2a9): undefined reference to
`boost::cobalt::detail::main_promise::final_suspend()'
/usr/bin/ld: /tmp/ccr6j1MG.o: in function
`main::reset_res::operator()(std::pmr::memory_resource*)':
sample4.cpp:(.text._ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE[_ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE]+0x1c):
undefined reference to
`boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)'
/usr/bin/ld: /tmp/ccr6j1MG.o: in function `main':
sample4.cpp:(.text.main[main]+0x5b): undefined reference to
`boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)'
/usr/bin/ld: sample4.cpp:(.text.main[main]+0xc2): undefined reference
to `boost::cobalt::detail::main_promise::run_main(boost::cobalt::main)'
/usr/bin/ld: /tmp/ccr6j1MG.o: in function `bool
boost::cobalt::detail::promise_receiver<void>::awaitable::await_suspendboost::cobalt::detail::fork::promise_type(std::__n4861::coroutine_handleboost::cobalt::detail::fork::promise_type)':
sample4.cpp:(.text._ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE[_ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE]+0x7f):
undefined reference to `boost::cobalt::detail::already_awaited()'
/usr/bin/ld: /tmp/ccr6j1MG.o: in function
`boost::cobalt::detail::promise_receiver<void>::awaitable::interrupt_await()
&':
sample4.cpp:(.text._ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv[_ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv]+0x33):
undefined reference to `boost::cobalt::detail::detached_exception()'
collect2: error: ld returned 1 exit status
Em sáb., 23 de dez. de 2023 às 05:22, accelerator0099 via Boost-users
CMake doesn't support cobalt (even the latest cmake 3.28.1 doesn't support it).
On 12/21/23 22:29, Josué Andrade Gomes via Boost-users wrote:
cmake_minimum_required(VERSION 3.20) project(coro_study)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_VERBOSE_MAKEFILE ON)
set(Boost_VERBOSE 1) set(Boost_DEBUG 1)
find_package(Boost REQUIRED COMPONENTS system)
add_executable(sample sample.cpp)
target_include_directories(sample4 PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(sample4 PRIVATE ${Boost_LIBRARIES})
Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Don’t you need to actually link the library? Richard Hodges hodges.r@gmail.com On Sat, 23 Dec 2023 at 22:17, Josué Andrade Gomes via Boost-users < boost-users@lists.boost.org> wrote:
Same error when building manually:
$ g++ -I~/.local/include -L~/.local/lib -o sample ../sample4.cpp -std=c++20 -fcoroutines -lboost_system /usr/bin/ld: /tmp/ccr6j1MG.o: in function `co_main(co_main(int, char**)::_Z7co_mainiPPc.Frame*) [clone .actor]': sample4.cpp:(.text+0x2a9): undefined reference to `boost::cobalt::detail::main_promise::final_suspend()' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `main::reset_res::operator()(std::pmr::memory_resource*)':
sample4.cpp:(.text._ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE[_ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE]+0x1c): undefined reference to
`boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `main': sample4.cpp:(.text.main[main]+0x5b): undefined reference to
`boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)' /usr/bin/ld: sample4.cpp:(.text.main[main]+0xc2): undefined reference to `boost::cobalt::detail::main_promise::run_main(boost::cobalt::main)' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `bool
boost::cobalt::detail::promise_receiver<void>::awaitable::await_suspendboost::cobalt::detail::fork::promise_type(std::__n4861::coroutine_handleboost::cobalt::detail::fork::promise_type)':
sample4.cpp:(.text._ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE[_ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE]+0x7f): undefined reference to `boost::cobalt::detail::already_awaited()' /usr/bin/ld: /tmp/ccr6j1MG.o: in function
`boost::cobalt::detail::promise_receiver<void>::awaitable::interrupt_await() &':
sample4.cpp:(.text._ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv[_ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv]+0x33): undefined reference to `boost::cobalt::detail::detached_exception()' collect2: error: ld returned 1 exit status
Em sáb., 23 de dez. de 2023 às 05:22, accelerator0099 via Boost-users
escreveu: CMake doesn't support cobalt (even the latest cmake 3.28.1 doesn't support it).
On 12/21/23 22:29, Josué Andrade Gomes via Boost-users wrote:
cmake_minimum_required(VERSION 3.20) project(coro_study)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_VERBOSE_MAKEFILE ON)
set(Boost_VERBOSE 1) set(Boost_DEBUG 1)
find_package(Boost REQUIRED COMPONENTS system)
add_executable(sample sample.cpp)
target_include_directories(sample4 PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(sample4 PRIVATE ${Boost_LIBRARIES})
Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
No Cobalt library was built by b2.
Em sáb., 23 de dez. de 2023 às 18:45, Richard Hodges via Boost-users
Don’t you need to actually link the library?
Richard Hodges hodges.r@gmail.com
On Sat, 23 Dec 2023 at 22:17, Josué Andrade Gomes via Boost-users
wrote: Same error when building manually:
$ g++ -I~/.local/include -L~/.local/lib -o sample ../sample4.cpp -std=c++20 -fcoroutines -lboost_system /usr/bin/ld: /tmp/ccr6j1MG.o: in function `co_main(co_main(int, char**)::_Z7co_mainiPPc.Frame*) [clone .actor]': sample4.cpp:(.text+0x2a9): undefined reference to `boost::cobalt::detail::main_promise::final_suspend()' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `main::reset_res::operator()(std::pmr::memory_resource*)': sample4.cpp:(.text._ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE[_ZZ4mainEN9reset_resclEPNSt3pmr15memory_resourceE]+0x1c): undefined reference to `boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `main': sample4.cpp:(.text.main[main]+0x5b): undefined reference to `boost::cobalt::this_thread::set_default_resource(std::pmr::memory_resource*)' /usr/bin/ld: sample4.cpp:(.text.main[main]+0xc2): undefined reference to `boost::cobalt::detail::main_promise::run_main(boost::cobalt::main)' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `bool boost::cobalt::detail::promise_receiver<void>::awaitable::await_suspendboost::cobalt::detail::fork::promise_type(std::__n4861::coroutine_handleboost::cobalt::detail::fork::promise_type)': sample4.cpp:(.text._ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE[_ZN5boost6cobalt6detail16promise_receiverIvE9awaitable13await_suspendINS1_4fork12promise_typeEEEbNSt7__n486116coroutine_handleIT_EE]+0x7f): undefined reference to `boost::cobalt::detail::already_awaited()' /usr/bin/ld: /tmp/ccr6j1MG.o: in function `boost::cobalt::detail::promise_receiver<void>::awaitable::interrupt_await() &': sample4.cpp:(.text._ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv[_ZNR5boost6cobalt6detail16promise_receiverIvE9awaitable15interrupt_awaitEv]+0x33): undefined reference to `boost::cobalt::detail::detached_exception()' collect2: error: ld returned 1 exit status
Em sáb., 23 de dez. de 2023 às 05:22, accelerator0099 via Boost-users
escreveu: CMake doesn't support cobalt (even the latest cmake 3.28.1 doesn't support it).
On 12/21/23 22:29, Josué Andrade Gomes via Boost-users wrote:
cmake_minimum_required(VERSION 3.20) project(coro_study)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_VERBOSE_MAKEFILE ON)
set(Boost_VERBOSE 1) set(Boost_DEBUG 1)
find_package(Boost REQUIRED COMPONENTS system)
add_executable(sample sample.cpp)
target_include_directories(sample4 PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(sample4 PRIVATE ${Boost_LIBRARIES})
Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
accelerator0099
-
Josué Andrade Gomes
-
Richard Hodges