Skip to content

[Rcpp-devel] RInside: compiling examples (ubuntu)

3 messages · Darren Cook, Dirk Eddelbuettel

#
On 25 August 2011 at 19:00, Darren Cook wrote:
| Hello Dirk,
| Should RInside questions go to the rcpp-devel list too? (If so feel free

Yes they should. There are old questions too you can search.

| to reply to this question there.)

Ok, CCing the list. I prefer complete threads so post there next time please.
 
| I'm using Ubuntu 10.04, have installed RInside from CRAN, and all my
| paths should be defaults. (R version is 2.13.1, installed from
| lucid/universe on my CRAN mirror, cran.md.tsukuba.ac.jp)
| 
| When I try this:
|   cd /usr/local/lib/R/site-library/RInside/examples/standard
|   make

Works here:

edd at max:~$ cd svn/rinside/pkg/inst/examples/standard/
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make clean
rm -vf rinside_callbacks0 rinside_module_sample0 rinside_sample0 rinside_sample10 rinside_sample11 rinside_sample1 rinside_sample2 rinside_sample3 rinside_sample4 rinside_sample5 rinside_sample6 rinside_sample7 rinside_sample8 rinside_sample9 rinside_test0 rinside_test1
removed `rinside_callbacks0'
removed `rinside_module_sample0'
removed `rinside_sample0'
removed `rinside_sample10'
removed `rinside_sample11'
removed `rinside_sample1'
removed `rinside_sample2'
removed `rinside_sample3'
removed `rinside_sample4'
removed `rinside_sample5'
removed `rinside_sample6'
removed `rinside_sample7'
removed `rinside_sample8'
removed `rinside_sample9'
removed `rinside_test0'
removed `rinside_test1'
rm -vrf *.dSYM
edd at max:~/svn/rinside/pkg/inst/examples/standard$ make
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_callbacks0.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_callbacks0
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_module_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_module_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
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_sample10.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_sample10
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_sample11.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_sample11
[...]

Please debug inside the Makefile by adding a new target and echoing some of
the values being set.

| I get these errors:
| 
| make: WARNING:: Command not found
| make: WARNING:: Command not found
| make: WARNING:: Command not found
| make: WARNING:: Command not found
| /bin/sh: WARNING:: not found
| /bin/sh: WARNING:: not found
| /bin/sh: WARNING:: not found
| /bin/sh: WARNING:: not found
| make: WARNING:: Command not found
| make: WARNING:: Command not found
| make: WARNING:: Command not found
| Wall    rinside_callbacks0.cpp        -o rinside_callbacks0
| make: Wall: Command not found
| make: [rinside_callbacks0] Error 127 (ignored)
|  (then same three errors for each source file)
| 
| 
| For my first test program I actually bypassed the Makefile, and just
| used it as a guide to build up this command:
| 
| g++ -I/usr/local/lib/R/site-library/Rcpp/include
| -I/usr/local/lib/R/site-library/RInside/include -I/usr/share/R/include
| -L/usr/lib64/R/lib -lR -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp
| -L/usr/local/lib/R/site-library/RInside/lib -lRInside
| -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -lRInside
| -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib main.cpp
| 
| Quite a monster, but it works, and makes an "a.out" program that runs
| correctly.
| 
| So RInside and all its deps are correctly installed, and I'm wondering
| if the Makefile is depending on some other system configuration that I
| don't have?

It is really just a shell / Makefile interaction as you can see in the
Makefile.  Works for me and many others too....

Dirk

 
| Darren
| 
| -- 
| Darren Cook, Software Researcher/Developer
| 
| http://dcook.org/work/ (About me and my work)
| http://dcook.org/blogs.html (My blogs and articles)
#
Thanks, Dirk, for the makefile debugging tip. It seems this line:
   R_HOME := 		$(shell R RHOME)

goes horribly wrong if R reports a warning. It was outputting:
  WARNING: ignoring environment value of R_HOME
  /usr/lib64/R

I cannot find any commandline parameters that will shut it up. :-(

One idea for a Makefile fix is: only setting R_HOME if no environment
variable already set. Is there a use case where someone has set R_HOME
in their environment, but does not want to use it, and instead wants to
use what "R RHOME" outputs?

Darren

P.S. Going back to my machine it appears that R_HOME is set to
/usr/lib/R; when I explicitly set it to /usr/lib64/R the warning goes away.
/usr/lib64 is a symlink to /usr/lib, so the warning is just noise. It
has not affected compiling any R packages, or using Rcpp, inline, etc.

The problem setting was found in /etc/environment, and may have been
leftover from an earlier R installation. Also, it seems the "R RHOME"
command is hyper-sensitive: If I set R_HOME to "/usr/lib64/R/" it still
complains. I need to remove the trailing slash to appease it.
#
On 25 August 2011 at 22:34, Darren Cook wrote:
| > | I get these errors:
| > | 
| > | make: WARNING:: Command not found
| > | make: WARNING:: Command not found
| > ...
| > | So RInside and all its deps are correctly installed, and I'm wondering
| > | if the Makefile is depending on some other system configuration that I
| > | don't have?
| > 
| > It is really just a shell / Makefile interaction as you can see in the
| > Makefile.  Works for me and many others too....
| 
| Thanks, Dirk, for the makefile debugging tip. It seems this line:
|    R_HOME := 		$(shell R RHOME)
| 
| goes horribly wrong if R reports a warning. It was outputting:
|   WARNING: ignoring environment value of R_HOME
|   /usr/lib64/R
| 
| I cannot find any commandline parameters that will shut it up. :-(

I see.  Classic local fsck up though :)
 
| One idea for a Makefile fix is: only setting R_HOME if no environment
| variable already set. 

Patches welcome.  I think there is even an idiom for that but I always get
lost whether that was shell or makefile syntax.

| Is there a use case where someone has set R_HOME
| in their environment, but does not want to use it, and instead wants to
| use what "R RHOME" outputs?

Yes. Many R (Core) developers have several R installations and use $PATH or
other variables to point to it. This can reflect it. 

If you need something different you can always hardcode it. It /just/ an
example Makefile and I do not plan to replace or augment it with a full-blown
configure script.
 
| Darren
| 
| P.S. Going back to my machine it appears that R_HOME is set to
| /usr/lib/R; when I explicitly set it to /usr/lib64/R the warning goes away.
| /usr/lib64 is a symlink to /usr/lib, so the warning is just noise. It
| has not affected compiling any R packages, or using Rcpp, inline, etc.
| 
| The problem setting was found in /etc/environment, and may have been
| leftover from an earlier R installation. Also, it seems the "R RHOME"
| command is hyper-sensitive: If I set R_HOME to "/usr/lib64/R/" it still
| complains. I need to remove the trailing slash to appease it.

Still "merely" your issue and nothing that generalizes. I happen to be the
Debian maintainer for R, and hence also indirectly behind what may be a few
ten thousand (or more?) Ubuntu R installations which "just work" if you use
them as packaged, either by the distro or via the more current backports from
CRAN.  

If someone breaks their local R installation by various enhancements, they
get to keep the pieces. And you can always apply to get your money
back. Transfers of zero dollars are near-instantaneous.

Cheers,  Dirk


| -- 
| Darren Cook, Software Researcher/Developer
| 
| http://dcook.org/work/ (About me and my work)
| http://dcook.org/blogs.html (My blogs and articles)
| _______________________________________________
| 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