Opened 5 years ago

#13297 new Bugs

Coroutine-Context linker error on Cygwin, but not on Linux

Reported by: lars@… Owned by: olli
Milestone: Boost 1.65.0 Component: context
Version: Boost 1.65.0 Severity: Problem
Keywords: Cc:

Description

Hi,

I'm attempting to port a inherited project from Linux to Cygwin on Windows. Even though I'm using Boost 1.65.1 on both systems (both compiled from source), I seem to get a Linker error on Cygwin, but not on Linux. The only difference I can see between my two system setups is the compiler:

Cygwin runs g++ 6.4.0, x86_64-pc-cygwin. Linux runs g++ 6.3.0, x86_64-linux-gnu.

Both compiled the boost library with the following commands:

./bootstrap.sh --prefix=compiled
./b2 cxxflags="-std=c++11"
./b2 install

I've reduced my project to only the troublesome code module, and scrapped as much as possible, you can find it attached to this ticket as well. Compiling is performed with:

g++ -std=c++11 main.cpp -I/usr/local/include/ -L/usr/local/lib/ -lm -lboost_context -lboost_regex -lboost_coroutine -lboost_system -lboost_chrono -lboost_thread

The two latter libraries (chrono and thread), only seem to be necessary for the Linux-version. The output from above command on Linux is non-existent, since it succeeds. The output on Cygwin however informs me of a linker error:

/tmp/ccOwuqNr.o:main.cpp:(.text$_ZN5boost11coroutines26detail14push_coroutineIvEC1IZN4TaskC4ERKSt8functionIFvvEEEUlRNS1_14pull_coroutineIvEEE_vEEOT_[_ZN5boost11coroutines26detail14push_coroutineIvEC1IZN4TaskC4ERKSt8functionIFvvEEEUlRNS1_14pull_coroutineIvEEE_vEEOT_]+0x11): undefined reference to `boost::context::stack_traits::default_size()'
/tmp/ccOwuqNr.o:main.cpp:(.text$_ZN5boost11coroutines26detail14push_coroutineIvEC1IZN4TaskC4ERKSt8functionIFvvEEEUlRNS1_14pull_coroutineIvEEE_vEEOT_[_ZN5boost11coroutines26detail14push_coroutineIvEC1IZN4TaskC4ERKSt8functionIFvvEEEUlRNS1_14pull_coroutineIvEEE_vEEOT_]+0x11): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::context::stack_traits::default_size()'
collect2: error: ld returned 1 exit status

To me it seems that the linking between coroutine and context failed at some point. Since the error message is not entirely obvious as to what has gone wrong, I'm not sure if this is a bug within Cygwin or boost. Maybe it's not a bug at all, and I've just missed some configuration step for Cygwin. Any help investigating this would be appreciated!

Attachments (1)

main.cpp (775 bytes ) - added by lars@… 5 years ago.

Download all attachments as: .zip

Change History (1)

by lars@…, 5 years ago

Attachment: main.cpp added
Note: See TracTickets for help on using tickets.