[Rcpp-devel] problems with rInside in Ubuntu

Dirk Eddelbuettel edd at debian.org
Sat Mar 30 14:52:19 CET 2013


Walter,

On 30 March 2013 at 10:19, Walter Mascarenhas wrote:
|    In a simpler project, I noticed the following:
| 
| 1) When I use the static library RInside/lib/libRInside.a I get the link error
| above, i,e.
| missing Rcpp::Language::update().However, if I replace RInside.a by the
| RInside.so
| the link problem disappears.

There may well be an error on your end: What made you think it would work
with static libraries?  Dynamic linking all the way.
 
| 2) There isn't a method called update in the version of the class Language in
| /usr/local/lib/R/site-library/Rcpp/include/Rcpp/Language.h
| 
|  These observations lead to the natural questions:
| 
| 1) are you sure the distributed LibRInside.a was compiled with the latest
| version of the class Language?

"distributed LibRInside.a" ? 

Fist off, you have the capitalization wrong. Second, how am I supposed to
know how YOU built this?  I ship SOURCES. You control your builds. There is
no distributed libRInside.a, only sources and a Makefile.
 
This is R. 

It has _fixed recipes:: We say R CMD INSTALL. We control how it works.

| 2) When you say that everything works fine there, did you consider linking
| against each one of the THREE version of libRInside:  /lib/libRInside.a,  /
| lib/libRInside.so and
| /libs/libRInside.o?

I ship a Makefile. I say 'make'. It works.

Follow the (free) tools I give you.  If you insist of revinvention your
builds and things break, well then you get to keep the pieces.

So just for you, another run:

edd at max:~/svn/rinside$ R CMD INSTALL RInside_0.2.10.tar.gz 
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RInside’ ...
** libs
/usr/lib/R/bin/Rscript tools/RInsideAutoloads.r > RInsideAutoloads.h
/usr/lib/R/bin/Rscript tools/RInsideEnvVars.r   > RInsideEnvVars.h
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
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
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
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
ar qc libRInside.a MemBuf.o RInside.o
cp libRInside.so ../inst/lib
cp libRInside.a ../inst/lib
rm libRInside.so libRInside.a
installing to /usr/local/lib/R/site-library/RInside/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (RInside)
edd at max:~/svn/rinside$ 
edd at max:~/svn/rinside$ cd pkg/inst/examples/qt/
edd at max:~/svn/rinside/pkg/inst/examples/qt$ make clean && qmake && make
rm -f moc_qtdensity.cpp
rm -f qtdensity.o main.o moc_qtdensity.o
rm -f qtdensity Makefile
rm -f *~ core *.core
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
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
/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
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
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 
edd at max:~/svn/rinside/pkg/inst/examples/qt$ 
edd at max:~/svn/rinside/pkg/inst/examples/qt$ ./qtdensity     ## application launches as expected
edd at max:~/svn/rinside/pkg/inst/examples/qt$ 

Note that some of the displayed path WILL differ on your box as they are
dynamically determined. Same with compiler options.

The main thing is:  We ship this so that works our of the box.  If you have
different claim, demonstrate their failure with a reproducible example.

If you're confused, re-read all available documentation.

Dirk

| 
|               walter.
| 
| 
| 
| On Fri, Mar 29, 2013 at 10:37 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| 
|     On 29 March 2013 at 22:13, Walter Mascarenhas wrote:
|     | Dirk,
|     |
|     |   SInce I wrote you this afternoon, I upgraded to R 2.15.3 and got
|     version
|     | 0.10.3 of rcpp and
|     | 0.2.10 of Rinside. I am using ubuntu 12.04 LTS, with g++4.7.2 and Qt
|     5.0.1 in
|     | Qt creator 2.6.2
|     | (the first few lines of the makefile generated by qmake are at the end of
|     this
|     | message)
| 
|     It is probably Qt 5 that makes the difference.
| 
|     Why did you pick it?  Ubuntu 12.04 and 12.10 comes with perfectly fine
|     versions of Qt 4.7.*
| 
|     |   Now rinsides's qtdensity example does not work anymore, for two
|     reasons:
|     | 1) The file main.cpp does not compile. It is easy to fix this by addng
|     | these four lines to main.cpp:
|     |
|     | #include <QLineEdit>
|     | #include <QGroupBox>
|     | #include <QRadioButton>
|     | #include <QButtonGroup>
|     |
|     | I guess these files are included via <qtGui> in your machine.
| 
|     Yes, works here out of the box.
| 
|     | 2) There is a link problem:
|     |
|     | /usr/local/lib/R/site-library/RInside/lib/libRInside.so:-1: error:
|     undefined
|     | reference to `Rcpp::Language::update()'
| 
|     Dito. That one is weirder.
| 
|     If we both use Rcpp 0.10.3, why do you have this and I don't?
| 
|     Do the other examples (in the neighbouring directories) build?
| 
|     | which I do not now how to solve. What should I do?
| 
|     Debug it. It broke, and you get to keep the pieces.
| 
|     I support software I give away for free. I test to the best of my ability
|     and
|     resources, but keep in mind that I do not have the manpower or resource to
|     test on every conceivable combination of related software releases.
| 
|     I really do think that you safest bet may to take the libqt* versions from
|     your distro.
| 
|     | Once you tell me how to fix this I will build an example with qt in which
|     I
|     | use Rcpp to reproduce the results in a finance paper which were obtained
|     | originally in matlab. I believe it will be a neat example of the use of
|     Rcpp
|     | (and I want to look very carefully at this article anyway)
|     |
|     | Here are the first lines of the makefile:
|     |
|     | ##############################
|     | ###############################################
|     | # Makefile for building: qtdensity
|     | # Generated by qmake (3.0) (Qt 5.0.1) on: Fri Mar 29 21:33:20 2013
|     | # Project:  /usr/local/lib/R/site-library/RInside/examples/qt/
|     qtdensity.pro
|     | # Template: app
|     | # Command: /home/walter/qt.5.0.1/5.0.1/gcc_64/bin/qmake -spec
|     linux-g++-64
|     | CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug QMAKE_CXX=
|     g++-4.7
|     | QMAKE_CXXFLAGS+=-std=c++11 -o Makefile /usr/local/lib/R/site-library/
|     RInside/
|     | examples/qt/qtdensity.pro
|     | #########################################################################
|     ####
|     |
|     | MAKEFILE      = Makefile
|     |
|     | ####### Compiler, tools and options
|     |
|     | CC            = gcc
|     | CXX           = g++-4.7
|     | DEFINES       = -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_SVG_LIB
|     | -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
|     | CFLAGS        = -m64 -pipe -g -Wall -W -D_REENTRANT -fPIE $
|     (DEFINES)
|     | CXXFLAGS      = -m64 -pipe -std=c++11 -I/usr/share/R/include -I/usr/
|     local/
|     | lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/
|     include
|     | -g -Wall -W -D_REENTRANT -fPIE $(DEFINES)
|     | INCPATH       = -I../../../../qt.5.0.1/5.0.1/gcc_64/mkspecs/
|     linux-g++-64
|     | -I/usr/local/lib/R/site-library/RInside/examples/qt -I../../../../
|     qt.5.0.1/
|     | 5.0.1/gcc_64/include -I../../../../qt.5.0.1/5.0.1/gcc_64/include/QtSvg
|     -I../..
|     | /../../qt.5.0.1/5.0.1/gcc_64/include/QtWidgets -I../../../../qt.5.0.1/
|     5.0.1/
|     | gcc_64/include/QtGui -I../../../../qt.5.0.1/5.0.1/gcc_64/include/QtCore
|     -I. -I.
|     | LINK          = g++
|     | LFLAGS        = -m64 -Wl,-rpath,/home/walter/qt.5.0.1/5.0.1/gcc_64
|     | -Wl,-rpath,/home/walter/qt.5.0.1/5.0.1/gcc_64/lib
|     | LIBS          = $(SUBLIBS) -L/usr/X11R6/lib64 -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
|     | -L/home/walter/qt.5.0.1/5.0.1/gcc_64/lib -lQt5Svg -lQt5Widgets -lQt5Gui
|     | -lQt5Core -lGL -lpthread
|     | AR            = ar cqs
|     | RANLIB        =
|     | QMAKE         = /home/walter/qt.5.0.1/5.0.1/gcc_64/bin/qmake
|     | TAR           = tar -cf
|     | COMPRESS      = gzip -9f
|     | COPY          = cp -f
|     | SED           = sed
|     | COPY_FILE     = cp -f
|     | COPY_DIR      = cp -f -R
|     | STRIP         = strip
|     | INSTALL_FILE  = install -m 644 -p
|     | INSTALL_DIR   = $(COPY_DIR)
|     | INSTALL_PROGRAM = install -m 755 -p
|     | DEL_FILE      = rm -f
|     | SYMLINK       = ln -f -s
|     | DEL_DIR       = rmdir
|     | MOVE          = mv -f
|     | CHK_DIR_EXISTS= test -d
|     | MKDIR         = mkdir -p
|     | [cleardot]
| 
|     It's all reasonable, and the only clear difference I see it qt5.0. My
|     releases
|     assume qt4.* and currently test under 4.7.
|    
|     Dirk
| 
|     --
|     Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| 
| 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list