New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::snprintf not found with GCC 4.8, 4.6 #16
Comments
Thanks. In fact, I imagine Thoughts, @eddelbuettel? |
For changes to Armadillo, you need to talk Armadillo's author -- which is Conrad. |
Ok, on second look the file in question, ie But it turns out that we do define
Could you be a bit more specific in how this hurt you? I guess your code used We could of course flip the definition, but I'd have to do a wee bit more research about this. |
Here is what I get : I tried manual compilation after installing through R failed with that error, to try and follow what is going on. |
You should be able to avoid this locally by enforcing |
I did try with std=c++11, std=c++0x, std=gnu++0x, none of them changed the result. As I said, I do recognize that this might be a compiler or libstdc++ bug, but it's probably easier to go around it than to get this fixed in a timely manner. |
I would edit Note that the problem has not bitten anybody else in years it seems, so is there any chance it could be local to you setup? |
I don't see |
Moreover, showing an |
Here is the example with -std=c++11. I put CXXFLAGS in ~/.R/Makevars, and not PKG_CXXFLAGS, but it was used. [mboisson@colosse3 src]$ /software6/compilers/gcc/4.8/bin/g++ -I/software6/bioinfo/apps/mugqic_space//software/R_3.0.2_gcc4.8/R-3.0.2/lib64/R/include -DNDEBUG -I/usr/local/include -I"/software6/bioinfo/apps/mugqic_space/software/R_3.0.2_gcc4.8/R-3.0.2/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o -std=c++11 It is possible that it's something with our installation, as we compile everything from source (including GCC). However, I am now at over a hundred of packages that all compiled fine with our GCC 4.8 installation. Have you tried compiling R and Rcpparmadillo with GCC 4.8 ? |
Here is what I get with a sample code to just test std::snprintf with GCC 4.8 : #include g++ test.cpp -std=c++11 |
That #include was of cstdio |
By the way, I opened a bug report on GCC bug tracker, for libstdc++ : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61101 |
Yes, |
Hum, I don't know then, maybe it has to do with the glibc from CentOS 6... My question remains though, why force std::snprintf rather than just letting the compiler find whatever it can ? Does std::snprintf have different behavior than snprintf ? |
I see no issue here so I am inclined to close this. edd@max:/tmp$ cat mboisson.cpp
#include <cstdio>
#include <iostream>
int main() {
char * test = new char[10];
std::snprintf(test, 10, "%f", 2.);
std::cout << test << std::endl;
return 0;
}
edd@max:/tmp$ g++ -Wall -o mboisson mboisson.cpp
edd@max:/tmp$ ./mboisson
2.000000
edd@max:/tmp$ |
I am closing this as a local / non-reproducible issue. |
Hi,
For some reason, GCC 4.8 and 4.6 tell me that snprintf is not part of std. I tried virtually every -std options, and nothing works. However, replacing std::snprintf by just snprintf in arma_boost.hpp solved the problem as it falls back on snprintf from C99.
While I consider this to be a compiler bug, would it be possible to just change it in your code to use snprintf instead of std::snprintf ?
The text was updated successfully, but these errors were encountered: