On 2010-9-21 10:11, Hradec wrote: > I got tbb.dll to build properly, but its failling when building tbbmalloc: > > > ../../src/tbbmalloc/MemoryAllocator.cpp:42:0: warning: "_WIN32_WINNT" > redefined > /media/MyBook2TB_2/Mirror/cortex4all/trunk/compilers/linux.mingw32.4.6.0_20100411/bin/../lib/gcc/i686-w64-mingw32/4.6.0/../../../../i686-w64-mingw32/include/_mingw.h:171:0: > note: this is the location of the previous definition > ../../src/tbbmalloc/MemoryAllocator.cpp: In function 'uintptr_t > rml::internal::cleanupCacheIfNeed()': > ../../src/tbbmalloc/MemoryAllocator.cpp:1384:70: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp:1385:68: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp: In function 'void* > rml::internal::allocateCachedLargeObject(size_t)': > ../../src/tbbmalloc/MemoryAllocator.cpp:1402:51: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp: In function 'void* > rml::internal::mallocLargeObject(size_t, size_t)': > ../../src/tbbmalloc/MemoryAllocator.cpp:1419:54: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp: In function 'bool > rml::internal::freeLargeObjectToCache(rml::internal::LargeObjectHeader*)': > ../../src/tbbmalloc/MemoryAllocator.cpp:1450:50: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp:1456:51: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > ../../src/tbbmalloc/MemoryAllocator.cpp: In function 'void > rml::internal::freeLargeObject(void*)': > ../../src/tbbmalloc/MemoryAllocator.cpp:1468:62: error: invalid > initialization of reference of type 'volatile uintptr_t&' from expression of > type 'size_t' > ../../src/tbbmalloc/Customize.h:97:18: error: in passing argument 1 of > 'uintptr_t AtomicAdd(volatile uintptr_t&, uintptr_t)' > make[2]: *** [MemoryAllocator.o] Error 1 > make[2]: Leaving directory > `/media/MyBook2TB_2/Mirror/cortex4all/trunk/OIIO/externals/build/mingw/obj/tbb22_004oss/build/windows_ia32_gcc_mingw_debug' > make[1]: *** [tbbmalloc] Error 2 > make[1]: Leaving directory > `/media/MyBook2TB_2/Mirror/cortex4all/trunk/OIIO/externals/build/mingw/obj/tbb22_004oss' > > > I'm using the automated build: > > i686-w64-mingw32-gcc (GCC) 4.6.0 20100411 (experimental) > > should I try with a newer one? > > -- > Hradec >
No, This is TBB bug, the following code in MemoryAllocator.cpp:
#if USE_PTHREAD
// Some pthreads documentation says that <pthreads.h> must be first header.
#include <pthread.h>
#define TlsSetValue_func pthread_setspecific
#define TlsGetValue_func pthread_getspecific
typedef pthread_key_t tls_key_t;
#include <sched.h>
inline void do_yield() {sched_yield();}
#elif USE_WINTHREAD
#define _WIN32_WINNT 0x0400
#include <windows.h>
#define TlsSetValue_func TlsSetValue
#define TlsGetValue_func TlsGetValue
typedef DWORD tls_key_t;
inline void do_yield() {SwitchToThread();}
#else
#error Must define USE_PTHREAD or USE_WINTHREAD
#endif
Should be changed to:
#if USE_PTHREAD
// Some pthreads documentation says that <pthreads.h> must be first header.
#include <pthread.h>
#define TlsSetValue_func pthread_setspecific
#define TlsGetValue_func pthread_getspecific
typedef pthread_key_t tls_key_t;
#include <sched.h>
inline void do_yield() {sched_yield();}
#elif USE_WINTHREAD
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#include <windows.h>
#define TlsSetValue_func TlsSetValue
#define TlsGetValue_func TlsGetValue
typedef DWORD tls_key_t;
inline void do_yield() {SwitchToThread();}
#else
#error Must define USE_PTHREAD or USE_WINTHREAD
#endif
--
Dongsheng
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
