[Rcpp-devel] Building RProtoBuf on Windows
John Buonagurio
jbuonagurio at exponent.com
Tue Mar 19 16:33:45 CET 2013
Hi all,
I hope this is the best list for this question. I am attempting to build RProtoBuf on Windows - has anyone made recent progress on this and could you provide any suggestions? I managed to build the DLL with protobuf-2.5.0 and GCC 4.4 (MinGW) by making only a few changes to the source, but it fails to load in R:
1. DESCRIPTION: removed "OS_type: unix" and "X-CRAN-Original-OS_type: unix"
2. SocketCopyingInputStream.h: removed includes of <netinet/tcp.h>, <sys/types.h> and <sys/socket.h> -- these are already conditionally included in sisocks.h?
3. SocketCopyingInputStream.cpp: added explicit cast of void* to char* in recv function (Winsock convention)
4. sisocks.h: added "#undef Realloc" and "#undef Free" due to conflict with win32 headers (per some StackOverflow discussion here: http://stackoverflow.com/a/11593943 ), and had to remove this bit of code:
#if defined __GNUC__ && !defined unix && !defined Win32 /* MacOS X hack (gcc on any platform should behave as unix - except for Win32, where we need to keep using winsock) */
#define unix
#endif
Finally, I ran ./configure in MSYS and added -lwsock32 to the makefile before running R CMD INSTALL. The R process crashed when loading with a generic error: "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ERROR: loading failed." I should note that I'm already using the protobuf library linked here in another project with no issues.
I was hesitant to make the changes to sisocks.h because somehow it seems to build correctly in the Rserve distribution through a complex system of preprocessor macros - I intend to look at that build process more in-depth and try to debug this with GDB, but could anyone provide any suggestions going forward? Do you think it's even worth attempting to get this working in Windows?
Thanks,
John
More information about the Rcpp-devel
mailing list