Hello,
Testing uClibc snapshot, utils/getconf.c fails to build with my host
libc (glibc 2.7, from a Debian Lenny installation) with the following
message :
# Build the host utils. Need to add an install target...
/usr/bin/make -j1 -C /home/test/outputs/testtool/toolchain/uClibc/utils \
PREFIX=/home/test/outputs/testtool/staging \
HOSTCC="/usr/bin/gcc" \
hostutils
make[1]: Entering directory `/home/test/outputs/testtool/toolchain/uClibc/utils'
HOSTCC utils/getconf.host
../utils/getconf.c:1025: error: '_SC_V7_ILP32_OFF32' undeclared here (not in a
function)
../utils/getconf.c:1026: error: '_SC_V7_ILP32_OFFBIG' undeclared here (not in a
function)
../utils/getconf.c:1027: error: '_SC_V7_LP64_OFF64' undeclared here (not in a
function)
../utils/getconf.c:1028: error: '_SC_V7_LPBIG_OFFBIG' undeclared here (not in a
function)
../utils/getconf.c: In function 'main':
../utils/getconf.c:1157: warning: implicit declaration of function 'mempcpy'
../utils/getconf.c:1157: warning: incompatible implicit declaration of built-in
function 'mempcpy'
../utils/getconf.c:1220: warning: incompatible implicit declaration of built-in
function 'mempcpy'
make[1]: *** [../utils/getconf.host] Error 1
make[1]: Leaving directory
`/home/test/outputs/testtool/toolchain/uClibc/utils'
This is because the _SC_V7_* symbols have only been added in further
versions of the C library (there are available in the 2.11 glibc
library of my newer Ubuntu system).
However, as Debian Lenny is still the currently stable Debian version,
it'd be nice if building uClibc on it would work.
The attached patch fixes the problem for me, but as my understanding of
what utils/getconf.c do is limited, I'm far from sure that it's the
right fix.
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
>From 1b36ac390724a83455e349fdf6487dd513aeac05 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <[email protected]>
Date: Sat, 4 Dec 2010 09:58:38 +0100
Subject: [PATCH] getconf: only use specs names when available
On older glibc (like 2.7), the _SC_V7_* symbols are not defined,
making the build of current uClibc fail on Debian Lenny systems and
other systems using a fairly old glibc. So we make sure to only use
the specs names that are defined by the host C library.
Signed-off-by: Thomas Petazzoni <[email protected]>
---
utils/getconf.c | 72 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/utils/getconf.c b/utils/getconf.c
index 81566df..812783e 100644
--- a/utils/getconf.c
+++ b/utils/getconf.c
@@ -1014,18 +1014,42 @@ static const struct conf vars[] =
static const struct { const char *name; int num; } specs[] =
{
+#ifdef _SC_XBS5_ILP32_OFF32
{ "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
+#endif
+#ifdef _SC_XBS5_ILP32_OFFBIG
{ "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
+#endif
+#ifdef _SC_XBS5_LP64_OFF64
{ "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
+#endif
+#ifdef _SC_XBS5_LPBIG_OFFBIG
{ "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
+#endif
+#ifdef _SC_V6_ILP32_OFF32
{ "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
+#endif
+#ifdef _SC_V6_ILP32_OFFBIG
{ "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
+#endif
+#ifdef _SC_V6_LP64_OFF64
{ "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
+#endif
+#ifdef _SC_V6_LPBIG_OFFBIG
{ "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
+#endif
+#ifdef _SC_V7_ILP32_OFF32
{ "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
+#endif
+#ifdef _SC_V7_ILP32_OFFBIG
{ "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
+#endif
+#ifdef _SC_V7_LP64_OFF64
{ "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
+#endif
+#ifdef _SC_V7_LPBIG_OFFBIG
{ "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
+#endif
};
static const int nspecs = sizeof (specs) / sizeof (specs[0]);
@@ -1177,41 +1201,41 @@ environment SPEC.\n\n");
switch (specs[i].num)
{
-#ifndef _XBS5_ILP32_OFF32
- case _SC_XBS5_ILP32_OFF32:
+#if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32)
+ case _SC_XBS5_ILP32_OFF32:
#endif
-#ifndef _XBS5_ILP32_OFFBIG
- case _SC_XBS5_ILP32_OFFBIG:
+#if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG)
+ case _SC_XBS5_ILP32_OFFBIG:
#endif
-#ifndef _XBS5_LP64_OFF64
- case _SC_XBS5_LP64_OFF64:
+#if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64)
+ case _SC_XBS5_LP64_OFF64:
#endif
-#ifndef _XBS5_LPBIG_OFFBIG
- case _SC_XBS5_LPBIG_OFFBIG:
+#if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG)
+ case _SC_XBS5_LPBIG_OFFBIG:
#endif
-#ifndef _POSIX_V6_ILP32_OFF32
- case _SC_V6_ILP32_OFF32:
+#if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32)
+ case _SC_V6_ILP32_OFF32:
#endif
-#ifndef _POSIX_V6_ILP32_OFFBIG
- case _SC_V6_ILP32_OFFBIG:
+#if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG)
+ case _SC_V6_ILP32_OFFBIG:
#endif
-#ifndef _POSIX_V6_LP64_OFF64
- case _SC_V6_LP64_OFF64:
+#if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64)
+ case _SC_V6_LP64_OFF64:
#endif
-#ifndef _POSIX_V6_LPBIG_OFFBIG
- case _SC_V6_LPBIG_OFFBIG:
+#if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG)
+ case _SC_V6_LPBIG_OFFBIG:
#endif
-#ifndef _POSIX_V7_ILP32_OFF32
- case _SC_V7_ILP32_OFF32:
+#if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32)
+ case _SC_V7_ILP32_OFF32:
#endif
-#ifndef _POSIX_V7_ILP32_OFFBIG
- case _SC_V7_ILP32_OFFBIG:
+#if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG)
+ case _SC_V7_ILP32_OFFBIG:
#endif
-#ifndef _POSIX_V7_LP64_OFF64
- case _SC_V7_LP64_OFF64:
+#if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64)
+ case _SC_V7_LP64_OFF64:
#endif
-#ifndef _POSIX_V7_LPBIG_OFFBIG
- case _SC_V7_LPBIG_OFFBIG:
+#if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG)
+ case _SC_V7_LPBIG_OFFBIG:
#endif
{
const char *args[argc + 3];
--
1.7.0.4
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc