[Ltrace-devel] [PATCH] output.c: Fix open_memstream() compilation error
Sedat Dilek
sedat.dilek at gmail.com
Fri Nov 2 15:33:45 UTC 2012
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.
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