---------- Forwarded message ----------
From: niXman <i.nixman@gmail.com>
Date: 2011/7/24
Subject: boost.thread build error when use mingw32 based on gcc-4.6.1-release
To: boost-users@lists.boost.org


Hi all!
When I build boost-1.46.1 or boost-1.47.0 I get the following errors:
common.mkdir bin.v2\libs\thread
common.mkdir bin.v2\libs\thread\build
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1\release
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtim
e-link-static
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtim
e-link-static\threading-multi
common.mkdir bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtim
e-link-static\threading-multi\win32
gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\run
time-link-static\threading-multi\win32\thread.o
In file included from ./boost/thread/detail/platform.hpp:17:0,
                 from ./boost/thread/thread.hpp:12,
                 from libs\thread\src\win32\thread.cpp:10:
./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unava
liable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
libs\thread\src\win32\thread.cpp: In function 'void boost::{anonymous}::create_c
urrent_thread_tls_key()':
libs\thread\src\win32\thread.cpp:33:37: error: 'tss_cleanup_implemented' was not
 declared in this scope
In file included from ./boost/thread/shared_mutex.hpp:14:0,
                 from ./boost/thread/detail/thread_group.hpp:9,
                 from ./boost/thread/thread.hpp:24,
                 from libs\thread\src\win32\thread.cpp:10:
./boost/thread/win32/shared_mutex.hpp: In member function 'T boost::shared_mutex
::interlocked_compare_exchange(T*, T, T) [with T = boost::shared_mutex::state_da
ta]':
./boost/thread/win32/shared_mutex.hpp:110:103:   instantiated from here
./boost/thread/win32/shared_mutex.hpp:50:99: warning: dereferencing type-punned
pointer will break strict-aliasing rules [-Wstrict-aliasing]
./boost/thread/win32/shared_mutex.hpp:50:99: warning: dereferencing type-punned
pointer will break strict-aliasing rules [-Wstrict-aliasing]
./boost/thread/win32/shared_mutex.hpp:51:52: warning: dereferencing type-punned
pointer will break strict-aliasing rules [-Wstrict-aliasing]
./boost/thread/win32/shared_mutex.hpp:51:52: warning: dereferencing type-punned
pointer will break strict-aliasing rules [-Wstrict-aliasing]

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthrea
ds -Wno-long-long -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DNDEBUG  -I".
" -c -o "bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtime-li
nk-static\threading-multi\win32\thread.o" "libs\thread\src\win32\thread.cpp"

...failed gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-
static\runtime-link-static\threading-multi\win32\thread.o...
gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\run
time-link-static\threading-multi\win32\tss_dll.o
In file included from ./boost/thread/detail/platform.hpp:17:0,
                 from ./boost/thread/detail/config.hpp:20,
                 from libs\thread\src\win32\tss_dll.cpp:6:
./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unava
liable: it has been explicitly disabled with BOOST_DISABLE_THREADS"

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthrea
ds -Wno-long-long -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DNDEBUG  -I".
" -c -o "bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtime-li
nk-static\threading-multi\win32\tss_dll.o" "libs\thread\src\win32\tss_dll.cpp"

...failed gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-
static\runtime-link-static\threading-multi\win32\tss_dll.o...
gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\run
time-link-static\threading-multi\win32\tss_pe.o
In file included from ./boost/thread/detail/platform.hpp:17:0,
                 from ./boost/thread/detail/config.hpp:20,
                 from libs\thread\src\win32\tss_pe.cpp:10:
./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unava
liable: it has been explicitly disabled with BOOST_DISABLE_THREADS"

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthrea
ds -Wno-long-long -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DNDEBUG  -I".
" -c -o "bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtime-li
nk-static\threading-multi\win32\tss_pe.o" "libs\thread\src\win32\tss_pe.cpp"

...failed gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-
static\runtime-link-static\threading-multi\win32\tss_pe.o...
...skipped <pbin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtim
e-link-static\threading-multi>libboost_thread.a(clean) for lack of <pbin.v2\libs
\thread\build\gcc-mingw-4.6.1\release\link-static\runtime-link-static\threading-
multi>win32\thread.o...
...skipped <pbin.v2\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtim
e-link-static\threading-multi>libboost_thread.a for lack of <pbin.v2\libs\thread
\build\gcc-mingw-4.6.1\release\link-static\runtime-link-static\threading-multi>w
in32\thread.o...
...skipped <pc:\mingw\i686-pc-mingw32\lib>libboost_thread.a for lack of <pbin.v2
\libs\thread\build\gcc-mingw-4.6.1\release\link-static\runtime-link-static\threa
ding-multi>libboost_thread.a...

mingw is builded by myself.
configured with:
C:\>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.6.1/lto-wrappe
r.exe
Target: i686-pc-mingw32
Configured with: /c/mingw-builder/src/gcc/configure --host=i686-pc-mingw32 --bui
ld=i686-linux-gnu --target=i686-pc-mingw32 --with-sysroot=/c/mingw-builder/mingw
32-4.6.1-release-rev-2/mingw32-4.6.1-release-rev-2 --prefix=/c/mingw-builder/min
gw32-4.6.1-release-rev-2/mingw32-4.6.1-release-rev-2 --with-libiconv-prefix=/c/m
ingw-builder/mingw32-4.6.1-release-rev-2/libs --with-libexpat-prefix=/c/mingw-bu
ilder/mingw32-4.6.1-release-rev-2/libs --with-gmp=/c/mingw-builder/mingw32-4.6.1
-release-rev-2/libs --with-mpfr=/c/mingw-builder/mingw32-4.6.1-release-rev-2/lib
s --with-mpc=/c/mingw-builder/mingw32-4.6.1-release-rev-2/libs --with-ppl=/c/min
gw-builder/mingw32-4.6.1-release-rev-2/libs --with-cloog=/c/mingw-builder/mingw3
2-4.6.1-release-rev-2/libs --enable-cloog-backend=isl --with-host-libstdcxx=-lst
dc++ --enable-threads=posix --enable-static --disable-shared --enable-languages=
c,c++ --enable-libgomp --enable-checking=release --enable-fully-dynamic-string -
-enable-sjlj-exceptions --enable-libstdcxx-debug --disable-nls --disable-werror
--enable-lto --disable-multilib --disable-win32-registry --disable-rpath --disab
le-werror CFLAGS='-O2 -mtune=core2 -fomit-frame-pointer -momit-leaf-frame-pointe
r -fgraphite-identity -floop-interchange -floop-block -floop-parallelize-all' LD
FLAGS=' -lpthread'
Thread model: posix
gcc version 4.6.1 (GCC)
 
Any ideas?

Thanks.