Subject: Re: [boost] [Boost-users] cross-compilation x86_64-w64-ming32: undefined reference to `InterlockedIncrement'
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-09-23 09:32:41


On Mon, Sep 23, 2013 at 4:38 PM, Frédéric Bron <frederic.bron_at_[hidden]>wrote:

> > Does it help if you just replace:
> >
> > #if defined(__MINGW64__)
> > #define BOOST_INTERLOCKED_IMPORT
> > #else
> > #define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
> > #endif
> >
> > with
> >
> > #define BOOST_INTERLOCKED_IMPORT BOOST_SYMBOL_IMPORT
> >
> > and no other changes? If that fixes the problem, this would be a more
> > appropriate solution for 1.55. In the long term it might be worthwhile to
> > use gcc atomic intrinsics to implement BOOST_INTERLOCKED* macros.
>
> target i686 is OK but target x86_64 gives this error:
>
> xuxu-x86_64-w64-mingw32-g++-4.8.1.o:xuxu.cc:(.text+0x1b7): undefined
> reference to `__imp_InterlockedIncrement'
>
> xuxu-x86_64-w64-mingw32-g++-4.8.1.o:xuxu.cc:(.text$_ZN5boost6detail21intrusive_ptr_releaseEPNS0_16thread_data_baseE[_ZN5boost6detail21intrusive_ptr_releaseEPNS0_16thread_data_baseE]+0xe):
> undefined reference to `__imp_InterlockedDecrement'
>
> /cm/shared/apps/soft/bal/usr/mingw64-4.8.1/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld:
> xuxu-x86_64-w64-mingw32-g++-4.8.1.o: bad reloc address 0xe in section
>
> `.text$_ZN5boost6detail21intrusive_ptr_releaseEPNS0_16thread_data_baseE[_ZN5boost6detail21intrusive_ptr_releaseEPNS0_16thread_data_baseE]'
> collect2: error: ld returned 1 exit status
>

So in 64-bit mode these functions are not exported from kernel32? It looks
like they are supposed to be implemented by compiler intrinsics.