Boost logo

Boost-Build :

Subject: Re: [Boost-build] "ld returned 1 exit status" compiling boost thread with mingw-w64 "x64-4.8.1-posix-seh-rev5"
From: ken han (j609444_at_[hidden])
Date: 2013-10-11 12:20:24


On Fri, Oct 11, 2013 at 4:16 AM, Vladimir Prus <ghost_at_[hidden]> wrote:

> On 11.10.2013 02:00, ken han wrote:
>
>> Trying to compile some boost libraries in 64 bit on windows. I am using
>> mingw-w64 package "x64-4.8.1-posix-seh-rev5." I am stuck on figuring
>> out the following error when I compile boost thread. Section of output
>> bellow. Any ideas? Thanks
>>
>> [...]
>> collect2.exe: error: ld returned 1 exit status
>>
>> "g++" "-Wl,--out-implib,[...]bbuild_**64\boost\bin.v2\libs\thread\
>> **build\gcc-mngw-4.8.1\dbg\thrd-**mlt\libboost_thread-mt-d.dll.**a" -o
>> "[...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\libboost_**thread-mt-d.dll" -shared -Wl,--start-group
>> "[...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\win32\thread.**o"
>> "[...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\win32\tss_**dll.o"
>> "[...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\win32\tss_pe.**o"
>> "[...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\future.o"
>> "[...]bbuild_64\boost\bin.v2\**libs\chrono\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\libboost_**chrono-mt-d.dll.a"
>> "[...]bbuild_64\boost\bin.v2\**libs\system\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\libboost_**system-mt-d.dll.a" -Wl,-Bstatic
>> -Wl,-Bdynamic
>> -Wl,--end-group -g -mthreads
>>
>> ...failed gcc.link.dll [...]bbuild_64\boost\bin.v2\**
>> libs\thread\build\gcc-mngw-4.**8.1\dbg\thrd-mlt\libboost_**
>> thread-mt-d.dll.a
>> [...]bbuild_64\boost\bin.v2\**libs\thread\build\gcc-mngw-4.**
>> 8.1\dbg\thrd-mlt\libboost_**thread-mt-d.dll...
>> [...]
>>
>
> Try running this command by hand, on the command line? If no further
> diagnostics is provided by gcc, I am not sure what we can do.
>
> That was a good idea. Ran the command and got this output (the first part
bellow).

libs\thread\build\gcc-mngw-4.8.1\dbg\thrd-mlt\win32\thread.o: In function
boost::detail::win32::interlocked_bit_test_and_set(long*, long)':
boost_1_54_0/./boost/thread/win32/thread_primitives.hpp:437: undefined
reference to `InterlockedCompareExchange'
libs\thread\build\gcc-mngw-4.8.1\dbg\thrd-mlt\win32\thread.o: In function
`boost::detail::intrusive_ptr_add_ref(boost::detail::thread_data_base*)':
boost_1_54_0/./boost/thread/win32/thread_data.hpp:130: undefined reference
to `InterlockedIncrement'
libs\thread\build\gcc-mngw-4.8.1\dbg\thrd-mlt\win32\thread.o: In function
`boost::detail::intrusive_ptr_release(boost::detail::thread_data_base*)':
boost_1_54_0/./boost/thread/win32/thread_data.hpp:135: undefined reference
to `InterlockedDecrement'
libs\thread\build\gcc-mngw-4.8.1\dbg\thrd-mlt\win32\thread.o: In function
`boost::detail::interlocked_read_acquire(long volatile*)':
boost_1_54_0/./boost/thread/win32/interlocked_read.hpp:61: undefined
reference to `InterlockedCompareExchange'
libs\thread\build\gcc-mngw-4.8.1\dbg\thrd-mlt\win32\thread.o: In function
`boost::detail::interlocked_read_acquire(void* volatile*)':
boost_1_54_0/./boost/thread/win32/interlocked_read.hpp:65: undefin
ed reference to `InterlockedCompareExchangePointer'
[...]

I found https://svn.boost.org/trac/boost/ticket/4849 and it seems to be
similar, although I get two link errors in a run rather then just one. So I
added "define=BOOST_USE_WINDOWS_H" to the list of b2 command line
parameters (is that where it goes? does it need -- before it?), but that
did not change any thing. Should I try one of the patches listed there? And
how do I do that?

How do I tell if this is using with posix or windows threads? Thanks



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk