Sorry, I don't have much experience with actually editing Makefiles. Right now I am using the same Makefile as you have except with the final section edited as follows:<div><br></div><div><div>## compiler etc settings used in default make rules</div>
<div>CXX := <span class="Apple-tab-span" style="white-space:pre">                        </span>$(shell $(R_HOME)/bin/R CMD config CXX)</div><div>CPPFLAGS := <span class="Apple-tab-span" style="white-space:pre">                </span>-Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)</div>
<div>CPPFLAGS += <span class="Apple-tab-span" style="white-space:pre">                </span>-I/usr/include/</div><div>CXXFLAGS := <span class="Apple-tab-span" style="white-space:pre">                </span>$(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)</div>
<div>LDFLAGS<span class="Apple-tab-span" style="white-space:pre">        </span>= <span class="Apple-tab-span" style="white-space:pre">                </span>-s</div><div>LDFLAGS += <span class="Apple-tab-span" style="white-space:pre">                </span>-lgsl -lgslcblas -lm</div>
<div><br></div><div>LDLIBS := <span class="Apple-tab-span" style="white-space:pre">                </span>$(RLDFLAGS) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)</div><div><br></div><div>all : <span class="Apple-tab-span" style="white-space:pre">                        </span>$(programs)</div>
<div><br></div><div>clean:</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rm -vf $(programs)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rm -f *~ *.o core a.out</div>
<div><br></div><div>runAll:</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for p in $(programs); do echo "Running $$p"; ./$$p; done</div><div><br></div><div>However, when I run 'make' it says</div>
<div><br></div><div>make: nothing to be done for 'all'</div><div><br></div><div>Any idea how to fix this? Thanks so much for all of your help.</div><div><br></div><div>Best,</div><div>David<br><br><div class="gmail_quote">
On Mon, Jul 12, 2010 at 9:24 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
David,<br>
<div class="im"><br>
On 12 July 2010 at 20:50, David Rosengarten wrote:<br>
| Well I'm not quite sure why it's different for me then, but your theory fixed<br>
| it! This is the result of 'ldd rinside_sample0':<br>
|<br>
| linux-vdso.so.1 => (0x00007fff720dd000)<br>
| libR.so => /usr/lib/R/lib/libR.so (0x00007f351598d000)<br>
<br>
</div>Cool. One down. Good to know.<br>
<div class="im"><br>
| libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf (0x00007f3514ff2000)<br>
| liblapack.so.3gf => /usr/lib/atlas/liblapack.so.3gf (0x00007f35143ea000)<br>
| libRcpp.so => /usr/local/lib/R/site-library/Rcpp/lib/libRcpp.so<br>
| (0x00007f3514192000)<br>
| libRInside.so => /usr/local/lib/R/site-library/RInside/lib/libRInside.so<br>
| (0x00007f3513f7d000)<br>
| libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3513c68000)<br>
| libm.so.6 => /lib/libm.so.6 (0x00007f35139e5000)<br>
| libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f35137ce000)<br>
| libc.so.6 => /lib/libc.so.6 (0x00007f351344a000)<br>
| libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f351315d000)<br>
| libreadline.so.6 => /lib/libreadline.so.6 (0x00007f3512f1c000)<br>
| libpcre.so.3 => /lib/libpcre.so.3 (0x00007f3512ced000)<br>
| libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f3512adc000)<br>
| libz.so.1 => /lib/libz.so.1 (0x00007f35128c5000)<br>
| libdl.so.2 => /lib/libdl.so.2 (0x00007f35126c0000)<br>
| /lib64/ld-linux-x86-64.so.2 (0x00007f3515f18000)<br>
| libncurses.so.5 => /lib/libncurses.so.5 (0x00007f351247d000)<br>
|<br>
| and the examples run now. Thanks so much for your help.<br>
|<br>
| As a further question (sorry for all the trouble), do you know how I can adapt<br>
| the makefile so that a program will compile with the gsl libraries? I tried<br>
| adding:<br>
|<br>
| CFLAGS = -I/usr/include/gsl<br>
| LDFLAGS = -lgsl -lgslblasnative<br>
<br>
</div>You want += here to add your values, not = as that would erase prior values.<br>
Else use new definitions (eg GSL_CFLAGS) which you later insert into<br>
the CXXFLAGS definition.<br>
<div class="im"><br>
| CC = g++<br>
| %: %.cpp<br>
| $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@<br>
|<br>
| as well as 'rm -f *~ *.o core a.out' in clean:, but upon 'make' I am getting<br>
| the error<br>
|<br>
| metrop.cpp:14:21: error: RInside.h: No such file or directory<br>
| make: *** [metrop] Error 1<br>
<br>
</div>Yes. You effectively everything we need to build with RInside. Not a good plan :)<br>
<div class="im"><br>
| for my program metrop.cpp. The only thing regarding R that I have in my code<br>
| as of now is #include <RInside.h>.<br>
<br>
</div>But that implies Rcpp as well as R so you need headers from three places,<br>
libs from three places, rpath entries ... all before you even mentioned GSL.<br>
<br>
Dirk<br>
<div><div></div><div class="h5"><br>
| Best,<br>
| David<br>
|<br>
| On Mon, Jul 12, 2010 at 5:38 PM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br>
|<br>
|<br>
| Hi David,<br>
|<br>
| Thanks for hanging in there -- I think you just found a real bug on our<br>
| side!<br>
|<br>
| On 12 July 2010 at 17:21, David Rosengarten wrote:<br>
| | The result of sudo apt-get install r-base-core is:<br>
| |<br>
| | Reading package lists... Done<br>
| | Building dependency tree <br>
| | Reading state information... Done<br>
| | r-base-core is already the newest version.<br>
| | r-base-core set to manually installed.<br>
| | The following packages were automatically installed and are no longer<br>
| required:<br>
| | linux-headers-2.6.32-21-generic linux-headers-2.6.32-21 dkms<br>
| | Use 'apt-get autoremove' to remove them.<br>
| | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.<br>
| |<br>
| | So, it looks like I should already have the shared libraries installed.<br>
| I<br>
| | originally installed the R packages from the Ubuntu Software Center, and<br>
| then I<br>
| | installed Rcpp and RInside using install.packages() in R. Does this<br>
| give any<br>
| | new information, or should I try uninstalling everything and starting<br>
| from<br>
| | scratch?<br>
|<br>
| It's perfect. I had to scratch my head for a moment, but then I got an<br>
| idea.<br>
|<br>
| Here is the story I currently suspect:<br>
|<br>
| 1) r-base-core is built using shared libraries, but these are private<br>
| to R<br>
|<br>
| 2) R itself sets a LD_LIBRARY_PATH in the shell script /usr/bin/R so<br>
| all<br>
| is good for normal R use<br>
|<br>
| 3) I _used to_ add a file /etc/ld.so.conf.d/libR.conf which made the<br>
| 'hidden' location of R visible to the system<br>
|<br>
| 4) Unfortunately, this is considered cheating and bad use by the<br>
| so-called<br>
| Debian Policy my Debian R package has to conform to so I had to stop<br>
| that.<br>
|<br>
| 5) Because of 3), my systems still have /etc/ld.so.conf.d/libR.conf<br>
| which<br>
| is why 'ldd rinside_sample0' resolves all shared libs for, but<br>
| because<br>
| of 4) you no longer do !<br>
|<br>
| To fix this, try placing these two line in a file /etc/ld.so.conf.d/<br>
| libR.conf<br>
| (without the leading psace, though)<br>
|<br>
| # make libR.so visible to ld.so<br>
| /usr/lib/R/lib<br>
|<br>
| On amd64, you could also use<br>
|<br>
| # make libR.so visible to ld.so<br>
| /usr/lib64/R/lib<br>
|<br>
| The run 'sudo ldconfig' and repeat 'ldd rinside_sample0'. It should now<br>
| find<br>
| libR.so, and if so, you should be able to run all examples.<br>
|<br>
| If this hunch is wrong we need to look somewhere else. If the hunch is<br>
| right, I need to modify the examples so that libR.so gets an Rpath<br>
| invocation<br>
| as we do for libRcpp.so and libRInside.so.<br>
|<br>
| Hope this helps, Dirk<br>
|<br>
|<br>
|<br>
|<br>
| |<br>
| | Thanks,<br>
| | David<br>
| |<br>
| | On Mon, Jul 12, 2010 at 4:52 PM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>><br>
| wrote:<br>
| |<br>
| |<br>
| | David,<br>
| |<br>
| | Thanks for bringing the discussion here with is more topical for<br>
| Rcpp and<br>
| | RInside.<br>
| |<br>
| | On 12 July 2010 at 16:34, David Rosengarten wrote:<br>
| | | Hi,<br>
| | |<br>
| | | I originally emailed the r-sig-debian list and was directed here.<br>
| I<br>
| | am<br>
| | | trying to run the examples in /RInside/examples/standard such as<br>
| | | rinside_sample_0, but I am getting the error: <br>
| | |<br>
| | | error while loading shared libraries: libR.so: cannot open shared<br>
| object<br>
| | file:<br>
| | | No such file or directory<br>
| | |<br>
| | | Does anyone know how to deal with this? I was told to include<br>
| the<br>
| | output of<br>
| | | 'make' and 'ldd ./rinside_sample0', so they are as follows:<br>
| | |<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample0.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample0<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample1.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample1<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample2.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample2<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample3.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample3<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample4.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample4<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample5.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample5<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample6.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample6<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample7.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample7<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_sample8.cpp<br>
| | | -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/<br>
| | Rcpp/<br>
| | | lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/<br>
| usr/local<br>
| | /lib/R<br>
| | | /site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_sample8<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_test0.cpp -L<br>
| | | /usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/Rcpp<br>
| | /lib<br>
| | | -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/<br>
| local/lib<br>
| | /R/<br>
| | | site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_test0<br>
| | | g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/<br>
| include<br>
| | -I/usr/<br>
| | | local/lib/R/site-library/RInside/lib -g -O2 -Wall -s<br>
| | rinside_test1.cpp -L<br>
| | | /usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/<br>
| site-library/Rcpp<br>
| | /lib<br>
| | | -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/<br>
| local/lib<br>
| | /R/<br>
| | | site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/<br>
| | site-library/<br>
| | | RInside/lib -o rinside_test1<br>
| | |<br>
| | | linux-vdso.so.1 => (0x00007fff30bff000)<br>
| | | libR.so => not found<br>
| | | libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf<br>
| (0x00007f50d2512000)<br>
| | | liblapack.so.3gf => /usr/lib/atlas/liblapack.so.3gf<br>
| (0x00007f50d190a000)<br>
| | | libRcpp.so => /usr/local/lib/R/site-library/Rcpp/lib/libRcpp.so<br>
| | | (0x00007f50d16b2000)<br>
| | | libRInside.so => /usr/local/lib/R/site-library/RInside/lib/<br>
| libRInside.so<br>
| | | (0x00007f50d149d000)<br>
| | | libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f50d1188000)<br>
| | | libm.so.6 => /lib/libm.so.6 (0x00007f50d0f05000)<br>
| | | libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f50d0cee000)<br>
| | | libc.so.6 => /lib/libc.so.6 (0x00007f50d096a000)<br>
| | | libgfortran.so.3 => /usr/lib/libgfortran.so.3<br>
| (0x00007f50d067d000)<br>
| | | /lib64/ld-linux-x86-64.so.2 (0x00007f50d2ecd000)<br>
| | | libR.so => not found<br>
| | | libR.so => not found<br>
| |<br>
| | There is your problem.<br>
| |<br>
| | | I have R and r-base-dev installed, so I don't understand why this<br>
| is<br>
| | happening.<br>
| | | Any help would be much appreciated.<br>
| |<br>
| | You may have R, but I suspect you do not have R built with shared<br>
| | libraries.<br>
| | The quickest fix, given that you started on r-sig-debian, may be<br>
| |<br>
| | $ sudo apt-get install r-base-core<br>
| |<br>
| | Else you can of course rebuild R from source etc, but you have to<br>
| tell<br>
| | configure to use --enable-R-shlib or else you cannot embed<br>
| R. And<br>
| | RInside wants to embed R, so you can't the latter witout the<br>
| former.<br>
| |<br>
| | Hope this helps.<br>
| |<br>
| | --<br>
| | Regards, Dirk<br>
| |<br>
| |<br>
| |<br>
| | ----------------------------------------------------------------------<br>
| | _______________________________________________<br>
| | Rcpp-devel mailing list<br>
| | <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| | <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
|<br>
| --<br>
| Regards, Dirk<br>
|<br>
|<br>
<br>
</div></div><font color="#888888">--<br>
Regards, Dirk<br>
</font></blockquote></div><br></div></div>