【问题标题】:Cygwin, error for make "couldn't get proc lock" when compiling and running a C programCygwin,编译和运行 C 程序时“无法获得 proc lock”的错误
【发布时间】:2016-01-13 11:27:27
【问题描述】:

问题

我有一些半年前的 c 程序正在研究,并希望我现在可以继续研究它们。在那之后我确实安装了 Windows 10(64 位),所以我认为这可能是一个问题,但从那时起这些程序就已经在 Windows 10 上运行了。

大约 2 个月前,我可以使用 make-file 构建并运行可执行文件,但是当我今天再次尝试时,在我看来可执行文件没有运行。我现在也尝试更新 cygwin 和(我认为)所有相关软件包。

如果 cygwin 有任何重要的更改,我已经用 Google 搜索过,但我并没有真正找到任何东西。

详情

当我尝试运行任何程序时,./executeables/helloworld.exe 行很长一段时间都没有任何反应,然后最终产生错误:

$ make 1
gcc 1-helloworld.c -o ./executeables/helloworld.exe -lncurses
./executeables/helloworld.exe
      0 [sig] make 7332 get_proc_lock: Couldn't acquire sync_proc_subproc for(5, 1), last 7, Win32 error 0
   1324 [sig] make 7332 proc_subproc: couldn't get proc lock. what 5, val 1

在此之后,什么都没有发生,我什至无法用ctrl+C 停止进程,所以我必须用任务管理器结束“make.exe”(奇怪的是它包含 2 个进程)。然后终端只说

makefile:2: recipe for target '1' failed
make: *** [1] Error 1

所以我猜想从 Windows 获取互斥锁或锁来创建进程存在问题,但我不知道为什么会发生这种情况。

代码

本次尝试中的示例将此代码用于 hello world 程序,但对于更复杂的程序也是如此。

#include <ncurses.h>
#include <string.h>

int main() {
    char *message="Hello World";
    int row,col;
    int len = strlen(message);

    initscr();
    
    getmaxyx(stdscr, row, col);                  //screensize
    mvprintw(row/2, (col-len)/2, "%s", message); //center of screen
    getch();
    
    refresh();
    endwin();
    
    return 0;
}

以前有人见过这个问题吗?

【问题讨论】:

    标签: windows makefile cygwin ncurses


    【解决方案1】:

    Avast 杀毒软件 阻止了程序正常运行。禁用它使一切运行完美。我终于在这个帖子里找到了答案:

    Netbeans 8.1 IDE compiles and builds C programs but does not show their output

    注意: 由于它没有被标记为该线程中问题的答案,并且因为该问题没有明确关注相同的错误(尽管呈现相同的错误),所以我将保留我的问题而不是将其标记为重复。

    感谢 Sheshadri Iyengar 提供解决方案。

    【讨论】:

    • 谢谢,这真的很不明显!
    • 谢谢,也解决了我的问题(配置挂起)。我为avast中的cygwin64文件夹做了一个例外,并且能够继续。我能够使用 ctrl-z 使进程进入睡眠状态,并使用 kill %n 来终止作业。
    猜你喜欢
    • 2015-11-03
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多