eddelbuettel / rcppziggurat

Rcpp bindings for different Ziggurat RNG implementations
Other
12 stars 4 forks source link

rcppziggurat installation fails on linux #12

Closed mluerig closed 5 years ago

mluerig commented 5 years ago

trying to install rcppziggurat on a linux machine, I get following error:

: No such file or directory
g++: error: R: No such file or directory
g++: error: version: No such file or directory
g++: error: 3.5.1: No such file or directory
g++: error: (2018-07-02): No such file or directory
g++: error: Feather: No such file or directory
g++: error: Spray: No such file or directory
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RcppZiggurat.so' failed
make: *** [RcppZiggurat.so] Error 1
ERROR: compilation failed for package ‘RcppZiggurat’

somehow and somewhere in the process, an information-string about the R-version seems to be passed on to the installation routine...

eddelbuettel commented 5 years ago

"A Linux machine" is adorably non-descriptive. Does it have a know distro? Can you name it?

The posted error message makes no sense. What exactly did you invoke?

Also, know that you need GSL as some of the examples / illustrations use the GSL RNG for comparison. We could lift that. The actual RNG ... is just a header file. So share some more details and I can probably help you.

mluerig commented 5 years ago

R version 3.5.1 (2018-07-02) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.1 LTS

the msg came after install.packages("RcppZiggurat"), but it got truncated in the console, and I don't know how to retrieve the rest

I did install GSL using sudo apt-get install libgsl-dev

eddelbuettel commented 5 years ago

Let's bacl off for a second. I wrote RcppZiggurat on Ubuntu and still use it there.

The error message g++: error: R: No such file or directory makes no sense whatsoever as g++ should not be calling R.

edd@rob:~$ Rscript -e 'install.packages("RcppZiggurat", repos="https://cran.us.r-project.org")'
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.us.r-project.org/src/contrib/RcppZiggurat_0.1.5.tar.gz'
Content type 'application/x-gzip' length 405259 bytes (395 KB)
==================================================
downloaded 395 KB

* installing *source* package ‘RcppZiggurat’ ...
** package ‘RcppZiggurat’ successfully unpacked and MD5 sums checked
** libs
ccache g++ -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppGSL/include"    -fpic  -g -O3 -Wall -pipe -DBOOST_NO_AUTO_PTR  -march=native -c RcppExports.cpp -o RcppExports.o
ccache gcc -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppGSL/include"    -fpic  -g -O3 -Wall -pipe -DBOOST_NO_AUTO_PTR  -std=gnu99 -march=native -c init.c -o init.o
ccache g++ -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppGSL/include"    -fpic  -g -O3 -Wall -pipe -DBOOST_NO_AUTO_PTR  -march=native -c ziggurat.cpp -o ziggurat.o
ccache g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppZiggurat.so RcppExports.o init.o ziggurat.o -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RcppZiggurat/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RcppZiggurat)

The downloaded source packages are in
        ‘/tmp/RtmpIdHk0t/downloaded_packages’
edd@rob:~$

I use ccache g++ because of local settings, ditto for some of the compiler flags. But the big picture message is that I invoked the standard command and it just worked.

(For reference, I also keep r-cran-littler install hand have its install.r as a softlink in my my path and usually just call install.r RcppZigurrat, say, but preferred to have a self-contained demo here.)

mluerig commented 5 years ago

looks different for me: still that g++ business - any guesses?

Rscript -e 'install.packages("RcppZiggurat", repos="https://cran.us.r-project.org")'

R version 3.5.1 (2018-07-02)
Feather Spray
Installing package into ‘/home/moritz/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.us.r-project.org/src/contrib/RcppZiggurat_0.1.5.tar.gz'
Content type 'application/x-gzip' length 405259 bytes (395 KB)
==================================================
downloaded 395 KB

R version 3.5.1 (2018-07-02)
Feather Spray
* installing *source* package ‘RcppZiggurat’ ...
** package ‘RcppZiggurat’ successfully unpacked and MD5 sums checked
** libs
g++  -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/home/moritz/R/library/Rcpp/include" -I"/home/moritz/R/library/RcppGSL/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/home/moritz/R/library/Rcpp/include" -I"/home/moritz/R/library/RcppGSL/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
g++  -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I"/home/moritz/R/library/Rcpp/include" -I"/home/moritz/R/library/RcppGSL/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ziggurat.cpp -o ziggurat.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppZiggurat.so RcppExports.o init.o ziggurat.o 
                                                                                                                       R version 3.5.1 (2018-07-02) Feather Spray -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm -L/usr/lib/R/lib -lR
g++: error: 
            : No such file or directory
g++: error: R: No such file or directory
g++: error: version: No such file or directory
g++: error: 3.5.1: No such file or directory
g++: error: (2018-07-02): No such file or directory
g++: error: Feather: No such file or directory
g++: error: Spray: No such file or directory
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RcppZiggurat.so' failed
make: *** [RcppZiggurat.so] Error 1
ERROR: compilation failed for package ‘RcppZiggurat’
* removing ‘/home/moritz/R/library/RcppZiggurat’

The downloaded source packages are in
    ‘/tmp/RtmpWOt2bE/downloaded_packages’
Warning message:
In install.packages("RcppZiggurat", repos = "https://cran.us.r-project.org") :
  installation of package ‘RcppZiggurat’ had non-zero exit status
eddelbuettel commented 5 years ago

What does which g++ say? Something looks effed-up on your machine. Do you have package r-base-dev installed?

eddelbuettel commented 5 years ago

Based on this line the package init (needed for the GSL linking) went sour:

g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppZiggurat.so RcppExports.o init.o ziggurat.o 
                                                                                                                       R version 3.5.1 (2018-07-02) Feather Spray -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm -L/usr/lib/R/lib -lR
g++: error: 

Do you have a non-standard ~/.Rprofile ? Something that prints messages? Unusal shell?

In any event, it's "all you": package has a perfect record at CRAN.

eddelbuettel commented 5 years ago

In particular, the file src/Makevars has this one-liner to get the link instruction:

## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "RcppGSL:::LdFlags()"`

For some reason this does not work for you. Maybe you can work out why and fix it.

mluerig commented 5 years ago

/usr/bin/g++

I'm sure Rprofile is harmless

r-base-dev is installed. now that g++ keeps coming up, I feel like have experienced this before - guess I'll reinstall all R related stuff.

thanks for your suggestions, I'll do some more research!

eddelbuettel commented 5 years ago

It's that one line about calling RcppGSL:::LdFlags(). Do you have RcppGSL installed? Do it work? What comes back when you call RcppGSL:::LdFlags() in your R session?

I get -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm.

mluerig commented 5 years ago

me too: -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm

eddelbuettel commented 5 years ago

Beats me. At this point unpack the source tarball, replace that line in src/Makevars with the above as the value of PKG_LIBS and install. You will get to fix your box another time...

eddelbuettel commented 5 years ago

Any luck?

Any objection to closing this as it does not seem to be a reproducible issue?

mluerig commented 5 years ago

I didn't have time yet, but I'll try as soon as I can. Thanks again!

sagebiej commented 2 years ago

I had the same issue, and my Rprofile does load some print() messages. The solution was to use the vanilla option when starting R. So in my case $ sudo R --vanilla allowed me to install the package without the error message. Hope it helps...

3Julia3 commented 2 years ago

I had the same error, the vanilla solution worked for me. Thank you!