c-无法在windows上生成libevent



所以我一直在尝试在Windows上构建libevent。然而,当我运行nmake MakeFile.nmake时,它一直给我以下输出。。。

cl /IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H /I.  
/Ox /W3 /wd4996 /nologo /c event.c buffer.c bufferevent.c bufferevent_sock.c bufferevent_pair.c 
listener.c evmap.c log.c evutil.c strlcpy.c signal.c bufferevent_filter.c evthread.c bufferevent_ratelim.c 
evutil_rand.c evutil_time.c win32select.c evthread_win32.c buffer_iocp.c event_iocp.c bufferevent_async.c 
event.c
event.c(31): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
buffer.c
buffer.c(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
bufferevent.c
bufferevent.c(31): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
bufferevent_sock.c
bufferevent_sock.c(32): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
bufferevent_pair.c
bufferevent_pair.c(29): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
listener.c
listener.c(30): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
evmap.c
evmap.c(30): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
log.c
log.c(44): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
evutil.c
evutil.c(31): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
strlcpy.c
strlcpy.c(37): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
signal.c
signal.c(34): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
bufferevent_filter.c
bufferevent_filter.c(31): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
evthread.c
evthread.c(34): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
bufferevent_ratelim.c
bufferevent_ratelim.c(30): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory
evutil_rand.c
evutil_rand.c(38): fatal error C1083: Cannot open include file: 'limits.h': No such file or directory
evutil_time.c
evutil_time.c(31): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
win32select.c
win32select.c(33): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
evthread_win32.c
evthread_win32.c(34): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
buffer_iocp.c
includeevent2/buffer.h(82): fatal error C1083: Cannot open include file: 'stdarg.h': No such file or directory
event_iocp.c
event_iocp.c(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
Generating Code...
Compiling...
bufferevent_async.c
bufferevent_async.c(36): fatal error C1083: Cannot open include file: 'errno.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 14.0
VCbincl.EXE"' : return code '0x2'
Stop.

它似乎找不到某些文件。所以我找到了winsock2.h和其他文件所在的目录,并在这些文件中添加了一个环境变量,但我仍然会收到同样的错误。我还注意到,在我的系统上实际上找不到sys/types.h和limites.h。如果有人能帮我找出这个问题的原因,我将不胜感激。谢谢

更新:因此,我已经确定了系统上所需的所有文件的位置,并尝试将环境变量添加到适当的目录中,但是,当我运行nmake时,仍然找不到它们。

libevent README.md文件不建议使用nmake。它指出你使用CMake,而现有的Makefile.nake在顶部有一条大评论,暗示它可能不起作用。因此,安装cmake(您可以使用Chocolatey的'choco-install-cmake'(,然后按照文档中的说明运行命令。

mkdir build
cmake -DEVENT__DISABLE_OPENSSL=ON ..
cmake --build .

这对我使用Visual Studio 2017和分支版本2.1.8-stable的git checkout起到了作用。我添加了禁用openssl选项,因为没有这个选项它就失败了,我不想花时间单独安装它。

相关内容

  • 没有找到相关文章

最新更新