oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

ld: warning: cannot export hidden symbol typeinfo for tbb::detail::r1::unsafe_wait

Open phprus opened this issue 3 years ago • 8 comments

Commit: d1667d514df697f05d771602b268e92560c434c4 macOS 12.1 Xcode 13.2.1

Linker warning:

ld: warning: cannot export hidden symbol typeinfo for tbb::detail::r1::unsafe_wait from CMakeFiles/tbb.dir/exception.cpp.o

Workaround: Export any method from class unsafe_wait. Workaround example: https://github.com/phprus/oneTBB/commit/053de910944d218dc61e9875f0f2be2f303d7050

But, I'm not sure if this workaround doesn't break backward compatibility.

phprus avatar Jan 03 '22 15:01 phprus

@alexey-katranov, @vlserov , is https://github.com/oneapi-src/oneTBB/pull/706 brake this ?

anton-potapov avatar Jan 10 '22 10:01 anton-potapov

This is odd. def files should be used for exporting symbols. Export rules for tbb::detail::r1::unsafe_wait exception are present for MacOS and Linux. Those rules are missed for Windows and should be added as well.

vlserov avatar Jan 10 '22 11:01 vlserov

@alexey-katranov, @vlserov,

Export rules for macOS: https://github.com/oneapi-src/oneTBB/blob/d1667d514df697f05d771602b268e92560c434c4/src/tbb/def/mac64-tbb.def#L52-L61

Export rules for Linux 64-bit: https://github.com/oneapi-src/oneTBB/blob/e386c96debbdb2944e404323ee8682c5293f96ff/src/tbb/def/lin64-tbb.def#L50-L59

For all other exception classes https://github.com/oneapi-src/oneTBB/blob/e386c96debbdb2944e404323ee8682c5293f96ff/include/oneapi/tbb/detail/_exception.h#L51-L66

export rules does not contain exports what() member.

Only typeinfo and vtable is exported:

% c++filt '__ZTIN3tbb6detail2r114bad_last_allocE'
typeinfo for tbb::detail::r1::bad_last_alloc
% c++filt '__ZTVN3tbb6detail2r114bad_last_allocE'
vtable for tbb::detail::r1::bad_last_alloc

what() exported by macro __TBB_EXPORTED_METHOD

phprus avatar Jan 10 '22 12:01 phprus

Windows export rules do not contain export rules for unsafe_wait: https://github.com/oneapi-src/oneTBB/blob/e386c96debbdb2944e404323ee8682c5293f96ff/src/tbb/def/win32-tbb.def#L49-L54 https://github.com/oneapi-src/oneTBB/blob/e386c96debbdb2944e404323ee8682c5293f96ff/src/tbb/def/win64-tbb.def#L49-L54

phprus avatar Jan 10 '22 12:01 phprus

It seems related to #566. How does it work on Windows...?

alexey-katranov avatar Jan 10 '22 13:01 alexey-katranov

@phprus , the warning is issues during the build of the library or the tests?

anton-potapov avatar Jan 20 '22 14:01 anton-potapov

@anton-potapov, on build the library libtbb.dylib:

[ 17%] Linking CXX shared library ../../appleclang_13.0_cxx17_64_release/libtbb.dylib
cd /Users/phprus/Devel/oneapi-src/tmp/pr739/oneTBB-0ef804884856e791fe7bb173078a92daf3929f76/build/release/src/tbb && /opt/homebrew/Cellar/cmake/3.22.1/bin/cmake -E cmake_link_script CMakeFiles/tbb.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -O3 -DNDEBUG -flto=thin -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -dynamiclib -Wl,-headerpad_max_install_names -Wl,-exported_symbols_list,/Users/phprus/Devel/oneapi-src/tmp/pr739/oneTBB-0ef804884856e791fe7bb173078a92daf3929f76/src/tbb/def/mac64-tbb.def -compatibility_version 12.0.0 -current_version 12.6.0 -o ../../appleclang_13.0_cxx17_64_release/libtbb.12.6.dylib -install_name @rpath/libtbb.12.dylib CMakeFiles/tbb.dir/address_waiter.cpp.o CMakeFiles/tbb.dir/allocator.cpp.o CMakeFiles/tbb.dir/arena.cpp.o CMakeFiles/tbb.dir/arena_slot.cpp.o CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.o CMakeFiles/tbb.dir/dynamic_link.cpp.o CMakeFiles/tbb.dir/exception.cpp.o CMakeFiles/tbb.dir/governor.cpp.o CMakeFiles/tbb.dir/global_control.cpp.o CMakeFiles/tbb.dir/itt_notify.cpp.o CMakeFiles/tbb.dir/main.cpp.o CMakeFiles/tbb.dir/market.cpp.o CMakeFiles/tbb.dir/misc.cpp.o CMakeFiles/tbb.dir/misc_ex.cpp.o CMakeFiles/tbb.dir/observer_proxy.cpp.o CMakeFiles/tbb.dir/parallel_pipeline.cpp.o CMakeFiles/tbb.dir/private_server.cpp.o CMakeFiles/tbb.dir/profiling.cpp.o CMakeFiles/tbb.dir/rml_tbb.cpp.o CMakeFiles/tbb.dir/rtm_mutex.cpp.o CMakeFiles/tbb.dir/rtm_rw_mutex.cpp.o CMakeFiles/tbb.dir/semaphore.cpp.o CMakeFiles/tbb.dir/small_object_pool.cpp.o CMakeFiles/tbb.dir/task.cpp.o CMakeFiles/tbb.dir/task_dispatcher.cpp.o CMakeFiles/tbb.dir/task_group_context.cpp.o CMakeFiles/tbb.dir/version.cpp.o CMakeFiles/tbb.dir/queuing_rw_mutex.cpp.o
ld: warning: cannot export hidden symbol typeinfo for tbb::detail::r1::unsafe_wait from CMakeFiles/tbb.dir/exception.cpp.o

phprus avatar Jan 20 '22 15:01 phprus

More correct solution: #1114

phprus avatar Jun 03 '23 17:06 phprus