[Rcpp-devel] Bug in Rcpp
Dirk Eddelbuettel
edd at debian.org
Sat Dec 15 16:07:56 CET 2012
Hi Guo Ci,
Thanks for taking the time to write a bug report, and to suggest a fix -- we
appreciate it!
May I ask you to send such reports to the rcpp-devel list in the future?
I'll CC the list now.
On 15 December 2012 at 22:18, Teo Guo Ci wrote:
| Hi Dirk,
| I have discovered a bug in Rcpp while compiling with the -std=c++11 option.
That is entirely possibly. As explained before, we (as in the core Rcpp team)
don't much use that option as we cannot upload to CRAN that way. I may find
more such error if I use the option in work-related code, to be seen.
| At include/Rcpp/sugar/sets.h, line 25 to 27, two macros were defined for C++11, requiring std::unordered_set, std::unordered_map. But their header files are not included, and prevents code from compiling.
|
| Suggested fix: Add this four lines in include/RcppCommon.h, around line 145.
|
| #if __cplusplus >= 201103L
| #include <unordered_set>
| #include <unordered_map>
| #endif
Also, when you submit a report, could you state the version it was made
against? This could well be fixed in SVN where a lot of files have been
rearranged by Romain making for much compilation times. The corresponding
compiler-detection and settings are now in a file
inst/include/Rcpp/platform/compiler.h
and when I add the flag to CXXFLAGS in my ~/.R/Makevars it all passes
swimmingly without your patch:
edd at max:~/svn/rcpp/pkg$ R CMD INSTALL Rcpp_0.10.1.5.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘Rcpp’ ...
** libs
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c Date.cpp -o Date.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c Module.cpp -o Module.o
ccache gcc-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g0 -O3 -Wall -pipe -pedantic -std=gnu99 -march=native -c Rcpp_init.c -o Rcpp_init.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c Timer.cpp -o Timer.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c api.cpp -o api.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c attributes.cpp -o attributes.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c barrier.cpp -o barrier.o
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -std=c++11 -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros -c exceptions.cpp -o exceptions.o
g++-4.7 -shared -o Rcpp.so Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -L/usr/lib/R/lib -lR
g++-4.7 -o libRcpp.so Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -shared -L/usr/lib/R/lib -lR
ar qc libRcpp.a Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o
cp libRcpp.so ../inst/lib
cp libRcpp.a ../inst/lib
rm libRcpp.so libRcpp.a
installing to /usr/local/lib/R/site-library/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘Rcpp-FAQ.Rnw’
‘Rcpp-attributes.Rnw’
‘Rcpp-extending.Rnw’
‘Rcpp-introduction.Rnw’
‘Rcpp-modules.Rnw’
‘Rcpp-package.Rnw’
‘Rcpp-quickref.Rnw’
‘Rcpp-sugar.Rnw’
‘Rcpp-unitTests.Rnw’
** testing if installed package can be loaded
* DONE (Rcpp)
edd at max:~/svn/rcpp/pkg$
That used current SVN source put together into a tarball.
Again, while this issue may already have been taken care of, thanks for the
suggestion which we appreciate.
Cheers, Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list