- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Cheers,
I have three small contributions to TBB 2.2 on Mac OS X. First one fixes i386 build on Snow Leopard, and second one provides a script which generates i386/x86_64 universal binaries (since ppc build is broken on SL as well, I could not test ppc/i386/x86_64 universal binary, but the script is configurable w.r.t. architectures included).
- Snow leopard i386 build fix - SL defaults to compiling for x86_64 (that is 64-bit Intel). In previous versions, it defaulted to compiling for i386 (32-bit Intel). build/macos.gcc.inc relies on this pre-SL i386 default, and therefore does not specify any special options for arch=i386. However this breaks for SL, so I modified the mentioned file to add "-arch i386" to compilation flags, just like it specifies for the other architectures there.
- Universal binary build script - I did not find a way to specify to the build system that I want a 32/64-bit Intel universal binary, like in boost (architecture=x86 address-model=32_64), so I wrote a script that uses the lipo utility to achieve the same effect: it builds tbb for each architecture in the "arch" environment variable (which defaults to "ia32 intel64"), then using lipo, for each library merges its binaries compiled for various architectures together to create a universal binary for that library with all these architectures.
- PPC build bug report - if that is of any interest, gnumake arch=ppc does not work on Snow Leopard (I have never tried ppc before, so can't say it's a regression) - everything runs fine until the linker:
g++ -c -MMD -g -O0 -DTBB_USE_DEBUG -DUSE_PTHREAD -arch ppc -fPIC -D__TBB_BUILD=1 -Wall -I../../src -I../../include ../../src/old/concurrent_queue_v2.cpp g++ -c -MMD -g -O0 -DTBB_USE_DEBUG -DUSE_PTHREAD -arch ppc -fPIC -D__TBB_BUILD=1 -Wall -I../../src -I../../include ../../src/old/spin_rw_mutex_v2.cpp sh ../../build/generate_tbbvars.sh /bin/sh -c "g++ -E -x c ../../src/tbb/mac64-tbb-export.def -I../../src -I../../include -DTBB_USE_DEBUG -DUSE_PTHREAD -D__TBB_BUILD=1 >tbb.def 2>/dev/null || exit 0" g++ -fPIC -o libtbb_debug.dylib concurrent_hash_map.o concurrent_queue.o concurrent_vector.o dynamic_link.o itt_notify.o cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o spin_rw_mutex.o spin_mutex.o task.o tbb_misc.o mutex.o recursive_mutex.o tbb_thread.o itt_notify_proxy.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o -ldl -lpthread -dynamiclib -arch ppc -Wl,-exported_symbols_list,tbb.def Undefined symbols: "tbb::internal::concurrent_queue_base::internal_set_capacity(long, unsigned long)", referenced from: -exported_symbols_list command line option "tbb::internal::concurrent_queue_base_v3::internal_set_capacity(long, unsigned long)", referenced from: -exported_symbols_list command line option
For fixing 1., edit build/macos.gcc.inc and add along with other architectures this:
ifeq (ia32,$(arch)) CPLUS_FLAGS += -arch i386 LINK_FLAGS += -arch i386 LIB_LINK_FLAGS += -arch i386 endifThe script for 2. is this (does not work if there are spaces in any involved path - could not figure out how to construct lipo_lib_args in such case):
[shell]#!/bin/sh # Usage: /path/to/macos-build-universal.sh # if you want to specify different set of architectures than the default, # do so with the "arch" environment variable: arch="ia32 intel64 ppc" /path/to/macos-build-universal.sh thisdir="`dirname "$0"`" builddir="$thisdir" rootdir="$builddir/.." archs=${archs:-ia32 intel64} configs="debug release" tbblibs="tbb tbbmalloc" log() { echo "$@" "$@" } # build for arch in $archs; do gnumake -C "$rootdir" "arch=$arch" done # merge archs for config in $configs; do config_name="" [ $config != "debug" ] || config_name="_debug" for tbblib in $tbblibs; do tbblibname=lib${tbblib}${config_name}.dylib lipo_lib_args="" for arch in $archs; do config_dir="`ls -d "${builddir}"/macos*${arch}*${config} | head -n1`" lipo_lib_args="${lipo_lib_args} ${config_dir}/${tbblibname}" done log lipo ${lipo_lib_args} -create -output "${builddir}/${tbblibname}" done done [/shell]
Boris
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Boris Dusek
I have three small contributions to TBB 2.2 on Mac OS X. First one fixes i386 build on Snow Leopard, and second one provides a script which generates i386/x86_64 universal binaries (since ppc build is broken on SL as well, I could not test ppc/i386/x86_64 universal binary, but the script is configurable w.r.t. architectures included).
Thanks a lot for the detailed suggestions you provided for improving the MacOS build process for TBB on Snow Leopard. I'm sure our development team will be very interested in looking at your suggestions and using them to inform their improvements of the build process for that platform.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Boris Dusek
Hello,
I have three small contributions to TBB 2.2 on Mac OS X. First one fixes i386 build on Snow Leopard, and second one provides a script which generates i386/x86_64 universal binaries (since ppc build is broken on SL as well, I could not test ppc/i386/x86_64 universal binary, but the script is configurable w.r.t. architectures included).
"LEGAL" DISCLAIMER: The linked repository is my personal, the changes there are notendorsed by Intel and are not guaranteed to work or even not to do harm.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page