Build Windows(MSYS2)内置的OpenOCD无法创建套接字

Build Windows(MSYS2)内置的OpenOCD无法创建套接字,build,configure,openocd,Build,Configure,Openocd,我已经从中克隆了openOCD 并使用MSYS2(MINGW32)shell构建了它。构建顺利通过,尝试执行时失败,并给出错误“error:error creating socket” 我启用了调试选项,发现它来自server.c文件。 我正在使用64位Windows 10 PC进行构建 错误来自下面的代码段 c->fd = socket(AF_INET, SOCK_STREAM, 0); if (c->fd == -1) { LOG_ERROR("e

我已经从中克隆了openOCD 并使用MSYS2(MINGW32)shell构建了它。构建顺利通过,尝试执行时失败,并给出错误“error:error creating socket”

我启用了调试选项,发现它来自server.c文件。 我正在使用64位Windows 10 PC进行构建

错误来自下面的代码段

    c->fd = socket(AF_INET, SOCK_STREAM, 0);
    if (c->fd == -1) {
        LOG_ERROR("error creating socket: %s", strerror(errno));
        exit(-1);
    }
我注意到,必须为WIN32 build启用的宏尚未启用,如果启用,将调用windows特定的套接字函数

int server_preinit(void)
{
/* this currently only calls WSAStartup on native win32 systems
 * before any socket operations are performed.
 * This is an issue if you call init in your config script */

#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;

wVersionRequested = MAKEWORD(2, 2);

if (WSAStartup(wVersionRequested, &wsaData) != 0) {
    LOG_ERROR("Failed to Open Winsock");
    exit(-1);
}

/* register ctrl-c handler */
SetConsoleCtrlHandler(ControlHandler, TRUE);

signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
signal(SIGBREAK, sig_handler);
signal(SIGABRT, sig_handler);
#endif

return ERROR_OK;
}
我手动启用了此宏,但编译失败

有人能帮我确定我在配置openOCD时是否遗漏了什么吗?
我仅通过“-disable werror”选项调用配置脚本

您需要使用MinGW编译器而不是MSYS编译器构建OpenOCD。您可以尝试使用来自的脚本。 该链接还描述了如何在MSYS下安装MinGW