[Rd] compile fails with x86_64-alpine-linux-uclibc-gcc

2012-08-12 Thread nobody
hello,

i am trying to build R on alpine/gentoo with uclibc and it fails with the 
following
error msg:

connections.c: In function 'Rconn_fgetc':
connections.c:3184:11: error: expected identifier before '(' token
connections.c:3186:15: error: expected identifier before '(' token
make[3]: *** [connections.o] Error 1

here is the whole build log :http://bpaste.net/show/39955/
any idea?

i've *walked* back the versions down to 2.14.1 and i still get exact same
error msg.
there are some patches applied but none of them touches connections.c, i
think. in any case i can provide the patches if need be.

thanks

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] compile fails with x86_64-alpine-linux-uclibc-gcc

2012-08-14 Thread nobody
On Mon, Aug 13, 2012 at 10:49:26AM -0400, Simon Urbanek wrote:
> I suspect that your runtime/libc is defining fgetc as a macro which breaks 
> any code that uses it as an identifier. Ideally, your runtime should be fixed 
> to use a proper function, but you could probably work around it with 
> something like
> 
> static char * fix_fgets(char *s, int n, FILE *stream) { return fgets(s, n, 
> stream); }
> #undef fgets
> static char * fgets(char *s, int n, FILE *stream) { return fix_fgets(s, n, 
> stream); }
> 
> Cheers,
> Simon

like this? :http://bpaste.net/show/40047/
if so, then i get this err msg:
connections.c:385:15: error: static declaration of 'fgets' follows non-static 
declaration
/usr/include/stdio.h:544:14: note: previous declaration of 'fgets' was here
connections.c: In function 'Rconn_fgetc':
connections.c:3192:11: error: expected identifier before '(' token
connections.c:3194:15: error: expected identifier before '(' token

and here is how it's declared in stdio.h on my system:

/* Get a newline-terminated string of finite length from STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
 __wur;

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] compile fails with x86_64-alpine-linux-uclibc-gcc

2012-08-14 Thread nobody
On Tue, Aug 14, 2012 at 01:48:44PM +0200, peter dalgaard wrote:
> 
> Perhaps I'm confused, but how did either of you expect to fix a problem with 
> fgetc by modifying fgets???
> 
> -- 
> Peter Dalgaard, Professor
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com

i'm not well versed in C. do know how to fix this? or, as i gather, this
is not something trivial and it has to be fixed uclibc upstream?

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] compile fails with x86_64-alpine-linux-uclibc-gcc

2012-08-14 Thread nobody
On Tue, Aug 14, 2012 at 10:32:22AM -0400, Simon Urbanek wrote:
> 
> On Aug 14, 2012, at 10:19 AM, nobody wrote:
> 
> > On Tue, Aug 14, 2012 at 01:48:44PM +0200, peter dalgaard wrote:
> >> 
> >> Perhaps I'm confused, but how did either of you expect to fix a problem 
> >> with fgetc by modifying fgets???
> >> 
> >> -- 
> >> Peter Dalgaard, Professor
> >> Center for Statistics, Copenhagen Business School
> >> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> >> Phone: (+45)38153501
> >> Email: pd@cbs.dk  Priv: pda...@gmail.com
> > 
> > i'm not well versed in C. do know how to fix this? or, as i gather, this
> > is not something trivial and it has to be fixed uclibc upstream?
> > 
> 
> What Peter is saying that my fix was useless because I was talking about 
> fgetc but fixed fgets: P
> So the fix attempt should have been
> 
> static int fix_fgetc(FILE *stream) { return fgetc(stream); }
> #undef fgetc
> static int fgetc(FILE *stream) { return fix_fgetc(stream); }
> 
> It should still be fixed upstream because I don't think POSIX allows fgetc to 
> be a macro.
> 
> Cheers,
> Simon

thanks, 's:^static:extern:' and it works, well sort of. now compilation
gets stuck (waited 3 hours) here:

make[6]: Entering directory 
`/dev/shm/portage/dev-lang/R-2.15.1/work/R-2.15.1/src/library/tools/src'
mkdir -p -- ../../../../library/tools/libs
make[6]: Leaving directory 
`/dev/shm/portage/dev-lang/R-2.15.1/work/R-2.15.1/src/library/tools/src'
make[5]: Leaving directory 
`/dev/shm/portage/dev-lang/R-2.15.1/work/R-2.15.1/src/library/tools/src'
make[4]: Leaving directory 
`/dev/shm/portage/dev-lang/R-2.15.1/work/R-2.15.1/src/library/tools'

it's apparently running:
/dev/shm/portage/dev-lang/R-2.15.1/work/R-2.15.1/bin/exec/R --vinalla --slave
with 100% cpu usage! i don't what it's doing to be honest :) any idea?

p.s.: i'm attaching the patch to this for the curious, hope it helps.
--- src/main/connections.c.orig 2012-08-14 11:47:47.105203896 -0400
+++ src/main/connections.c  2012-08-14 11:50:49.103928599 -0400
@@ -378,6 +378,16 @@
 return res;
 }
 
+#ifdef __UCLIBC__
+   extern int fix_fgetc(FILE *stream) {
+   return fgetc(stream);
+   }
+   #undef fgetc
+   extern int fgetc(FILE *stream) {
+   return fix_fgetc(stream);
+   }
+#endif
+
 int dummy_fgetc(Rconnection con)
 {
 int c;
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel