【问题标题】:MSYS2 MinGW strange multiple definition of boost::exception_detail::clone_impl when building large applicationMSYS2 MinGW在构建大型应用程序时奇怪的多重定义boost::exception_detail::clone_impl
【发布时间】:2020-08-23 05:59:24
【问题描述】:

我正在尝试构建一个相当大的应用程序,该应用程序可以在带有 MSYS2 的 Linux 上正常运行。我几乎可以构建它,但我现在遇到了一个非常奇怪的链接器错误:

错误是关于boost::exception_detail::clone_impl的多个定义,项目中使用了boost,但从未直接使用boost异常的东西。

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here

(它提到的对象在任何地方都没有直接使用 boost -- 除了使用boost::iequals 的一行)。

什么可能导致这种情况?我真的不知道 clone_impl 是什么,也不知道为什么要复制它。似乎是 MinGW 特有的。

【问题讨论】:

  • 我在任何地方都找不到有关此的任何信息。我什至找不到 clone_impl 的任何源列表。
  • 这个增强版本可能存在问题。你能准备一个MCVE吗?这将增加发现和解决(可能的)问题的机会。

标签: c++ gcc boost mingw-w64 msys2


【解决方案1】:

我在使用 MinGW 和 Code::Blocks 时遇到了类似的问题。重建项目为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 2013-03-11
    • 1970-01-01
    • 1970-01-01
    • 2022-11-14
    • 1970-01-01
    • 2014-01-17
    • 1970-01-01
    • 1970-01-01
    • 2017-06-22
    相关资源
    最近更新 更多