mold
mold copied to clipboard
mold fails to build with lto and -Werror=odr
mold fails to build with lto and -Werror=odr enabled on Gentoo
gcc version: 12.2.0
complete build log
31 | enum class exception_id {
|
/var/tmp/portage/sys-devel/mold-1.4.1/work/mold-1.4.1/third-party/tbb/src/tbb/../../include/oneapi/tbb/detail/_exception.h:31: note: an enum with different value name is defined in another translation unit
31 | enum class exception_id {
|
/var/tmp/portage/sys-devel/mold-1.4.1/work/mold-1.4.1/third-party/tbb/src/tbb/../../include/tbb/../oneapi/tbb/detail/_exception.h:47: note: name ‘last_entry’ differs from name ‘bad_task_handle’ defined in another translation unit
47 | last_entry
|
/var/tmp/portage/sys-devel/mold-1.4.1/work/mold-1.4.1/third-party/tbb/src/tbb/../../include/oneapi/tbb/detail/_exception.h:44: note: mismatching definition
44 | bad_task_handle,
|
/var/tmp/portage/sys-devel/mold-1.4.1/work/mold-1.4.1/third-party/tbb/src/tbb/../../include/tbb/../oneapi/tbb/global_control.h:59: error: type ‘tbb::detail::d1::global_control::parameter’ violates the C++ One Definition Rule [-Werror=odr]```
It looks like it is an error of OneTBB. What if you build only libtbb with -Werror=odr?
Yes, it's problem in OneTBB:
enum class exception_id {
bad_alloc = 1,
bad_last_alloc,
user_abort,
nonpositive_step,
out_of_range,
reservation_length_error,
missing_wait,
invalid_load_factor,
invalid_key,
bad_tagged_msg_cast,
unsafe_wait,
#if __TBB_PREVIEW_TASK_GROUP_EXTENSIONS
bad_task_handle,
bad_task_handle_wrong_task_group,
#endif // __TBB_PREVIEW_TASK_GROUP_EXTENSIONS
last_entry
};
Apparently, some units are built with __TBB_PREVIEW_TASK_GROUP_EXTENSIONS and some w/o. Please report it to upstream.
This was fixed upstream in Dec 2021, in https://github.com/oneapi-src/oneTBB/commit/74b7fc748bffb699a60bdedc867a1e208e50bd2a (part of https://github.com/oneapi-src/oneTBB/pull/668).
Then, please close this.
On 09/11/2022 08:41, Martin Liška wrote:
Then, please close this.
It was fixed upstream but it's still an issue in the vendored copy of mold.
I'll upgrade it to https://github.com/oneapi-src/oneTBB/releases/tag/v2021.7.0 before making the next release.