Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] cross-compilation x86_64-w64-ming32: undefined reference to `InterlockedIncrement'
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2013-09-23 06:46:39


> I probably missed the original problem, but the patch doesn't look correct
> to me. The section guarded with "defined( BOOST_MSVC ) || defined(
> BOOST_INTEL_WIN )" is obviously targeted for compilers supporting
> interlocked intrinsics, which gcc isn't. MinGW should probably be handled
> by the last section of the #if/elif/endif sequence. Anyway, what problem
> are you trying to fix?

Here is what I get when build an application with boost and mingw-w64
targeting x86_64:

/usr/x86_64-w64-mingw32/sys-
root/mingw/lib/../lib/libboost_thread-mt.a(thread.o):(.text+0x286):
undefined reference to `InterlockedIncrement'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libboost_thread-mt.a(thread.o):(.text+0x3e7):
undefined reference to `InterlockedDecrement'
/usr/lib64/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld:
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libboost_thread-mt.a(thread.o):
bad reloc address 0x8 in section `.data'

I have been able to solve this by defining BOOST_USE_WINDOWS_H but
this creates issues with Unicode when I also use wxWidgets. The patch
proposed solves the issue. I recognise that I say that gcc should be
considered as MSVC with regards to these Interlocked things which I do
not understand. It may seem strange but it works. What's wrong with
it? Basically, I just #include <intrin.h>; what's wrong with that?

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net