Search code examples
c++c++11boostfiber

how to build boost fiber library for segmented stack support


I am trying to build boost fiber library , I am not sure on what command line arguments to pass to the ./b2.

./b2 --reconfigure cxxflags="-std=c++14" threading=multi variant=release link=shared --toolset=gcc segmented-stacks=on Performing configuration checks

- 32-bit                   : no
- 64-bit                   : yes
- arm                      : no
- mips1                    : no
- power                    : no
- sparc                    : no
- x86                      : yes

Building the Boost C++ Libraries.

- symlinks supported       : yes
- C++11 mutex              : yes
- lockfree boost::atomic_flag : yes
- Boost.Config Feature Check: cxx11_auto_declarations : yes
- Boost.Config Feature Check: cxx11_constexpr : yes
- Boost.Config Feature Check: cxx11_defaulted_functions : yes
- Boost.Config Feature Check: cxx11_final : yes
- Boost.Config Feature Check: cxx11_hdr_tuple : yes
- Boost.Config Feature Check: cxx11_lambdas : yes
- Boost.Config Feature Check: cxx11_noexcept : yes
- Boost.Config Feature Check: cxx11_nullptr : yes
- Boost.Config Feature Check: cxx11_rvalue_references : yes
- Boost.Config Feature Check: cxx11_template_aliases : yes
- Boost.Config Feature Check: cxx11_thread_local : yes
- Boost.Config Feature Check: cxx11_variadic_templates : yes
- has_icu builds           : yes

warning: Graph library does not contain MPI-based parallel components. note: to enable them, add "using mpi ;" to your user-config.jam - zlib : yes - bzip2 : no - iconv (libc) : yes - icu : yes - native-atomic-int32-supported : yes - pthread-supports-robust-mutexes : yes - compiler-supports-visibility : yes - compiler-supports-ssse3 : yes - compiler-supports-avx2 : yes - gcc visibility : yes - long double support : yes warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message.

Component configuration:

- atomic                   : building
- chrono                   : building
- container                : building
- context                  : building
- coroutine                : building
- coroutine2               : building
- date_time                : building
- exception                : building
- fiber                    : building
- filesystem               : building
- graph                    : building
- graph_parallel           : building
- iostreams                : building
- locale                   : building
- log                      : building
- math                     : building
- metaparse                : building
- mpi                      : building
- program_options          : building
- python                   : building
- random                   : building
- regex                    : building
- serialization            : building
- signals                  : building
- system                   : building
- test                     : building
- thread                   : building
- timer                    : building
- type_erasure             : building
- wave                     : building

gcc.link.dll bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/libboost_fiber.so.1.62.0
/usr/bin/ld: bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/algo/algorithm.o: relocation R_X86_64_PC32 against undefined symbol `__morestack' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

    "g++"    -o "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/libboost_fiber.so.1.62.0" -Wl,-h -Wl,libboost_fiber.so.1.62.0 -shared -Wl,--start-group "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/algo/algorithm.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/algo/round_robin.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/algo/shared_work.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/barrier.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/condition_variable.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/context.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/fiber.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/future.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/mutex.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/properties.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/recursive_mutex.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/recursive_timed_mutex.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/timed_mutex.o" "bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/scheduler.o" "bin.v2/libs/context/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/libboost_context.so.1.62.0"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -Wl,--end-group -pthread -m64 

...failed gcc.link.dll bin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi/libboost_fiber.so.1.62.0...
...skipped <pstage/lib>libboost_fiber.so.1.62.0 for lack of <pbin.v2/libs/fiber/build/gcc-5.4.0/release/segmented-stacks-on/threading-multi>libboost_fiber.so.1.62.0...
...skipped <pstage/lib>libboost_fiber.so for lack of <pstage/lib>libboost_fiber.so.1.62.0...

Solution

  • because of 'link=shared' you need to add 'linkflags=-lgcc' (libgcc contains functions related to split-stacks)