[Rcpp-devel] problems with rInside in Ubuntu
Walter Mascarenhas
walter.mascarenhas at gmail.com
Sat Mar 30 16:17:01 CET 2013
>> There may well be an error on your end: What made you think it would work
>> with static libraries? Dynamic linking all the way.
Sure, there is an error somewhere. I am just trying to find it and the
only
way I know how to do it is trying to exclude all the possibilities which
are not under my control or which are beyond my current understanding.
I believe this is a quite natural process for someone trying to learn a new
tool.
>> "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.
And your "Fist off" is missing an r. If this kind of nonsense were my only
problem in trying to use your code then I would be very glad.
I did not build libRInside.a, It was build by apt-get or some other tool
which
called R CMD INSTALL or something like it in my behalf. Again, I do believe
other Ubuntu users may have the same problem.
As for the other run that you were so generous to provide me,
do you mean something as at the end of this message?
If you do then it creates two folders, one call libs with contains a library
RInside.o and another called lib which contains libraries libRInside.a and
libRInside.o.
In other words, the files that you do not distribute are created once
we follow your suggestion.
Trying to continue to follow your suggestion, I cannot cd to
pkg/inst/examples/qt/ as you because there is no
such folder pkg in my machine after I follow the steps you suggest (R
CMD...)
Instead, I can cd to folder examples/qt/ and follow the next step
you suggest
make clean && qmake && make
but it does not work because
make: *** No rule to make target `clean'. Stop.
I did then what most qt users would do, i.e. open the .pro file
in qtcreator. By doing that I get compilation errors due to my
using of qt 5.0.1 and are easily fixed, but I still have the
linking problem, which I find hard to be caused by the fact that
I am using qt 5.0,1, specially because it also happens in
a simpler project that does not use qt at all.
In resume, by following the steps you suggest I get to a point in
which neither me nor you know what is happening and I am
trying to figure it out. I am not trying to do anything different
or fancy. I am just trying to make things work, and if you
could suggest effective ways to achieve this goal I would
follow them as carefully as I can.
walter.
root at 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’
* 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
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
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
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
g++ -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)
root at linux:/usr/local/lib/R/site-library/RInside# ls
DESCRIPTION examples help html include INDEX lib libs Meta
NAMESPACE NEWS.Rd R RInside_0.2.10.tar.gz THANKS
On Sat, Mar 30, 2013 at 10:52 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130330/55eed03e/attachment-0001.html>
More information about the Rcpp-devel
mailing list