[Rcpp-devel] [OT] Asking for a quick OS X favour

John Buonagurio jbuonagurio at exponent.com
Mon May 12 20:28:53 CEST 2014


Hi Dirk,

> If anybody primarily on Windows would like to help building a zipfile with 32 and 64 bit static libraries of hiredis so that RcppRedis binaries could be built by CRAN, let me know.  This should be pretty straightforward...

I built static libraries of hiredis in Visual Studio using the official Microsoft Redis 2.6.12 fork (https://github.com/MSOpenTech/Redis), but the Rtools binutils linker doesn't recognize them: "Recognised but unhandled machine type (0x8664) in Import Library Format archive."

As the Microsoft form isn't setup for MinGW builds, I used hiredis from Dušan Majkic's older Redis 2.4 fork (https://github.com/dmajkic/redis) and built as follows (x64 version):

gcc -m64 -c -std=gnu99 -pedantic -O3 -Wall -W -D_ISOC99_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -Wwrite-strings -g -ggdb  net.c
gcc -m64 -c -std=gnu99 -pedantic -O3 -Wall -W -D_ISOC99_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -Wwrite-strings -g -ggdb  hiredis.c
gcc -m64 -c -std=gnu99 -pedantic -O3 -Wall -W -D_ISOC99_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -Wwrite-strings -g -ggdb  sds.c
gcc -m64 -c -std=gnu99 -pedantic -O3 -Wall -W -D_ISOC99_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -Wwrite-strings -g -ggdb  async.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o

To compile Redis.cpp I had to #undef Realloc and Free after #include <Rcpp.h> due to a conflict with Windows headers (I'm sure there is a better solution):

#ifdef _WIN32
    #undef Realloc
    #undef Free
#endif

Compiled and linked as follows:

g++ -m64 -I"C:/R-3.1.0/include" -DNDEBUG -I"C:/R-3.1.0/library/Rcpp/include" -I"C:/R-3.1.0/library/RApiSerialize/include" -I"C:/redis-2.4/deps" -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
g++ -m64 -I"C:/R-3.1.0/include" -DNDEBUG -I"C:/R-3.1.0/library/Rcpp/include" -I"C:/R-3.1.0/library/RApiSerialize/include" -I"C:/redis-2.4/deps" -O2 -Wall  -mtune=core2 -c Redis.cpp -o Redis.o
g++ -m64 -shared -s -static-libgcc -o RcppRedis.dll RcppExports.o Redis.o -LC:/R-3.1.0/bin/x64 -LC:/redis-2.4/deps/hiredis -lR -lhiredis -lws2_32

I ran all RcppRedis unit tests and demos against Redis 2.4 and 2.6.12 servers with no issues. I can send you the static libraries now if you'd like, or would you prefer to work on getting MinGW to build the newer hiredis release?

Best,
John Buonagurio


-----Original Message-----
From: rcpp-devel-bounces at lists.r-forge.r-project.org [mailto:rcpp-devel-bounces at lists.r-forge.r-project.org] On Behalf Of Dirk Eddelbuettel
Sent: Monday, May 12, 2014 9:46 AM
To: Simon Urbanek
Cc: rcpp-devel
Subject: Re: [Rcpp-devel] [OT] Asking for a quick OS X favour


On 12 May 2014 at 08:51, Simon Urbanek wrote:
| The symlink is now there. The issue was caused by hiredis is not supporting either configure or DESTDIR so I had to build the tar ball by hand. There may be more issues caused by the lack of basic build features in hiredis, so let me know how it goes.

Thanks so much -- I actually checked your tarball this morning, saw that and sent a heads-up to CRAN so that they can re-test.  It should now build.

Is the missing DESTDIR a GNU make vs non-GNU make issue?  From my (somewhat) casual perusing of redis and its subordinated hiredis, both Linux and OS X are considered first-class citizens for the server.  I saw a note that Microsoft itself is working on/towards Windows support for the redis server.

If anybody primarily on Windows would like to help building a zipfile with 32 and 64 bit static libraries of hiredis so that RcppRedis binaries could be built by CRAN, let me know.  This should be pretty straightforward...

Dirk
 
| Cheers,
| Simon
| 
| Sent from my iPhone
| 
| > On May 11, 2014, at 13:45, Dirk Eddelbuettel <edd at debian.org> wrote:
| > 
| > 
| > On 11 May 2014 at 19:23, Romain François wrote:
| > | Works fine for me after installing hiredis from brew. 
| > | https://gist.github.com/romainfrancois/e70e6c49fdda9172b644
| > 
| > Thanks for chiming in. That is rather interesting, and per the gist 
| > 'how it should work'.
| > 
| > But what I do not get is that hiredis is really small and simple 
| > (three or four source files) and the makefile is straightforward:
| > 
| >       # Installation related variables and target
| >       PREFIX?=/usr/local
| >       INSTALL_INCLUDE_PATH= $(PREFIX)/include/hiredis
| > 
| >       install: $(DYLIBNAME) $(STLIBNAME)
| >                mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
| >                $(INSTALL) hiredis.h async.h adapters 
| > $(INSTALL_INCLUDE_PATH)
| > 
| > I just don't see how the '$(PREFIX)/include/hiredis' can drop the 
| > hiredis/ directory in that cmmand.  Yet Hao, Baptiste (off-list), 
| > Simon (on his first attempt, building the library the normal way) 
| > all end up with /usr/local/include/hiredis.h which then breaks the 
| > use via
| > 
| >   #include <hiredis/hiredis.h>
| > 
| > as there is no hiredis/ directory.  I don't see what's going on, but 
| > I don't fully grok the (home)brew versus normal install dichotomy on 
| > CRAN, and in which case one is better off with Simon's tarballs 
| > (always?) versus (home)brew.
| > 
| > The good news is that Simon, wonderful as he is, is looking into 
| > adding a symlink in the tarball under which the package would 
| > install.  We'll see how it goes.
| > 
| > Dirk
| > 
| > 
| > | 
| > | Le 11 mai 2014 à 19:05, Dirk Eddelbuettel <edd at debian.org> a écrit :
| > | 
| > | > 
| > | > On 11 May 2014 at 09:41, Hao Ye wrote:
| > | > |     So why does the directory   /usr/include/hiredis   get omitted on OS X?
| > | > | 
| > | > | 
| > | > | I think this might be a general quirk on OS X. I recall having 
| > | > | to manually set the "-I/usr/local/include" flag for any compilations that need local libraries.
| > | > 
| > | > The quirk is that actually __breaks__ a lot of code on the 
| > | > Intertubes. I did a sporadic check finding things the python 
| > | > hiredis binding and rsyslog logging framework all of which can 
| > | > build with hireds --- and of which have
| > | > 
| > | >        #include <hiredis/hiredis.h>
| > | > 
| > | > which the OS X install just broke. How lovely. 
| > | > 
| > | > Dirk
| > | > 
| > | > | Best,
| > | > | --
| > | > | Hao Ye
| > | > | hye at ucsd.edu
| > | > | 
| > | > | 
| > | > | On Sun, May 11, 2014 at 9:24 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
| > | > | 
| > | > | 
| > | > |     Hi Hao,
| > | > | 
| > | > |     Thanks for the quick reply.
| > | > | 
| > | > |     On 11 May 2014 at 09:00, Hao Ye wrote:
| > | > |     | Hi Dirk,
| > | > |     |
| > | > |     | Did [2], then [1]. No build errors, but I get the following warnings:
| > | > |     |
| > | > |     | > checking hiredis/hiredis.h usability... configure: WARNING: Hiredis
| > | > |     headers not found with via default CXXFLAGS and CPPFLAGS
| > | > |     | > configure: WARNING: manually trying /usr/local/include
| > | > |     | > configure: WARNING: Unsetting 
| > | > | ac_cv_header_hiredis_hiredis_h
| > | > | 
| > | > |     Ok, when I do 'make install' (or, in this case, make -n install) with
| > | > |     hiredis
| > | > |     I get (showing the relevant two out of maybe twelve lines)
| > | > | 
| > | > |     mkdir -p /usr/local/include/hiredis /usr/local/lib
| > | > |     cp -a hiredis.h async.h adapters 
| > | > | /usr/local/include/hiredis
| > | > | 
| > | > |     which is congruent with hiredis' Makefile which has
| > | > | 
| > | > |     # Installation related variables and target
| > | > |     PREFIX?=/usr/local
| > | > |     INSTALL_INCLUDE_PATH= $(PREFIX)/include/hiredis
| > | > | 
| > | > |     So why does the directory   /usr/include/hiredis   get omitted on OS X?
| > | > |    
| > | > |     Dirk
| > | > |    
| > | > | 
| > | > |     | OS X 10.9.2
| > | > |     | compiler: Apple LLVM version 5.1 (clang-503.0.40)
| > | > |     | R: 3.0.2
| > | > |     |
| > | > |     | Best,
| > | > |     | --
| > | > |     | Hao Ye
| > | > |     | hye at ucsd.edu
| > | > |     |
| > | > |     | On May 11, 2014, at 8:11 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
| > | > |     |
| > | > |     | >
| > | > |     | > I'd appreciate if someone running OS X could run a quick test for me.
| > | > |      I am
| > | > |     | > getting RcppRedis (formerly rhiredis) ready for CRAN. As I had been
| > | > |     working
| > | > |     | > on this for a bit, I had some email with Simon who had already prepared
| > | > |     a
| > | > |     | > tarball of the required hiredis library.
| > | > |     | >
| > | > |     | > However, Simon's tarball contains   usr/local/include/hiredis.h   and
| > | > |     by my
| > | > |     | > reckoning based on a number of other projects using hiredis, as well as
| > | > |     | > hiredis's Makefile, this should be   usr/local/include/hiredis/
| > | > |     hiredis.h
| > | > |     | > as the standard use is '#include <hiredis/hiredis.h>' which won't work
| > | > |     with
| > | > |     | > his current layout.
| > | > |     | >
| > | > |     | > So here is goes:  Could someone on OS X quickly build RcppRedis [1]
| > | > |     against
| > | > |     | > either a local 'make; make install' of hiredis [2] -- or against
| > | > |     Simon's
| > | > |     | > tarball [3] but WITH the suggested modification from the last paragraph
| > | > |     (eg
| > | > |     | >  mkdir /usr/local/include/hiredis
| > | > |     | >  mv /usr/local/include/hiredis.h /usr/local/include/hiredis/
| > | > |     | > You also need the new-ish and small RApiSerialize package from CRAN.
| > | > |     | >
| > | > |     | > My current assumption is that my configure logic in the package is good
| > | > |     | > enough, and this would provide a litmus test I can't run myself for
| > | > |     lack of
| > | > |     | > an OS X box.
| > | > |     | >
| > | > |     | > Thanks a lot to whoever has a few minutes to spare on this.
| > | > |     | >
| > | > |     | > Dirk
| > | > |     | >
| > | > |     | >
| > | > |     | > [1] https://github.com/eddelbuettel/rcppredis
| > | > |     | > [2] https://github.com/redis/hiredis
| > | > |     | > [3] http://r.research.att.com/libs/hiredis-0.11.0-darwin10-bin2.tar.gz
| > | > |     | >
| > | > |     | > --
| > | > |     | > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| > | > |     | > _______________________________________________
| > | > |     | > Rcpp-devel mailing list
| > | > |     | > Rcpp-devel at lists.r-forge.r-project.org
| > | > |     | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| > | > |     |
| > | > | 
| > | > |     --
| > | > |     Dirk Eddelbuettel | edd at debian.org | 
| > | > | http://dirk.eddelbuettel.com
| > | > | 
| > | > | 
| > | > 
| > | > --
| > | > Dirk Eddelbuettel | edd at debian.org | 
| > | > http://dirk.eddelbuettel.com 
| > | > _______________________________________________
| > | > Rcpp-devel mailing list
| > | > Rcpp-devel at lists.r-forge.r-project.org
| > | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcp
| > | > p-devel
| > | 
| > 
| > --
| > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| > 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


More information about the Rcpp-devel mailing list