dpkg: fix include header caused compile error

Build dpkg-native on Fedora 19, it fails with:

/usr/include/c++/4.8.1/cstdlib: In function ‘long long int std::abs(long long int)’:
/usr/include/c++/4.8.1/cstdlib:174:20: error: declaration of C function ‘long long int std::abs(long long int)’ conflicts with
   abs(long long __x) { return __builtin_llabs (__x); }
                    ^
/usr/include/c++/4.8.1/cstdlib:166:3: error: previous declaration ‘long int std::abs(long int)’ here
   abs(long __i) { return __builtin_labs(__i); }
   ^

That because header cstdlib is included in a 'extern "C"' block that gcc
4.8 doesn't support. Fix it by move the header file out of the 'extern "C"'
block.

(From OE-Core master rev: 7de61ecc3efc43c625dde9a66f5c05e980a82e34)

(From OE-Core rev: 0e60a468c1a81642d4319c0831dafd2f6fa43d86)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kai Kang
2013-08-13 17:57:49 +08:00
committed by Richard Purdie
parent c46300e08c
commit ecfe97741f
2 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
Upstream-Status: Pending
dpkg defines:
#define DPKG_BEGIN_DECLS extern "C" {
That makes header cstdlib included in a extern "C" block which is not supported
by gcc 4.8. It fails on Fedora 19:
/usr/include/c++/4.8.1/cstdlib: In function long long int std::abs(long long int):
/usr/include/c++/4.8.1/cstdlib:174:20: error: declaration of C function long long int std::abs(long long int) conflicts with
abs(long long __x) { return __builtin_llabs (__x); }
^
/usr/include/c++/4.8.1/cstdlib:166:3: error: previous declaration long int std::abs(long int) here
abs(long __i) { return __builtin_labs(__i); }
^
Move include gettext.h out of the extern "C" block to fix this issue.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
--- dpkg-1.17.1/lib/dpkg/i18n.h.orig 2013-08-13 17:31:28.870935573 +0800
+++ dpkg-1.17.1/lib/dpkg/i18n.h 2013-08-13 17:31:37.893065249 +0800
@@ -23,8 +23,6 @@
#include <dpkg/macros.h>
-DPKG_BEGIN_DECLS
-
/**
* @defgroup i18n Internationalization support
* @ingroup dpkg-internal
@@ -33,6 +31,8 @@
#include <gettext.h>
+DPKG_BEGIN_DECLS
+
/* We need to include this because pgettext() uses LC_MESSAGES, but libintl.h
* which gets pulled by gettext.h only includes it if building optimized. */
#include <locale.h>

View File

@@ -6,7 +6,9 @@ SRC_URI += "file://noman.patch \
file://check_version.patch \
file://preinst.patch \
file://fix-timestamps.patch \
file://remove-tar-no-timestamp.patch"
file://remove-tar-no-timestamp.patch \
file://fix-abs-redefine.patch \
"
SRC_URI[md5sum] = "4df9319b2d17e19cdb6fe94dacee44da"
SRC_URI[sha256sum] = "73cd7fba4e54acddd645346b4bc517030b9c35938e82215d3eeb8b4e7af26b7a"