[Rcpp-devel] Help on compilation of Rcpp and RInside
deqiang sun
deqiangs at bcm.edu
Fri Apr 8 00:55:55 CEST 2011
Hi Dirk,
Thanks for your help.
I did not see that there's a Makefile in the example folder:) I felt like an idiot.
I just put Makefile under Eclipse source folder and it compiles/links. All tests passed, though I have to remove older version of R and install the required newer version of R to avoid the embeded R interpreter error.
By the way, I posted twice because I did not receive the email I sent and thought it is failed to mail out. Of couse, I then found out I was on the digest mode.
Best regards,
Deqiang Sun
On Apr 7, 2011, at 6:55 AM, Dirk Eddelbuettel wrote:
>
> (Please don't post twice.)
>
> On 7 April 2011 at 05:20, deqiang sun wrote:
> | Hi all,
> |
> | Could someone help me on compilation of the RInside/inst/examples/standard/rinside_sample0.cpp. This example is the project Rinside0 created by eclipse.
> |
> | And here is the error message for build.
> |
> | **** Build of configuration Debug for project Rinside0 ****
> | make all
> | Building file: ../src/Rinside0.cpp
> | Invoking: GCC C++ Compiler
> | g++ -I/home/deqiangs/workspace/RInside -I/home/deqiangs/workspace/Rcpp -I/home/deqiangs/workspace/RInside/inst/include -I/home/deqiangs/workspace/Rcpp/inst/include -I/usr/local/lib64/R/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Rinside0.d" -MT"src/Rinside0.d" -o"src/Rinside0.o" "../src/Rinside0.cpp"
> | Finished building: ../src/Rinside0.cpp
> |
> | Building target: Rinside0
> | Invoking: GCC C++ Linker
> | g++ -o"Rinside0" ./src/Rinside0.o
>
> No linking!
>
> | ./src/Rinside0.o: In function `main':
> | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:17: undefined reference to `RInside::RInside(int, char const* const*, bool)'
> | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:19: undefined reference to `RInside::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
> | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:21: undefined reference to `RInside::parseEvalQ(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
> | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:23: undefined reference to `RInside::~RInside()'
> | ./src/Rinside0.o: In function `Rcpp::wrap(char const*)':
> | ~/workspace/Rcpp/inst/include/Rcpp/internal/wrap.h:781: undefined reference to `Rf_mkString'
> | ./src/Rinside0.o: In function `bool Rcpp::Environment::assign<char [15]>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [15]) const':
> | ~/workspace/Rcpp/inst/include/Rcpp/Environment.h:270: undefined reference to `Rcpp::Environment::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SEXPREC*) const'
> | ./src/Rinside0.o:(.gcc_except_table+0x10): undefined reference to `typeinfo for Rcpp::binding_is_locked'
> | collect2: ld returned 1 exit status
> | make: *** [Rinside0] Error 1
>
> This is obviously an issue with the linker so you have to find out how you
> tell Eclipse to tell gcc (and hence ld) about the libraries.
>
> | How should I setup the environment so that the compiler/linker work seamlessly? I can not find any documentation on this.
>
> It all works -- using the supplied Makefile. You chose not to use it, you
> need to 'port' it to your preferred build tool.
>
> The relevant lines are
>
> LDLIBS := $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)
>
> as well as all the lines filling the variables uses here. When I build first
> example, it ends up being (and note that paths etc depend on local
> installations)
>
> edd at max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample0
> g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall rinside_sample0.cpp -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample0
> edd at max:~/svn/rinside/pkg/inst/examples/standard$
>
> You could always use make if the Eclipse build tool cannot be tamed...
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list