Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate .o and .a files from PKG_LIBS in g++ command #51

Closed
pooryorick opened this issue Aug 25, 2015 · 1 comment
Closed

duplicate .o and .a files from PKG_LIBS in g++ command #51

pooryorick opened this issue Aug 25, 2015 · 1 comment

Comments

@pooryorick
Copy link

I'm using an older version of R (3.0.2), but ran into a problem where .o and .a files from the PKG_LIBS variable were showing up twice in the g++ command. The following Makevars worked better for me:

## Use the R_HOME indirection to support installations of multiple R version

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
FRAMEWORK = -framework CoreServices
endif

OBJECTS = RcppExports.o filedatasource-unix.o filedatasource-win.o http.o httpuv.o md5.o set_invalid_parameter.o uvutil.o websockets-base.o websockets-hixie76.o websockets-hybi03.o websockets-ietf.o websockets.o ./libuv/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o 

PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`  $(FRAMEWORK)
ifeq ($(UNAME), SunOS)
PKG_LIBS += -lkstat -lsendfile
endif
ifeq ($(UNAME), FreeBSD)
PKG_LIBS += -lkvm
endif

PKG_CPPFLAGS = -I./libuv/include -I./http-parser -I./sha1 -I./base64



.PHONY: all libuv/libuv.a http-parser/http-parser.o

all: $(SHLIB)
$(SHLIB): libuv/libuv.a http-parser/http-parser.o sha1/sha1.o base64/base64.o

libuv/libuv.a:
        $(MAKE) --directory=libuv \
                CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" \
    HAVE_DTRACE=0 \
                libuv.a

http-parser/http-parser.o:
        $(MAKE) --directory=http-parser \
                CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" \
                http_parser.o

sha1/sha1.o:
        (cd sha1 && $(CC) $(CFLAGS) $(CPICFLAGS) -c sha1.c -o sha1.o)

base64/base64.o:
        (cd base64 && $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c base64.cpp -o base64.o)
@wch
Copy link
Collaborator

wch commented Apr 13, 2018

Closing because we've since revamped the Makevars file. If there's still a problem, please reopen, or file another issue.

@wch wch closed this as completed Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants