【问题标题】:GNU 4.8.1 Any C++ compile crashes after systemupdateGNU 4.8.1 任何 C++ 编译在系统更新后崩溃
【发布时间】:2013-11-29 09:44:02
【问题描述】:

最近我将我的操作系统更新到了 Xubuntu 13.10。现在任何使用 GNU 4.8.1 编译器的 C++ 编译都会崩溃:

terminate called after throwing an instance of 'std::system_error'
what():  Unknown error -1
Aborted (core dumped)

我已经从源代码中删除了任何东西,并且只使用了一个空的 main 函数:

#if defined(linux) || defined(__linux)
int main()
{

   return 0;
}
#endif

故障存在。我尝试了 Xubuntu 13.10 32 位和 64 位版本。两者都存在故障。 GDB 报告:

Program received signal SIGABRT, Aborted.
0x00007ffff6c33f77 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

编辑:

同时我发现问题出在我的单例实现上。此实现在与 GCC 4.8 和 Xubuntu 13.04 握手时成功地与 MinGW-64 一起工作:

namespace binrev{
namespace brCore{

template <typename T>
class DLL_EXPORT brSingleton
{
   public:
   static T& getInstance()
   {
  std::call_once(m_once, safe_create);   
      return *m_instance;        
   }

   protected:
   brSingleton(const std::string& name)
   : m_name(name)
   {}

   static void safe_create() {
  brSingleton::m_instance.reset(new T());
   }

   brSingleton(const brSingleton& rs) = delete;
   brSingleton& operator = (const brSingleton& rs) = delete;

   virtual ~brSingleton(){}

protected:
   static std::unique_ptr<T> m_instance;
   static std::once_flag m_once;         
   std::string m_name;
};
template<typename T> 
std::once_flag brSingleton<T>::m_once;
}// ns-brCore
}// ns-binrev

如果我在具体的单例实现中调用 getInstance,则会在 std::call_once 函数调用上发生崩溃。

我的想法已经不多了。有谁知道出了什么问题? 谢谢。

【问题讨论】:

  • 你是如何安装 GCC 4.8.1 的?你是自己编译的,还是 Xubuntu 包?如果您自己编译它,那么您应该考虑从头开始重新编译。如果它是一个 Xubuntu 包,那么你应该寻找 Xubuntu 支持论坛。
  • 我使用的是 xubuntu 安装。同时我发现肯定有源问题,纯main函数现在可以工作了。
  • 不是编程问题,而是分发/打包问题,因此它不在 SO 上。

标签: c++ gnu xubuntu g++4.8


【解决方案1】:

第四次安装 xubuntu 13.10 64bit 后问题解决。我认为 syam 在安装过程中提到了一些包装损坏。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-15
    • 2023-03-03
    相关资源
    最近更新 更多