'SIGPIPE': undeclared identifier in luasocket-2.0.2

1.3k views Asked by At

I am trying to compile luasocket-2.0.2 (or: luasocket) but as I try to do so, some macros appear to be undefined. Namely:

identifier "SIGPIPE" is undefined
identifier "F_GETFL" is undefined
identifier "O_NONBLOCK" is undefined
identifier "F_SETFL" is undefined

If I google this I see that signal.h has to be included for this. I didn't change the code or anything and as you'd expect, the headers are included:

#include <string.h> 
#include <signal.h>

#include "socket.h"

Not quite sure what I am missing here.

I try to compile this for Windows.

Compiler Flags:

/GS /analyze- /W3 /Zc:wchar_t /I"E:\git\luasocket-2.0.2\../luaext-linker/include" /ZI /Gm /Od /Fd"mime\Debug\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "MIME_EXPORTS" /D "MIME_API=__declspec(dllexport)" /D "_WINDLL" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"mime\Debug\" /EHsc /nologo /Fo"mime\Debug\" /Fp"mime\Debug\mime.pch" 

The errors occur in usocket.c of the socket project:

"SIGPIPE" is undefined  socket  e:\git\luasocket-2.0.2\src\usocket.c    80
... 
2

There are 2 answers

0
Sergio On BEST ANSWER

Seems like usocket.c is a Unix-specific source.

/*=========================================================================*\
* Socket compatibilization module for Unix
* LuaSocket toolkit

You shouldn't try to include it into Win-targeted builds (unless you are using Cygwin). Also socket.vcxproj doesn't mention this file in the sourceset. That confirms previous suggestion.

If you've decided to built it via win32.cmd script - correct path to prefix, since script uses hardcoded one:

make LUAPREFIX_win32='c:\cygwin\home\diego\vc12' LUAV=5.1 PLAT=win32 LUALIBNAME_win32=lualib.lib PLATFORM_win32=Debug install-both
1
Charlie Martin On

Okay, it's in your compile flags. I can't look on your system from here, but the /I flags are where it is happening, and the issue is that signal.h isn't in any of those directories.

This is probably some kind of bug in the package itself. Report this to the developers, and in the meantime, find signal.h and copy it into one of the include directories as a workaround.