I tried RcppArmadillo_0.2.21.tar.gz with R-devel from today on FreeBSD
9.0-CURRENT (amd64). The build fails with the following messages:
------------------------------------------
#R CMD INSTALL RcppArmadillo_0.2.21.tar.gz
* installing to library '/usr/local/lib/R/library'
* installing *source* package 'RcppArmadillo' ...
** libs
g++45 -I/usr/local/lib/R/include
-I"/usr/local/lib/R/library/Rcpp/include" -I../inst/include -fpic -O2
-pipe -Wl,-rpath=/usr/local/lib/gcc45 -fno-strict-aliasing -c
RcppArmadillo.cpp -o RcppArmadillo.o
In file included from ../inst/include/armadillo:113:0,
from ../inst/include/RcppArmadilloForward.h:36,
from ../inst/include/RcppArmadillo.h:25,
from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::format, T2>&)':
../inst/include/armadillo_bits/format_wrap.hpp:146:25: error: 'snprintf'
is not a member of 'std'
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format,
T2>, T3>&)':
../inst/include/armadillo_bits/format_wrap.hpp:198:25: error: 'snprintf'
is not a member of 'std'
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format,
T2>, T3>, T4>&)':
../inst/include/armadillo_bits/format_wrap.hpp:250:25: error: 'snprintf'
is not a member of 'std'
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format,
T2>, T3>, T4>, T5>&)':
../inst/include/armadillo_bits/format_wrap.hpp:302:25: error: 'snprintf'
is not a member of 'std'
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format,
T2>, T3>, T4>, T5>, T6>&)':
../inst/include/armadillo_bits/format_wrap.hpp:354:25: error: 'snprintf'
is not a member of 'std'
In file included from ../inst/include/armadillo:113:0,
from ../inst/include/RcppArmadilloForward.h:36,
from ../inst/include/RcppArmadillo.h:25,
from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string
arma::arma_boost::str(const
arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format,
T2>, T3>, T4>, T5>, T6>, T7>&)':
../inst/include/armadillo_bits/format_wrap.hpp:406:25: error: 'snprintf'
is not a member of 'std'
*** Error code 1
Stop in /tmp/RtmpXKyP4Y/R.INSTALL4dde5c9e/RcppArmadillo/src.
ERROR: compilation failed for package 'RcppArmadillo'
* removing '/usr/local/lib/R/library/RcppArmadillo'
------------------------------------------
Obviously there is something wrong with 'snprintf'. The appended patch
avoids the breakage.
On the other hand the is a definition on FreeBSD for 'snprintf' in
libc's stdio (/usr/src/lib/libc/stdio/snprintf.c). There is a short hint
in the manpage:
SYNOPSIS
#define _WITH_DPRINTF
#include <stdio.h>
int
snprintf(char * restrict str, size_t size,
const char * restrict format, ...);
If this is the same function as meant in 'RcppArmadilloConfig.h' is
there any way to integrate it into the package? Please let me know if I
can test something.
Many thanks in advance,
Rainer Hurling
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RcppArmadillo.diff
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110530/512b1a87/attachment.txt>
[Rcpp-devel] RcppArmadillo fails on FreeBSD
7 messages · Dirk Eddelbuettel, Rainer Hurling
On 30 May 2011 at 15:43, Rainer Hurling wrote:
| I tried RcppArmadillo_0.2.21.tar.gz with R-devel from today on FreeBSD | 9.0-CURRENT (amd64). The build fails with the following messages: | | ------------------------------------------ | #R CMD INSTALL RcppArmadillo_0.2.21.tar.gz | * installing to library '/usr/local/lib/R/library' | * installing *source* package 'RcppArmadillo' ... | ** libs | g++45 -I/usr/local/lib/R/include | -I"/usr/local/lib/R/library/Rcpp/include" -I../inst/include -fpic -O2 | -pipe -Wl,-rpath=/usr/local/lib/gcc45 -fno-strict-aliasing -c | RcppArmadillo.cpp -o RcppArmadillo.o | In file included from ../inst/include/armadillo:113:0, | from ../inst/include/RcppArmadilloForward.h:36, | from ../inst/include/RcppArmadillo.h:25, | from RcppArmadillo.cpp:22: | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::format, T2>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:146:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:198:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:250:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:302:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>, T6>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:354:25: error: 'snprintf' | is not a member of 'std' | In file included from ../inst/include/armadillo:113:0, | from ../inst/include/RcppArmadilloForward.h:36, | from ../inst/include/RcppArmadillo.h:25, | from RcppArmadillo.cpp:22: | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>, T6>, T7>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:406:25: error: 'snprintf' | is not a member of 'std' | *** Error code 1 | Stop in /tmp/RtmpXKyP4Y/R.INSTALL4dde5c9e/RcppArmadillo/src. | ERROR: compilation failed for package 'RcppArmadillo' | * removing '/usr/local/lib/R/library/RcppArmadillo' | ------------------------------------------ | | | Obviously there is something wrong with 'snprintf'. The appended patch | avoids the breakage. | | On the other hand the is a definition on FreeBSD for 'snprintf' in | libc's stdio (/usr/src/lib/libc/stdio/snprintf.c). There is a short hint | in the manpage: | | SYNOPSIS | #define _WITH_DPRINTF | #include <stdio.h> | int | snprintf(char * restrict str, size_t size, | const char * restrict format, ...); | | If this is the same function as meant in 'RcppArmadilloConfig.h' is | there any way to integrate it into the package? Please let me know if I | can test something. I do not understand what you are asking: "as meant in RcppArmadilloConfig" ? Neither Romain, Doug nor I use a *BSD variant (if we ignore OS X as a BSD-derivative). So nothing in RcppArmadillo explicitly enables or disables *BSD. You have to tell us what works or doesn't. We cannot test or develop changes for *BSD. | Many thanks in advance, | Rainer Hurling | | ---------------------------------------------------------------------- | --- inst/include/RcppArmadilloConfig.h.origin 2011-05-27 17:18:47.000000000 +0200 | +++ inst/include/RcppArmadilloConfig.h 2011-05-30 13:53:25.000000000 +0200 | @@ -37,7 +37,7 @@ | | | /* TODO: we might need to undef this on other platforms as well */ | -#if defined(__GNUC__) && defined(_WIN64) | +#if defined(__GNUC__) && defined(_WIN64) || defined(__FreeBSD__) | #undef ARMA_HAVE_STD_SNPRINTF | #endif That patch looks fine to me and would presumabky play nicely with Armadillo as the change would be solely at our level. I'll apply it it now, so 0.2.22 will have it. Dirk
Gauss once played himself in a zero-sum game and won $50.
-- #11 at http://www.gaussfacts.com
On 30.05.2011 16:24 (UTC+1), Dirk Eddelbuettel wrote:
On 30 May 2011 at 15:43, Rainer Hurling wrote: | I tried RcppArmadillo_0.2.21.tar.gz with R-devel from today on FreeBSD | 9.0-CURRENT (amd64). The build fails with the following messages: | | ------------------------------------------ | #R CMD INSTALL RcppArmadillo_0.2.21.tar.gz | * installing to library '/usr/local/lib/R/library' | * installing *source* package 'RcppArmadillo' ... | ** libs | g++45 -I/usr/local/lib/R/include | -I"/usr/local/lib/R/library/Rcpp/include" -I../inst/include -fpic -O2 | -pipe -Wl,-rpath=/usr/local/lib/gcc45 -fno-strict-aliasing -c | RcppArmadillo.cpp -o RcppArmadillo.o | In file included from ../inst/include/armadillo:113:0, | from ../inst/include/RcppArmadilloForward.h:36, | from ../inst/include/RcppArmadillo.h:25, | from RcppArmadillo.cpp:22: | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::format, T2>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:146:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:198:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:250:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:302:25: error: 'snprintf' | is not a member of 'std' | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>, T6>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:354:25: error: 'snprintf' | is not a member of 'std' | In file included from ../inst/include/armadillo:113:0, | from ../inst/include/RcppArmadilloForward.h:36, | from ../inst/include/RcppArmadillo.h:25, | from RcppArmadillo.cpp:22: | ../inst/include/armadillo_bits/format_wrap.hpp: In function 'std::string | arma::arma_boost::str(const | arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::basic_format<arma::arma_boost::format, | T2>, T3>, T4>, T5>, T6>, T7>&)': | ../inst/include/armadillo_bits/format_wrap.hpp:406:25: error: 'snprintf' | is not a member of 'std' | *** Error code 1 | Stop in /tmp/RtmpXKyP4Y/R.INSTALL4dde5c9e/RcppArmadillo/src. | ERROR: compilation failed for package 'RcppArmadillo' | * removing '/usr/local/lib/R/library/RcppArmadillo' | ------------------------------------------ | | | Obviously there is something wrong with 'snprintf'. The appended patch | avoids the breakage. | | On the other hand the is a definition on FreeBSD for 'snprintf' in | libc's stdio (/usr/src/lib/libc/stdio/snprintf.c). There is a short hint | in the manpage: | | SYNOPSIS | #define _WITH_DPRINTF | #include<stdio.h> | int | snprintf(char * restrict str, size_t size, | const char * restrict format, ...); | | If this is the same function as meant in 'RcppArmadilloConfig.h' is | there any way to integrate it into the package? Please let me know if I | can test something. I do not understand what you are asking: "as meant in RcppArmadilloConfig" ? Neither Romain, Doug nor I use a *BSD variant (if we ignore OS X as a BSD-derivative). So nothing in RcppArmadillo explicitly enables or disables *BSD.
Thanks for answering. Sorry for my bad english and the misunderstanding. I am not a developer so the following is just a wild guess: In FreeBSD there is a function snprintf in stdio of libc. I was wondering if this could be the function, which RcppArmadillo would expect to find (on linux etc.) at std:snprintf? If yes, is there some chance to use this type of snprintf on FreeBSD systems? Or is my below patch ok and there is no problem not using snprintf (on FreeBSD) at all? Hope this is not totally nonsense.
You have to tell us what works or doesn't. We cannot test or develop changes for *BSD. | Many thanks in advance, | Rainer Hurling | | ---------------------------------------------------------------------- | --- inst/include/RcppArmadilloConfig.h.origin 2011-05-27 17:18:47.000000000 +0200 | +++ inst/include/RcppArmadilloConfig.h 2011-05-30 13:53:25.000000000 +0200 | @@ -37,7 +37,7 @@ | | | /* TODO: we might need to undef this on other platforms as well */ | -#if defined(__GNUC__)&& defined(_WIN64) | +#if defined(__GNUC__)&& defined(_WIN64) || defined(__FreeBSD__) | #undef ARMA_HAVE_STD_SNPRINTF | #endif That patch looks fine to me and would presumabky play nicely with Armadillo as the change would be solely at our level. I'll apply it it now, so 0.2.22 will have it.
Thanks for including the patch, Rainer
Dirk
On 30 May 2011 at 17:21, Rainer Hurling wrote:
| > I do not understand what you are asking: "as meant in RcppArmadilloConfig" ?
| > Neither Romain, Doug nor I use a *BSD variant (if we ignore OS X as a BSD-derivative).
| > So nothing in RcppArmadillo explicitly enables or disables *BSD.
|
| Thanks for answering. Sorry for my bad english and the misunderstanding.
| I am not a developer so the following is just a wild guess:
|
| In FreeBSD there is a function snprintf in stdio of libc. I was
| wondering if this could be the function, which RcppArmadillo would
| expect to find (on linux etc.) at std:snprintf?
|
| If yes, is there some chance to use this type of snprintf on FreeBSD
| systems? Or is my below patch ok and there is no problem not using
| snprintf (on FreeBSD) at all?
|
| Hope this is not totally nonsense.
Between you and me, somebody is confused.
snprintf is a standard C library function going (IIRC) back to Kernighan and
Ritchie. My system's manual page shows
int snprintf(char *str, size_t size, const char *format, ...);
which is the same as what you quoted:
int snprintf(char * restrict str, size_t size, const char * restrict format, ...);
apart from the sole difference of 'restrict' which I've never seen before.
So per se, we should not need anything special to use snprintf. Can you try
something like this on your box, please?
edd at max:/tmp$ gcc -Wall -o rainer rainer.c
edd at max:/tmp$ ./rainer
Char vector is now [Hello, world]
edd at max:/tmp$ cat rainer.c
#include <stdio.h>
int main(void) {
char foo[32];
snprintf(foo, 31, "Hello, world");
printf("Char vector is now [%s]\n", foo);
return(0);
}
edd at max:/tmp$
We may have turned snprintf off for you by accident, but following your patch
we should now be good.
Unless I am totally undercaffeinated and missing something here.
Dirk
| > You have to tell us what works or doesn't. We cannot test or develop changes
| > for *BSD.
| >
| > | Many thanks in advance,
| > | Rainer Hurling
| > |
| > | ----------------------------------------------------------------------
| > | --- inst/include/RcppArmadilloConfig.h.origin 2011-05-27 17:18:47.000000000 +0200
| > | +++ inst/include/RcppArmadilloConfig.h 2011-05-30 13:53:25.000000000 +0200
| > | @@ -37,7 +37,7 @@
| > |
| > |
| > | /* TODO: we might need to undef this on other platforms as well */
| > | -#if defined(__GNUC__)&& defined(_WIN64)
| > | +#if defined(__GNUC__)&& defined(_WIN64) || defined(__FreeBSD__)
| > | #undef ARMA_HAVE_STD_SNPRINTF
| > | #endif
| >
| > That patch looks fine to me and would presumabky play nicely with Armadillo
| > as the change would be solely at our level.
| >
| > I'll apply it it now, so 0.2.22 will have it.
|
| Thanks for including the patch,
| Rainer
|
| > Dirk
Gauss once played himself in a zero-sum game and won $50.
-- #11 at http://www.gaussfacts.com
Am 30.05.2011 18:21 (UTC+1) schrieb Dirk Eddelbuettel:
On 30 May 2011 at 17:21, Rainer Hurling wrote: |> I do not understand what you are asking: "as meant in RcppArmadilloConfig" ? |> Neither Romain, Doug nor I use a *BSD variant (if we ignore OS X as a BSD-derivative). |> So nothing in RcppArmadillo explicitly enables or disables *BSD. | | Thanks for answering. Sorry for my bad english and the misunderstanding. | I am not a developer so the following is just a wild guess: | | In FreeBSD there is a function snprintf in stdio of libc. I was | wondering if this could be the function, which RcppArmadillo would | expect to find (on linux etc.) at std:snprintf? | | If yes, is there some chance to use this type of snprintf on FreeBSD | systems? Or is my below patch ok and there is no problem not using | snprintf (on FreeBSD) at all? | | Hope this is not totally nonsense. Between you and me, somebody is confused.
It's me, I am afraid ;-)
snprintf is a standard C library function going (IIRC) back to Kernighan and
Ritchie. My system's manual page shows
int snprintf(char *str, size_t size, const char *format, ...);
which is the same as what you quoted:
int snprintf(char * restrict str, size_t size, const char * restrict format, ...);
apart from the sole difference of 'restrict' which I've never seen before.
I agree.
So per se, we should not need anything special to use snprintf. Can you try
something like this on your box, please?
edd at max:/tmp$ gcc -Wall -o rainer rainer.c
edd at max:/tmp$ ./rainer
Char vector is now [Hello, world]
edd at max:/tmp$ cat rainer.c
#include<stdio.h>
int main(void) {
char foo[32];
snprintf(foo, 31, "Hello, world");
printf("Char vector is now [%s]\n", foo);
return(0);
}
edd at max:/tmp$
I erroneously thought that '#undef ARMA_HAVE_STD_SNPRINTF' will stop using the systems snprintf. ./rainer Char vector is now [Hello, world] So it works as aspected.
We may have turned snprintf off for you by accident, but following your patch we should now be good.
Dirk, sorry again for my misunderstanding. Yes, I also think that FreeBSD people could live with this patch.
Unless I am totally undercaffeinated and missing something here.
Thanks again for your patience and advice, Rainer
Dirk |> You have to tell us what works or doesn't. We cannot test or develop changes |> for *BSD. |> |> | Many thanks in advance, |> | Rainer Hurling |> | |> | ---------------------------------------------------------------------- |> | --- inst/include/RcppArmadilloConfig.h.origin 2011-05-27 17:18:47.000000000 +0200 |> | +++ inst/include/RcppArmadilloConfig.h 2011-05-30 13:53:25.000000000 +0200 |> | @@ -37,7 +37,7 @@ |> | |> | |> | /* TODO: we might need to undef this on other platforms as well */ |> | -#if defined(__GNUC__)&& defined(_WIN64) |> | +#if defined(__GNUC__)&& defined(_WIN64) || defined(__FreeBSD__) |> | #undef ARMA_HAVE_STD_SNPRINTF |> | #endif |> |> That patch looks fine to me and would presumabky play nicely with Armadillo |> as the change would be solely at our level. |> |> I'll apply it it now, so 0.2.22 will have it. | | Thanks for including the patch, | Rainer | |> Dirk
On 31 May 2011 at 09:27, Rainer Hurling wrote:
| Dirk, sorry again for my misunderstanding. No worries. I do appreciate how you (pretty much single-handedly) try to keep R and its packages viable on your chosen platform. | Yes, I also think that | FreeBSD people could live with this patch. The patch currently says (and I now include the forward-looking comment :) /* TODO: we might need to undef this on other platforms as well */ #if defined(__GNUC__) && defined(_WIN64) || defined(__FreeBSD__) #undef ARMA_HAVE_STD_SNPRINTF #endif Would we need additional defines for NetBSD and/or OpenBSD? Dirk
Gauss once played himself in a zero-sum game and won $50.
-- #11 at http://www.gaussfacts.com
On 31.05.2011 21:44 (UTC+1), Dirk Eddelbuettel wrote:
On 31 May 2011 at 09:27, Rainer Hurling wrote: | Dirk, sorry again for my misunderstanding. No worries. I do appreciate how you (pretty much single-handedly) try to keep R and its packages viable on your chosen platform.
That's nice circumscribed for a bundle of packages we have to use at work ;-) From my point of view the very most work with R on FreeBSD is done by Brendan Fabeny (b.f.) and he does a great job.
| Yes, I also think that | FreeBSD people could live with this patch. The patch currently says (and I now include the forward-looking comment :) /* TODO: we might need to undef this on other platforms as well */ #if defined(__GNUC__)&& defined(_WIN64) || defined(__FreeBSD__) #undef ARMA_HAVE_STD_SNPRINTF #endif Would we need additional defines for NetBSD and/or OpenBSD?
I am afraid that I do not have any knowledge about it. (If it would be needed the preprocessor defines should be __OpenBSD__ and __NetBSD__, but this is well known, isn't it?) Rainer
Dirk