Closed zeman-88 closed 5 years ago
Do I understand it correct that
@akukanov
Yes; I built TBB with the command above, but haven't been able to link and use TBB in my own code. Here are the contents of the folder tbb-2019_U3/build/macos_arm64_clang_cc10.0.0_ios12.1_release
:
arena.d concurrent_vector.o large_objects.d queuing_mutex.d spin_rw_mutex.o tbb_misc_ex.o
arena.o concurrent_vector_v2.d large_objects.o queuing_mutex.o spin_rw_mutex_v2.d tbb_statistics.d
backend.d concurrent_vector_v2.o libtbb.dylib queuing_rw_mutex.d spin_rw_mutex_v2.o tbb_statistics.o
backend.o condition_variable.d libtbbmalloc.dylib queuing_rw_mutex.o task.d tbb_thread.d
backref.d condition_variable.o libtbbmalloc_proxy.dylib reader_writer_lock.d task.o tbb_thread.o
backref.o critical_section.d market.d reader_writer_lock.o task_group_context.d tbbmalloc.d
cache_aligned_allocator.d critical_section.o market.o recursive_mutex.d task_group_context.o tbbmalloc.def
cache_aligned_allocator.o dynamic_link.d mutex.d recursive_mutex.o task_v2.d tbbmalloc.o
concurrent_hash_map.d dynamic_link.o mutex.o rml_tbb.d task_v2.o tbbvars.csh
concurrent_hash_map.o frontend.d observer_proxy.d rml_tbb.o tbb.def tbbvars.sh
concurrent_monitor.d frontend.o observer_proxy.o scheduler.d tbb_function_replacement.d version_string.ver
concurrent_monitor.o governor.d pipeline.d scheduler.o tbb_function_replacement.o x86_rtm_rw_mutex.d
concurrent_queue.d governor.o pipeline.o semaphore.d tbb_main.d x86_rtm_rw_mutex.o
concurrent_queue.o itt_notify.d private_server.d semaphore.o tbb_main.o
concurrent_queue_v2.d itt_notify.o private_server.o spin_mutex.d tbb_misc.d
concurrent_queue_v2.o itt_notify_malloc.d proxy.d spin_mutex.o tbb_misc.o
concurrent_vector.d itt_notify_malloc.o proxy.o spin_rw_mutex.d tbb_misc_ex.d
Yes; my project is Objective-C based, and the implementation file in which I include <tbb/tbb.h>
is an Objective-C++ file, as it has the .mm
ending.
Correct; I have simply included <tbb/tbb.h>
at the top of my myImplFile.mm
file and have not made any calls to the API.
For more context, here is one of the places it says the error comes from:
tbb/tbb.h:35
tbb/aligned_space.h:24
tbb/compat/../tbb_stddef.h:427
@akukanov
For even more context, here how I could reproduce it with a minimal example:
make arch=arm64 target=ios tbb=release compiler=clang stdlib=libc++
include
, src
, etc directories of the TBB folder and by linking to the newly created libtbb.dylib
under Linked Libraries and Frameworks.#include <tbb/tbb.h>
Honestly, so far it does not look like a TBB issue. forward_as_tuple
is a standard function. And TBB does not even use this function.
Do you know if Objective-C++ support C++11 features? What if instead of <tbb/tbb.h>
you directly include some standard C++ header, e.g. <tuple>
or <functional>
?
@akukanov yes it does, and in fact if I remove the tbb/include
folder from the headers search path, I can compile and can compile even C++11 code such as this:
The C++ file:
The Objective-C++ file in the same project:
These both compile ok if I remove the search for headers path to tbb/include
as I explained above.
OK, we will investigate.
Unrelated to the issue, I'd recomment you to keep only tbb-2019_U3/include
in your header paths, and remove src
and its subdirectories which are not necessary to use TBB.
@akukanov thank you. Thanks for the tip, and in fact in the simple and reproducible example I gave above, I only added tbb-2019_U3/include
to the header paths, and the error still reproduced.
@zeman-88, can you please provide the command line which Xcode uses to compile your Objective-C++ file?
Added: I have tried to compile a .mm
file consisting of a single line
#import <tbb/tbb.h>
and it worked rather well for me:
bash-3.2$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14
BuildVersion: 18A391
bash-3.2$ system_profiler SPDeveloperToolsDataType
...
Version: 10.0 (10A255)
Location: /Applications/Xcode.app
Applications:
Xcode: 10.0 (14320.25)
Instruments: 10.0 (64293.19)
SDKs:
iOS:
12.0: (16A366)
...
bash-3.2$ clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
...
bash-3.2$ clang++ -c -stdlib=libc++ -arch arm64 -I../../include ../../src/test/test_objcxx.mm -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk
... <here go warnings about use of deprecated OS atomic primitives>
10 warnings generated.
bash-3.2$ file test_objcxx.o
test_objcxx.o: Mach-O 64-bit object arm64
I managed to find out it was a problem on my side.
Do you recall how fixed the problem? Zeman-88?
@zeman-88 hi, zeman; do you mind share your solution to this problem?
@eshorr hi, eshorr; do you solve this problem? if so, could you share your solution? thx.
When using TBB on iOS, I get the following error:
These are the steps I follow to build for iOS:
I import and link against the produced
libtbb.dylib
andlibtbbmalloc.dylib
in my Objective-C project in XCode as such:And finally include the main header in my
.mm
file in XCode:I have googled for the error but haven't found an explanation yet. Is this a known bug, and if so, how do I fix it? I am using XCode Version 10.1 (10B61) on MacOS High Sierra 10.13.6 (17G65).