<div dir="ltr"><div><div><div><div><div><div>>> There may well be an error on your end: What made you think it would work<br>
>> with static libraries? Dynamic linking all the way.<br>
<br></div> Sure, there is an error somewhere. I am just trying to find it and the only<br>way I know how to do it is trying to exclude all the possibilities which<br>are not under my control or which are beyond my current understanding.<br>
</div><div>I believe this is a quite natural process for someone trying to learn a new tool.<br></div><div><br>>> "distributed LibRInside.a" ?<br>
>> Fist off, you have the capitalization wrong. Second, how am I supposed to<br>
>> know how YOU built this? I ship SOURCES. You control your builds. There is<br>
>> no distributed libRInside.a, only sources and a Makefile.<br>
<br></div> And your "Fist off" is missing an r. If this kind of nonsense were my only<br>problem in trying to use your code then I would be very glad.<br></div><br></div> I did not build libRInside.a, It was build by apt-get or some other tool which <br>
called R CMD INSTALL or something like it in my behalf. Again, I do believe<br></div><div>other Ubuntu users may have the same problem.<br></div><br></div><div>As for the other run that you were so generous to provide me, <br>
do you mean something as at the end of this message?<br></div><div>If you do then it creates two folders, one call libs with contains a library<br></div><div>RInside.o and another called lib which contains libraries libRInside.a and libRInside.o.<br>
</div><div>In other words, the files that you do not distribute are created once<br></div><div>we follow your suggestion.<br></div><div><br></div><div>Trying to continue to follow your suggestion, I cannot cd to <br>pkg/inst/examples/qt/ as you because there is no<br>
such folder pkg in my machine after I follow the steps you suggest (R CMD...)<br></div><div>Instead, I can cd to folder examples/qt/ and follow the next step<br></div><div>you suggest <br></div><div><br>make clean && qmake && make<br>
<br></div><div>but it does not work because <br><br></div><div>make: *** No rule to make target `clean'. Stop.<br><br></div><div>I did then what most qt users would do, i.e. open the .pro file<br>in qtcreator. By doing that I get compilation errors due to my<br>
</div><div>using of qt 5.0.1 and are easily fixed, but I still have the<br></div><div>linking problem, which I find hard to be caused by the fact that<br></div><div>I am using qt 5.0,1, specially because it also happens in<br>
</div><div>a simpler project that does not use qt at all.<br><br></div><div>In resume, by following the steps you suggest I get to a point in<br> which neither me nor you know what is happening and I am <br>trying to figure it out. I am not trying to do anything different<br>
</div><div>or fancy. I am just trying to make things work, and if you<br>could suggest effective ways to achieve this goal I would<br></div><div>follow them as carefully as I can.<br><br></div><div> walter.<br></div><div>
<br>root@linux:/usr/local/lib/R/site-library/RInside# R CMD INSTALL RInside_0.2.10.tar.gz* installing to library ‘/usr/local/lib/R/site-library’<br>* installing *source* package ‘RInside’ ...<br>** libs<br>/usr/lib/R/bin/Rscript tools/RInsideAutoloads.r > RInsideAutoloads.h<br>
/usr/lib/R/bin/Rscript tools/RInsideEnvVars.r > RInsideEnvVars.h<br>g++ -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/ -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -O3 -pipe -g -c MemBuf.cpp -o MemBuf.o<br>
g++ -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/ -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -O3 -pipe -g -c RInside.cpp -o RInside.o<br>g++ -shared -o RInside.so MemBuf.o RInside.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib/R/lib -lR<br>
g++ -o libRInside.so MemBuf.o RInside.o -shared `/usr/lib/R/bin/Rscript -e "Rcpp:::LdFlags()"` -L/usr/lib/R/lib -lR<br>ar qc libRInside.a MemBuf.o RInside.o<br>cp libRInside.so ../inst/lib<br>cp libRInside.a ../inst/lib<br>
rm libRInside.so libRInside.a<br>installing to /usr/local/lib/R/site-library/RInside/libs<br>** R<br>** inst<br>** preparing package for lazy loading<br>** help<br>*** installing help indices<br>** building package indices<br>
** testing if installed package can be loaded<br><br>* DONE (RInside)<br>root@linux:/usr/local/lib/R/site-library/RInside# ls<br>DESCRIPTION examples help html include INDEX lib libs Meta NAMESPACE NEWS.Rd R RInside_0.2.10.tar.gz THANKS<br>
<br></div><br> <br><div><div><div><br><div><div><div><br><br><br><br></div></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 30, 2013 at 10:52 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">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>
Walter,<br>
<div class="im"><br>
On 30 March 2013 at 10:19, Walter Mascarenhas wrote:<br>
| In a simpler project, I noticed the following:<br>
|<br>
| 1) When I use the static library RInside/lib/libRInside.a I get the link error<br>
| above, i,e.<br>
| missing Rcpp::Language::update().However, if I replace RInside.a by the<br>
| RInside.so<br>
| the link problem disappears.<br>
<br>
</div>There may well be an error on your end: What made you think it would work<br>
with static libraries? Dynamic linking all the way.<br>
<div class="im"><br>
| 2) There isn't a method called update in the version of the class Language in<br>
| /usr/local/lib/R/site-library/Rcpp/include/Rcpp/Language.h<br>
|<br>
| These observations lead to the natural questions:<br>
|<br>
| 1) are you sure the distributed LibRInside.a was compiled with the latest<br>
| version of the class Language?<br>
<br>
</div>"distributed LibRInside.a" ?<br>
<br>
Fist off, you have the capitalization wrong. Second, how am I supposed to<br>
know how YOU built this? I ship SOURCES. You control your builds. There is<br>
no distributed libRInside.a, only sources and a Makefile.<br>
<br>
This is R.<br>
<br>
It has _fixed recipes:: We say R CMD INSTALL. We control how it works.<br>
<div class="im"><br>
| 2) When you say that everything works fine there, did you consider linking<br>
| against each one of the THREE version of libRInside: /lib/libRInside.a, /<br>
| lib/libRInside.so and<br>
| /libs/libRInside.o?<br>
<br>
</div>I ship a Makefile. I say 'make'. It works.<br>
<br>
Follow the (free) tools I give you. If you insist of revinvention your<br>
builds and things break, well then you get to keep the pieces.<br>
<br>
So just for you, another run:<br>
<br>
edd@max:~/svn/rinside$ R CMD INSTALL RInside_0.2.10.tar.gz<br>
* installing to library ‘/usr/local/lib/R/site-library’<br>
* installing *source* package ‘RInside’ ...<br>
** libs<br>
/usr/lib/R/bin/Rscript tools/RInsideAutoloads.r > RInsideAutoloads.h<br>
/usr/lib/R/bin/Rscript tools/RInsideEnvVars.r > RInsideEnvVars.h<br>
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/ -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g0 -O3 -Wall -pipe -Wno-variadic-macros -pedantic -c MemBuf.cpp -o MemBuf.o<br>
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I. -I../inst/include/ -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g0 -O3 -Wall -pipe -Wno-variadic-macros -pedantic -c RInside.cpp -o RInside.o<br>
g++-4.7 -shared -o RInside.so MemBuf.o RInside.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib/R/lib -lR<br>
g++-4.7 -o libRInside.so MemBuf.o RInside.o -shared `/usr/lib/R/bin/Rscript -e "Rcpp:::LdFlags()"` -L/usr/lib/R/lib -lR<br>
ar qc libRInside.a MemBuf.o RInside.o<br>
cp libRInside.so ../inst/lib<br>
cp libRInside.a ../inst/lib<br>
rm libRInside.so libRInside.a<br>
installing to /usr/local/lib/R/site-library/RInside/libs<br>
** R<br>
** inst<br>
** preparing package for lazy loading<br>
** help<br>
*** installing help indices<br>
** building package indices<br>
** testing if installed package can be loaded<br>
<br>
* DONE (RInside)<br>
edd@max:~/svn/rinside$<br>
edd@max:~/svn/rinside$ cd pkg/inst/examples/qt/<br>
edd@max:~/svn/rinside/pkg/inst/examples/qt$ make clean && qmake && make<br>
rm -f moc_qtdensity.cpp<br>
rm -f qtdensity.o main.o moc_qtdensity.o<br>
rm -f qtdensity Makefile<br>
rm -f *~ core *.core<br>
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o qtdensity.o qtdensity.cpp<br>
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o main.o main.cpp<br>
/usr/bin/moc-qt4 -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. qtdensity.h -o moc_qtdensity.cpp<br>
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o moc_qtdensity.o moc_qtdensity.cpp<br>
g++ -m64 -Wl,-O1 -o qtdensity qtdensity.o main.o moc_qtdensity.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -lQtSvg -lQtGui -lQtCore -lpthread<br>
edd@max:~/svn/rinside/pkg/inst/examples/qt$<br>
edd@max:~/svn/rinside/pkg/inst/examples/qt$ ./qtdensity ## application launches as expected<br>
edd@max:~/svn/rinside/pkg/inst/examples/qt$<br>
<br>
Note that some of the displayed path WILL differ on your box as they are<br>
dynamically determined. Same with compiler options.<br>
<br>
The main thing is: We ship this so that works our of the box. If you have<br>
different claim, demonstrate their failure with a reproducible example.<br>
<br>
If you're confused, re-read all available documentation.<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
|<br>
| walter.<br>
|<br>
|<br>
|<br>
| On Fri, Mar 29, 2013 at 10:37 PM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br>
|<br>
|<br>
| On 29 March 2013 at 22:13, Walter Mascarenhas wrote:<br>
| | Dirk,<br>
| |<br>
| | SInce I wrote you this afternoon, I upgraded to R 2.15.3 and got<br>
| version<br>
| | 0.10.3 of rcpp and<br>
| | 0.2.10 of Rinside. I am using ubuntu 12.04 LTS, with g++4.7.2 and Qt<br>
| 5.0.1 in<br>
| | Qt creator 2.6.2<br>
| | (the first few lines of the makefile generated by qmake are at the end of<br>
| this<br>
| | message)<br>
|<br>
| It is probably Qt 5 that makes the difference.<br>
|<br>
| Why did you pick it? Ubuntu 12.04 and 12.10 comes with perfectly fine<br>
| versions of Qt 4.7.*<br>
|<br>
| | Now rinsides's qtdensity example does not work anymore, for two<br>
| reasons:<br>
| | 1) The file main.cpp does not compile. It is easy to fix this by addng<br>
| | these four lines to main.cpp:<br>
| |<br>
| | #include <QLineEdit><br>
| | #include <QGroupBox><br>
| | #include <QRadioButton><br>
| | #include <QButtonGroup><br>
| |<br>
| | I guess these files are included via <qtGui> in your machine.<br>
|<br>
| Yes, works here out of the box.<br>
|<br>
| | 2) There is a link problem:<br>
| |<br>
| | /usr/local/lib/R/site-library/RInside/lib/libRInside.so:-1: error:<br>
| undefined<br>
| | reference to `Rcpp::Language::update()'<br>
|<br>
| Dito. That one is weirder.<br>
|<br>
| If we both use Rcpp 0.10.3, why do you have this and I don't?<br>
|<br>
| Do the other examples (in the neighbouring directories) build?<br>
|<br>
| | which I do not now how to solve. What should I do?<br>
|<br>
| Debug it. It broke, and you get to keep the pieces.<br>
|<br>
| I support software I give away for free. I test to the best of my ability<br>
| and<br>
| resources, but keep in mind that I do not have the manpower or resource to<br>
| test on every conceivable combination of related software releases.<br>
|<br>
| I really do think that you safest bet may to take the libqt* versions from<br>
| your distro.<br>
|<br>
| | Once you tell me how to fix this I will build an example with qt in which<br>
| I<br>
| | use Rcpp to reproduce the results in a finance paper which were obtained<br>
| | originally in matlab. I believe it will be a neat example of the use of<br>
| Rcpp<br>
| | (and I want to look very carefully at this article anyway)<br>
| |<br>
| | Here are the first lines of the makefile:<br>
| |<br>
| | ##############################<br>
| | ###############################################<br>
| | # Makefile for building: qtdensity<br>
| | # Generated by qmake (3.0) (Qt 5.0.1) on: Fri Mar 29 21:33:20 2013<br>
| | # Project: /usr/local/lib/R/site-library/RInside/examples/qt/<br>
| <a href="http://qtdensity.pro" target="_blank">qtdensity.pro</a><br>
| | # Template: app<br>
| | # Command: /home/walter/qt.5.0.1/5.0.1/gcc_64/bin/qmake -spec<br>
| linux-g++-64<br>
| | CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug QMAKE_CXX=<br>
| g++-4.7<br>
| | QMAKE_CXXFLAGS+=-std=c++11 -o Makefile /usr/local/lib/R/site-library/<br>
| RInside/<br>
| | examples/qt/<a href="http://qtdensity.pro" target="_blank">qtdensity.pro</a><br>
| | #########################################################################<br>
| ####<br>
| |<br>
| | MAKEFILE = Makefile<br>
| |<br>
| | ####### Compiler, tools and options<br>
| |<br>
| | CC = gcc<br>
| | CXX = g++-4.7<br>
| | DEFINES = -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_SVG_LIB<br>
| | -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB<br>
| | CFLAGS = -m64 -pipe -g -Wall -W -D_REENTRANT -fPIE $<br>
| (DEFINES)<br>
| | CXXFLAGS = -m64 -pipe -std=c++11 -I/usr/share/R/include -I/usr/<br>
| local/<br>
| | lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/<br>
| include<br>
| | -g -Wall -W -D_REENTRANT -fPIE $(DEFINES)<br>
| | INCPATH = -I../../../../qt.5.0.1/5.0.1/gcc_64/mkspecs/<br>
| linux-g++-64<br>
| | -I/usr/local/lib/R/site-library/RInside/examples/qt -I../../../../<br>
| qt.5.0.1/<br>
| | 5.0.1/gcc_64/include -I../../../../qt.5.0.1/5.0.1/gcc_64/include/QtSvg<br>
| -I../..<br>
| | /../../qt.5.0.1/5.0.1/gcc_64/include/QtWidgets -I../../../../qt.5.0.1/<br>
| 5.0.1/<br>
| | gcc_64/include/QtGui -I../../../../qt.5.0.1/5.0.1/gcc_64/include/QtCore<br>
| -I. -I.<br>
| | LINK = g++<br>
| | LFLAGS = -m64 -Wl,-rpath,/home/walter/qt.5.0.1/5.0.1/gcc_64<br>
| | -Wl,-rpath,/home/walter/qt.5.0.1/5.0.1/gcc_64/lib<br>
| | LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -L/usr/lib/R/lib<br>
| -lR<br>
| | -lblas -llapack -L/usr/local/lib/R/site-library/RInside/lib -lRInside<br>
| | -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -L/usr/local/lib/R/<br>
| | site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/<br>
| Rcpp/lib<br>
| | -L/home/walter/qt.5.0.1/5.0.1/gcc_64/lib -lQt5Svg -lQt5Widgets -lQt5Gui<br>
| | -lQt5Core -lGL -lpthread<br>
| | AR = ar cqs<br>
| | RANLIB =<br>
| | QMAKE = /home/walter/qt.5.0.1/5.0.1/gcc_64/bin/qmake<br>
| | TAR = tar -cf<br>
| | COMPRESS = gzip -9f<br>
| | COPY = cp -f<br>
| | SED = sed<br>
| | COPY_FILE = cp -f<br>
| | COPY_DIR = cp -f -R<br>
| | STRIP = strip<br>
| | INSTALL_FILE = install -m 644 -p<br>
| | INSTALL_DIR = $(COPY_DIR)<br>
| | INSTALL_PROGRAM = install -m 755 -p<br>
| | DEL_FILE = rm -f<br>
| | SYMLINK = ln -f -s<br>
| | DEL_DIR = rmdir<br>
| | MOVE = mv -f<br>
| | CHK_DIR_EXISTS= test -d<br>
| | MKDIR = mkdir -p<br>
| | [cleardot]<br>
|<br>
| It's all reasonable, and the only clear difference I see it qt5.0. My<br>
| releases<br>
| assume qt4.* and currently test under 4.7.<br>
|<br>
| Dirk<br>
|<br>
| --<br>
| Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
|<br>
|<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</div></div></blockquote></div><br></div>