Boost logo

Boost :

Subject: Re: [boost] Coroutine2 examples - Cannot link properly.
From: Carlos Ferreira (carlosmf.pt_at_[hidden])
Date: 2016-03-31 09:52:39


Trying to keep it simple.

[claymore_at_Claymore boost_test]$ g++ -o fibonacci_example -std=gnu++14
-fsplit-stack -l boost_context fibonacci.cpp
/tmp/ccjaVkdi.o: In function
`boost::coroutines2::detail::pull_coroutine<int>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}&&,
bool)':
fibonacci.cpp:(.text+0x5fc): undefined reference to
`boost::context::execution_context::current()'
/tmp/ccjaVkdi.o: In function `boost::context::detail::activation_record*
boost::context::execution_context::create_context<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
boost::coroutines2::detail::pull_coroutine<int>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}&&,
bool)::{lambda(void*)#1}, std::tuple<>
>(main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1},
boost::context::preallocated,
boost::coroutines2::detail::pull_coroutine<int>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
main::{lambda(boost::coroutines2::detail::push_coroutine<int>&)#1}&&,
bool)::{lambda(void*)#1}, std::tuple<>&&)':
fibonacci.cpp:(.text+0x8e4): undefined reference to
`boost::context::execution_context::current()'
/tmp/ccjaVkdi.o: In function `TLS wrapper function for
boost::context::detail::activation_record::current_rec':
fibonacci.cpp:(.text._ZTWN5boost7context6detail17activation_record11current_recE[_ZTWN5boost7context6detail17activation_record11current_recE]+0x22):
undefined reference to `TLS init function for
boost::context::detail::activation_record::current_rec'
fibonacci.cpp:(.text._ZTWN5boost7context6detail17activation_record11current_recE[_ZTWN5boost7context6detail17activation_record11current_recE]+0x32):
undefined reference to
`boost::context::detail::activation_record::current_rec'
/tmp/ccjaVkdi.o: In function
`boost::coroutines2::detail::push_coroutine<int>::control_block::resume(int
const&)':
fibonacci.cpp:(.text._ZN5boost11coroutines26detail14push_coroutineIiE13control_block6resumeERKi[_ZN5boost11coroutines26detail14push_coroutineIiE13control_block6resumeERKi]+0x36):
undefined reference to `boost::context::execution_context::current()'
/tmp/ccjaVkdi.o: In function
`boost::coroutines2::detail::pull_coroutine<int>::control_block::resume()':
fibonacci.cpp:(.text._ZN5boost11coroutines26detail14pull_coroutineIiE13control_block6resumeEv[_ZN5boost11coroutines26detail14pull_coroutineIiE13control_block6resumeEv]+0x32):
undefined reference to `boost::context::execution_context::current()'
collect2: error: ld returned 1 exit status
[claymore_at_Claymore boost_test]$

[claymore_at_Claymore boost_test]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC)

What am I doing wrong?

On 31 March 2016 at 13:44, Carlos Ferreira <carlosmf.pt_at_[hidden]> wrote:

> The example was built using GNU C++ 14 support. (-std=gnu++14)
>
> On 31 March 2016 at 13:34, Oliver Kowalke <oliver.kowalke_at_[hidden]>
> wrote:
>
>> Did you build the examples with C++11 support enabled?
>>
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>
>
>
>
> --
>
> Carlos Miguel Ferreira
> Researcher at Telecommunications Institute
> Aveiro - Portugal
> Work E-mail - cmf_at_[hidden]
> Skype & GTalk -> carlosmf.pt_at_[hidden]
> LinkedIn -> http://www.linkedin.com/in/carlosmferreira
>

-- 
Carlos Miguel Ferreira
Researcher at Telecommunications Institute
Aveiro - Portugal
Work E-mail - cmf_at_[hidden]
Skype & GTalk -> carlosmf.pt_at_[hidden]
LinkedIn -> http://www.linkedin.com/in/carlosmferreira

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk