Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
phprus opened this issue Jan 3, 2022 · 8 comments · May be fixed by #799
Open

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

phprus opened this issue Jan 3, 2022 · 8 comments · May be fixed by #799
Labels

Comments

@phprus
Copy link
Contributor

phprus commented Jan 3, 2022

Commit: d1667d5
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: phprus@053de91

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

@anton-potapov
Copy link
Contributor

anton-potapov commented Jan 10, 2022

@alexey-katranov, @vlserov , is #706 brake this ?

@vlserov
Copy link

vlserov commented Jan 10, 2022

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.

@phprus
Copy link
Contributor Author

phprus commented Jan 10, 2022

@alexey-katranov, @vlserov,

Export rules for macOS:

# Error handling (exception.cpp)
__ZN3tbb6detail2r115throw_exceptionENS0_2d012exception_idE
__ZTIN3tbb6detail2r114bad_last_allocE
__ZTVN3tbb6detail2r114bad_last_allocE
__ZTIN3tbb6detail2r112missing_waitE
__ZTVN3tbb6detail2r112missing_waitE
__ZTIN3tbb6detail2r110user_abortE
__ZTVN3tbb6detail2r110user_abortE
__ZTIN3tbb6detail2r111unsafe_waitE
__ZTVN3tbb6detail2r111unsafe_waitE

Export rules for Linux 64-bit:

/* Error handling (exception.cpp) */
_ZN3tbb6detail2r115throw_exceptionENS0_2d012exception_idE;
_ZTIN3tbb6detail2r114bad_last_allocE;
_ZTVN3tbb6detail2r114bad_last_allocE;
_ZTIN3tbb6detail2r112missing_waitE;
_ZTVN3tbb6detail2r112missing_waitE;
_ZTIN3tbb6detail2r110user_abortE;
_ZTVN3tbb6detail2r110user_abortE;
_ZTIN3tbb6detail2r111unsafe_waitE;
_ZTVN3tbb6detail2r111unsafe_waitE;

For all other exception classes

class TBB_EXPORT bad_last_alloc : public std::bad_alloc {
public:
const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
};
//! Exception for user-initiated abort
class TBB_EXPORT user_abort : public std::exception {
public:
const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
};
//! Exception for missing wait on structured_task_group
class TBB_EXPORT missing_wait : public std::exception {
public:
const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
};

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
Copy link
Contributor Author

phprus commented Jan 10, 2022

Windows export rules do not contain export rules for unsafe_wait:

; Error handling (exception.cpp)
?throw_exception@r1@detail@tbb@@YAXW4exception_id@d0@23@@Z
?what@bad_last_alloc@r1@detail@tbb@@UBEPBDXZ
?what@user_abort@r1@detail@tbb@@UBEPBDXZ
?what@missing_wait@r1@detail@tbb@@UBEPBDXZ

; Error handling (exception.cpp)
?throw_exception@r1@detail@tbb@@YAXW4exception_id@d0@23@@Z
?what@bad_last_alloc@r1@detail@tbb@@UEBAPEBDXZ
?what@user_abort@r1@detail@tbb@@UEBAPEBDXZ
?what@missing_wait@r1@detail@tbb@@UEBAPEBDXZ

@alexey-katranov
Copy link
Contributor

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

@anton-potapov
Copy link
Contributor

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

@phprus
Copy link
Contributor Author

phprus commented Jan 20, 2022

@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
Copy link
Contributor Author

phprus commented Jun 3, 2023

More correct solution: #1114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants