[Rcpp-devel] Rcpp question regarding compilation of another package

khagay nagdimov kh.guy at hotmail.com
Tue Dec 13 18:50:24 CET 2016


Thank you Dirk for all the help, it is very much appreciated.


I have made the changes you recommend and pushed them onto the GitHub page (https://github.com/KhagayN/SeqLibr). I realized that the bwa directory isn't necessary because src/SeqLib/bwa is an entire copy of it. I changed the PKG_CPPFLAGS to reflect that bwa directory via -ISeqLib/bwa/


Do you think that is acceptable? I will follow your guidance.


If so, I get an error after running load_all()
   Error in dyn.load(dllfile)

unable to load shared object 'subsetSeqLib.so': mem_opt_init


That function is defined in src/SeqLib/bwa/bwamem.c.


________________________________
From: Dirk Eddelbuettel <edd at debian.org>
Sent: Tuesday, December 13, 2016 8:31:11 AM
To: khagay nagdimov
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] Rcpp question regarding compilation of another package


Thanks for posting here, and showing complete references. Your earlier
StackOverflow questions went nowhere.  Hopefully we can tackle this here.

On 12 December 2016 at 17:32, khagay nagdimov wrote:
| I am trying to create a package that uses Rcpp to translate code from SeqLib (
| https://github.com/walaj/SeqLib) into R. I have compiled SeqLib but, I still
| have problems referencing the function definitions. The current structure of my
| R package is shown here: https://github.com/KhagayN/SeqLibr

A bit of a mess. The repo is full of object files (.o), editor backups (*~),
editor temp files (#*#).  But at least you are using the right editor.

I have no experience with git submodules and cannot say wether SeqLib again
in SeqLibR is a good idea.

| My makevars links to the location of the header files and to the static
| libraries. To my understanding, the header files linked via PKG_CXXFLAGS point
| to the header files and PKG_LIBS points to the static libraries. Then, in

The Makevars is suspicious:

    ## the following flags are for PreProcessor.
    PKG_CPPFLAGS= -I../bwa/ -I../ -I../src/SeqLib/*

First, the ../bwa/ directory does not work.  R includes _everything below
inst/_ but only a few known directories at the top-level.  This is why we all
put headers into inst/include/ --- so I would make **very strongly** suggest
you move bwa/ into inst/include/bwa and then use -I../inst/include/bwa.

Second, you are in src/ so ../src/ makes no sense. Make that -ISeqLib/

Third, there is no notion of wildcards in include directories.  So -ISeqLib/

Fourth, for SeqLib you do

   ( cd SeqLib; ./configure; make; make install; )

and you _almost surely_ should not run 'make install'.  The rest of your
src/Makevars is trying to use the static library from that directory; make
install would attempt to write the library somewhere else.  "Writing R
Extensions* _explicitly_ prohibits that for good reason.

I stop here.  Other failures related to loading object are likely due to
these issues which you probably want to correct first.

Dirk


| rcpp_hello_world.cpp, I reference a function called Open within the FastqReader
| class within the SeqLib namespace but, when I run load_all() I get an effor
| saying:
|
|
| Error in dyn.load(dllfile);
|
|    unable to load shared object 'subsetSeqLib.so': undefined symbol:
| _ZN6SeqLib11FastqReader40OpenERKSs, which references that Open function from
| FastqReader. I don't understand why this is happening since I am linked to the
| static libraries that have the definition of that function.
|
|
| Thanks for all the help.
|
|
|
| _______________________________________________
| 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

--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20161213/55b366f1/attachment-0001.html>


More information about the Rcpp-devel mailing list