From ripley at stats.ox.ac.uk  Wed Mar 12 08:28:05 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 12 Mar 2008 07:28:05 +0000 (GMT)
Subject: [Rd] Rtools and GCC4 problem
In-Reply-To: <loom.20080311T181515-595@post.gmane.org>
References: <loom.20080311T181515-595@post.gmane.org>
Message-ID: <alpine.LFD.1.00.0803120720550.24176@gannet.stats.ox.ac.uk>

You seem to be assuming that the C++ code is correct and the compiler is 
wrong.  It seems very much more plausible that the reverse is true.

Gcc3 was notoriously loose in its standards conformance in C++ and 
Fortran.  Gcc4 is better, but g++4 still allows at least 10 packages on 
CRAN to compile which contain invalid C++ code and which compilers such as 
Sun Studio 12 reject.


On Tue, 11 Mar 2008, Joe Byers wrote:

>
>>>
>
> I am trying to compile rseries from Whit Armstrong and a colleague of mine found
> a problem with using GCC4
>
> I get the following error when compiling rseries
> g++-sjlj   -Ic:/R/include     -O2 -Wall  -c Rutils.cpp -o Rutils.o
> Rutils.cpp: In function 'double* getColPointer(SEXPREC*, int)':
> Rutils.cpp:406: warning: deprecated conversion from string constant to 'char*'
> g++-sjlj   -Ic:/R/include     -O2 -Wall  -c array.cpp -o array.o
> g++-sjlj   -Ic:/R/include     -O2 -Wall  -c interface.cpp -o interface.o
> In file included from interface.hpp:1,
>                 from interface.cpp:1:
> tseries.hpp: In function 'tseries* cbind(Seq<T, std::allocator<_CharT> >&, bool)
> ':
> tseries.hpp:533: error: no matching function for call to 'tseries::setDates(std:
> :vector<double, std::allocator<double> >&)'
> tseries.hpp:112: note: candidates are: void tseries::setDates(double*)
>
>
> I changed the BUILD=GCC3 in MkRules and rseries will compile after fixing the
> isnan declaration.
>
> I was wondering if anyone had experienced this type of problem in other packages
> and what could be done to fix it here or if it is in Rtools.  The Rtools version
> I downgraded to 26 from 27 to get the GCC3 compiler..
>
> thank you
> joe
>
> The following the output from building
> C:\src\R>r CMD install rseries
> installing to 'c:/src/R/R-2.5.1/library'
>
>
> ---------- Making package rseries ------------
>  adding build stamp to DESCRIPTION
>  installing NAMESPACE file and metadata
>  making DLL ...
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c Rutils.cpp -o Rutils.o
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h: In function `std::vector<std::string, std::allocator<std::string> >
> listnames(SEXPREC*)':
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h: In function `std::vector<std::string, std::allocator<std::string> >
> rownames(SEXPREC*)':
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h: In function `std::vector<std::string, std::allocator<std::string> >
> colnames(SEXPREC*)':
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c array.cpp -o array.o
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c interface.cpp -o interface.o
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c mask.cpp -o mask.o
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c math_utils.cpp -o math_utils.o
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c ts.data.cpp -o ts.data.o
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c tseries.cpp -o tseries.o
> tseries.cpp: In function `tseries linear_model(const tseries&, const tseries&)':
> tseries.cpp:1058: warning: unused variable 'trans'
> tseries.cpp:1059: warning: unused variable 'nrhs'
> tseries.cpp:1060: warning: unused variable 'info'
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h: In member function `std::vector<std::string, std::allocator<std::string>
>> tseries::getColNam
> es() const':
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_vector.h:
> In member function `std::vector<_Tp, _Alloc>& std::vector<_Tp,
> _Alloc>::operator=(const std::vector< _Tp, _Alloc>&) [with _Tp = std::string,
> _Alloc = std::allocator<std::string>]':
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_vector.h:7
> 15: warning: '__result' might be used uninitialized in this function
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> c:/src/R/Rtools/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/
> 3.4.5/bits/stl_uninitiali
> zed.h:82: warning: '__cur' might be used uninitialized in this function
> g++   -Ic:/src/R/R-2.5.1/include  -Wall -O2   -c util.cpp -o util.o
> windres -I c:/src/R/R-2.5.1/include  -i rseries_res.rc -o rseries_res.o
> g++  -shared -s  -o rseries.dll rseries.def Rutils.o array.o interface.o
> g++ mask.o math_utils.o ts.data
> .o tseries.o util.o rseries_res.o  -Lc:/src/R/R-2.5.1/bin    -lR
>  ... DLL made
>  installing DLL
>  installing R files
>  no man files in this package
>  installing indices
>  installing help
>  adding MD5 sums
>
> * DONE (Rseries)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Rtools and GCC4 problem
Prof Brian Ripley