[Ltrace-devel] [PATCH] output.c: Fix open_memstream() compilation error
Edgar E. Iglesias
edgar.iglesias at gmail.com
Fri Nov 2 15:53:43 UTC 2012
On Fri, Nov 02, 2012 at 04:33:45PM +0100, Sedat Dilek wrote:
> With the latest ltrace from GIT repository my build on MIPSEL breaks with
> the following error messages:
>
> [ build.log ]
> ...
> output.c: In function 'delim_output':
> output.c:626:3: error: implicit declaration of function 'open_memstream' [-Werror=implicit-function-declaration]
> output.c:626:15: error: initialization makes pointer from integer without a cast [-Werror]
> cc1: all warnings being treated as errors
> make[3]: *** [output.lo] Error 1
>
> My self-compiled MIPSEL toolchain consists of gcc-4.7.2-RC and uClibc-0.9.33.2
> and I have set in my uClibc dot-config file:
>
> UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
>
> ...which allows the usage of open_memstream().
>
> While digging deeper into the problem I have found a thread on uClibc-ML [1]
> called "stdio.h and open_memstream()".
> There people recommended to set "-D_GNU_SOURCE" to the compiler flags and
> the reporter confirmed this worked for him.
>
> First, I tried to set this flag globally in my ltrace Makefile, but this
> leads to more errors like "...D_GNU_SOURCE redefined..." as some other
> c-files like "proc.c" have this define already.
>
> Thus add a separate define to "output.c" file.
> This fixes the issue for me.
Hi,
I can confirm that I see the same issue with both my uclinux and linux-gnu
(eglibc) mipsel toolchains.
The man page for open_memstream says that _GNU_SOURCE needs to be defined
for glibc older than 2.10. I think Sedats patch is good.
Reviewed-by: Edgar E. Iglesias <edgar.iglesias at gmail.com>
>
> Tested against ltrace-git (commit 5511311: "Drop two non-bugs from ltrace.1")
>
> [1] http://lists.uclibc.org/pipermail/uclibc/2012-January/046279.html
>
> Signed-off-by: Sedat Dilek <sedat.dilek at gmail.com>
> ---
> output.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/output.c b/output.c
> index 94c433d..1555f2f 100644
> --- a/output.c
> +++ b/output.c
> @@ -24,6 +24,7 @@
>
> #include "config.h"
>
> +#define _GNU_SOURCE /* For open_memstream. */
> #include <stdio.h>
> #include <stdlib.h>
> #include <stdarg.h>
> --
> 1.7.9.5
>
More information about the Ltrace-devel
mailing list