[Rcpp-devel] Difficulty Compiling RcppClassic Package on Windows

Tim Jurka timjurka at gmail.com
Sat Jun 11 08:07:44 CEST 2011


Hi Dirk,

Re-writing the wrapper using the new API resolved the issues; it installs perfectly on Windows now. Thank you for your help!

Best,
Tim

On Jun 10, 2011, at 10:20 PM, Dirk Eddelbuettel wrote:

> 
> Hi Tim,
> 
> On 10 June 2011 at 21:31, Tim Jurka wrote:
> | Hello Rcpp-Devel,
> | 
> | This is my first question posted to this list, so please remind me if I'm missing crucial details in my inquiry!
> | 
> | I have successfully interfaced Yoshimasa Tsuruoka's excellent C++ maximum
> | entropy library ( http://www-tsujii.is.s.u-tokyo.ac.jp/~tsuruoka/maxent/ )
> | using RcppClassic, 
> 
> First time I hear about maxent. Does it use RcppClassic, or did you choose to
> use it?  As you may know, we kindly suggest for folks to use the new API as
> it more well tested.
> 
> | and everything compiles cleanly on *NIX and OS X when compiled from source (via the same method described below). However, when I try to install from my repository on a Windows 7 machine (using R 2.12.1 64-bit), it starts throwing a lot of errors. I have RTools installed, with both the 32-bit and 64-bit options selected, and a blank Rcpp package skeleton compiles fine on my machine. Could anyone point me in the right direction as to what's going differently on Windows vs my *NIX machines?
> | 
> | Thank you in advance for any help!
> | Tim
> | 
> | The commands I run in R look like:
> | repositories <- c("http://install.rtexttools.com/","http://cran.r-project.org","http://www.omegahat.org/R")
> | install.packages("maxent", repos=repositories, type="source")
> | 
> | My Makevars.win file looks like:
> | PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
> | PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "RcppClassic:::LdFlags()")
> | 
> | These headers are included in all files with Rcpp code:
> | #include <RcppClassic.h>
> | #include <R.h>
> | #include <Rmath.h>
> | 
> | And the error output looks like (for both 32-bit and 64-bit builds, error output is identical for both g++ and x86_64-w64-mingw32-g++):
> 
> I only have one quick idea -- 'long long' is something the g++ 4.5 and 4.6
> compilers do not tolerate (more below). In one or two few places in Rcpp (new
> API) we use the following via RcppCommon.h:
> 
> #ifdef __GNUC__
> #ifdef __GXX_EXPERIMENTAL_CXX0X__
> #ifdef LONG_LONG_MAX
>    __extension__ typedef long long int rcpp_long_long_type;
>    __extension__ typedef unsigned long long int rcpp_ulong_long_type;
>    #define RCPP_HAS_LONG_LONG_TYPES
> #endif
> #endif
> #endif
> 
> So if g++ is used and if the "__GXX_EXPERIMENTAL_CXX0X__" feature is turned
> of (which you get via option g++ option "-std=c++0x" option), then and only
> then is rcpp_long_long_type and its unsigned variant defined, along with a
> #define for it.
> 
> The net effect is that normally we do not have -std=c++0x on, hence this
> becomes false ... and the compiler never sees 'long long'.  Which is a good
> thing as g++ 4.5/4.6 now see it as an error (as it was missing from C++ 1998
> and was introduced only in C++ 2003 which g++ 4.5/4.6 now interpret more
> strictly / correctly).
> 
> So the Rcpp that RcppClassic tries to link against may not have, whereas the
> code you are using may have it, hence the error.
> 
> That is of course just a guess, and I may be wrong.
> 
> Hope this helps,  Dirk
> 
> 
> 
> | x86_64-w64-mingw32-g++ -shared -s -static-libgcc -o maxent.dll tmp.def blmvm.o maxent.o rmaxent.o C:/Users/timjurka/Documents/R/win-library/2.12/Rcpp/lib/x64/libRcpp.a C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a -LC:/PROGRA~1/R/R-212~1.1/bin/x64 -lR
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text+0x1a4): undefined reference to `Rcpp::internal::getPosixClasses()'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text+0x66): undefined reference to `Rcpp::internal::new_date_object(double)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text+0x7d): undefined reference to `Rcpp::internal::new_posixt_object(double)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIiEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)]+0x115): undefined reference to `Rcpp::Dimension::Dimension(unsigned long long const&, unsigned long long const&)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIiEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)]+0x15a): undefined reference to `Rcpp::Dimension::prod() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIiEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)]+0x190): undefined reference to `Rcpp::Dimension::size() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIiEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&)]+0x200): undefined reference to `Rcpp::Dimension::operator SEXPREC*() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIiEEvRKSsPPT_ii[void RcppResultSet::add__matrix<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int**, int, int)]+0xc7): undefined reference to `Rcpp::Dimension::Dimension(unsigned long long const&, unsigned long long const&)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIiEEvRKSsPPT_ii[void RcppResultSet::add__matrix<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int**, int, int)]+0x106): undefined reference to `Rcpp::Dimension::prod() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIiEEvRKSsPPT_ii[void RcppResultSet::add__matrix<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int**, int, int)]+0x13c): undefined reference to `Rcpp::Dimension::size() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIiEEvRKSsPPT_ii[void RcppResultSet::add__matrix<int>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int**, int, int)]+0x1a3): undefined reference to `Rcpp::Dimension::operator SEXPREC*() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIdEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&)]+0x115): undefined reference to `Rcpp::Dimension::Dimension(unsigned long long const&, unsigned long long const&)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIdEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&)]+0x15a): undefined reference to `Rcpp::Dimension::prod() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIdEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&)]+0x190): undefined reference to `Rcpp::Dimension::size() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet16add__matrix__stdIdEEvRKSsRKSt6vectorIS3_IT_SaIS4_EESaIS6_EE[void RcppResultSet::add__matrix__std<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&)]+0x200): undefined reference to `Rcpp::Dimension::operator SEXPREC*() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIdEEvRKSsPPT_ii[void RcppResultSet::add__matrix<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double**, int, int)]+0xc7): undefined reference to `Rcpp::Dimension::Dimension(unsigned long long const&, unsigned long long const&)'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIdEEvRKSsPPT_ii[void RcppResultSet::add__matrix<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double**, int, int)]+0x106): undefined reference to `Rcpp::Dimension::prod() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIdEEvRKSsPPT_ii[void RcppResultSet::add__matrix<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double**, int, int)]+0x13c): undefined reference to `Rcpp::Dimension::size() const'
> | C:/Users/timjurka/Documents/R/win-library/2.12/RcppClassic/lib/x64/libRcppClassic.a(RcppResultSet.o):RcppResultSet.cpp:(.text$_ZN13RcppResultSet11add__matrixIdEEvRKSsPPT_ii[void RcppResultSet::add__matrix<double>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double**, int, int)]+0x1a3): undefined reference to `Rcpp::Dimension::operator SEXPREC*() const'
> | collect2: ld returned 1 exit status
> | ERROR: compilation failed for package 'maxent'
> | * removing 'C:/Users/timjurka/Documents/R/win-library/2.12/maxent'
> | 
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel at lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 
> -- 
> Gauss once played himself in a zero-sum game and won $50.
>                      -- #11 at http://www.gaussfacts.com



More information about the Rcpp-devel mailing list