Cygwin 3.3.4 程序随机结束

发布于 2025-01-16 13:07:52 字数 1960 浏览 4 评论 0原文

我正在寻找提示来找到我必须调查的方向。

我有一个小的 c++ 项目,在我的旧 cygwin (3.0.4(0.338/5/3)) 和 debian distrib 上都运行良好(感谢 Posix) 在这个项目中,我使用了一些库,如 log4cplus(cxxTest、rapidJson,...)

现在我必须升级我的 cygwin。因此,我安装了与之前版本完全分开的新版本 cygwin (3.3.4(0.341/5/3))。使用这个新的 cygwin,我有 2 个问题:

  • 真正的问题:我的程序有时(10 次中有 2 次)运行良好,没有问题。很多时候,程序什么都不做,没有任何信息就结束了。
  • 第二个问题是 gdb (GNU gdb (GDB) (Cygwin 10.2-1) 10.2) :不会调试我的程序。每次我尝试时:
gdb: unknown target exception 0x80000001 at 0x7ffc741dd147
Thread 9 received signal ?, Unknown signal.

为了找到问题,我编写了一个非常简单的代码来重现该问题。最后,这非常简单,我这样做:

#include <iostream>
#include <log4cplus/initializer.h>
#include <log4cplus/configurator.h>

using namespace std;

/// ***************************************************************************
/// Initialisation of log4cplus library
/// ***************************************************************************
void log4cplusInit() {
    try {
        log4cplus::initialize();
        //log4cplus::PropertyConfigurator::doConfigure("config/log4cplus.ini");
    }
    catch(std::exception& e)
    {
        cout << e.what() << endl;
    }
    catch(...) {
        cout << "Unexpected exception" << std::endl;
    }
}

int main() {
    //log4cplusInit();
    cout << "Hello World " << endl;
}

我已经找到/尝试的事情:

  • 如果我注释行 log4cplus::initialize(); 程序就可以工作。
  • 两行 log4cplus::XXXX 具有相同的影响:如果存在这一行之一,则我有错误,如果这两行都被注释,那么一切都很好
  • try catch 永远不会捕获
  • 我尝试捕获的 任何内容对于 gdb 问题,在找到此 trhead 之前的每个信号:cygwin gdb 程序收到信号?,未知信号(但没有帮助我)
  • 我不明白为什么未使用的代码可能会产生这种影响(log4cplusInit() 被注释并且从未被调用)

所以我正在寻找一个可以开始的想法。我想调查这个错误,但我没有任何线索。

PS:我已经在 log4cplus github 中打开了一个问题。不知道我是否必须在 cygwin 中打开一个

任何帮助将不胜感激:)

I'm looking for tips to find a direction where I have to investigate.

I have a little c++ project that works well both on my old cygwin (3.0.4(0.338/5/3)) and on a debian distrib (thanks to Posix)
In this project I use some libraries like log4cplus (cxxTest, rapidJson, ...)

Now I had to upgrade my cygwin. So I install a new version of cygwin (3.3.4(0.341/5/3)) totally separated from the previous one. With this new cygwin, I have 2 problems:

  • The real problem : my program sometimes (2 of 10 times) work well without problem. And very often the program did nothing and end without any information
  • The second problem is that gdb (GNU gdb (GDB) (Cygwin 10.2-1) 10.2) : won't debug my program. Each time I try I have :
gdb: unknown target exception 0x80000001 at 0x7ffc741dd147
Thread 9 received signal ?, Unknown signal.

In order to find the problem I make a very simple code to reproduce the problem. And finally it was very simple, I do this :

#include <iostream>
#include <log4cplus/initializer.h>
#include <log4cplus/configurator.h>

using namespace std;

/// ***************************************************************************
/// Initialisation of log4cplus library
/// ***************************************************************************
void log4cplusInit() {
    try {
        log4cplus::initialize();
        //log4cplus::PropertyConfigurator::doConfigure("config/log4cplus.ini");
    }
    catch(std::exception& e)
    {
        cout << e.what() << endl;
    }
    catch(...) {
        cout << "Unexpected exception" << std::endl;
    }
}

int main() {
    //log4cplusInit();
    cout << "Hello World " << endl;
}

Things that I already find/try :

  • If I comment the line log4cplus::initialize(); The program works.
  • The 2 Lines log4cplus::XXXX have the same impact : if one of this line is present, I have the bug, If both are commented then everything is fine
  • The try catch never catch anything
  • I try to catch every signal, for gdb problem, before finding this trhead : cygwin gdb Program received signal ?, Unknown signal (but didn't help me)
  • I don't understand why an unused code could have this impact (log4cplusInit() is commented and never called)

So I'm looking for an idea where I can start. I want to investigate this bug, but I have no clue.

PS: I already have open an issue in log4cplus github. Don't know if I have to open one in cygwin

Any help will be appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴梦长久 2025-01-23 13:07:52

对于将来阅读此帖子的每个人:

我并没有真正在 Cygwin 中找到解决方案,但就像@Alan Birtles 提到的那样:使用 WSL(或其他更新的解决方案)。
它就像一个魅力。感谢微软;)

For every people who read this thread in future :

I don't really find a solution in Cygwin, but like @Alan Birtles mention : Use WSL (or another updated solution).
It work like a charm. thanks to microsoft ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文