编译openwrt 遇到qemu-2.11错误

gcc -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/util -Iutil -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tcg -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tcg/i386 -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/linux-headers -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/linux-headers -I. -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1 -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/accel/tcg -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/include -pthread -I/home/acel/lede/staging_dir/hostpkg/include/glib-2.0 -I/home/acel/lede/staging_dir/hostpkg/lib/glib-2.0/include -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tests -MMD -MP -MT util/qemu-thread-posix.o -MF util/qemu-thread-posix.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O2 -I/home/acel/lede/staging_dir/host/include -I/home/acel/lede/staging_dir/hostpkg/include -I/home/acel/lede/staging_dir/target-mipsel_24kc_musl/host/include  -c -o util/qemu-thread-posix.o util/qemu-thread-posix.c
gcc -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/util -Iutil -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tcg -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tcg/i386 -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/linux-headers -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/linux-headers -I. -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1 -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/accel/tcg -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/include -pthread -I/home/acel/lede/staging_dir/hostpkg/include/glib-2.0 -I/home/acel/lede/staging_dir/hostpkg/lib/glib-2.0/include -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -I/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/tests -MMD -MP -MT util/memfd.o -MF util/memfd.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O2 -I/home/acel/lede/staging_dir/host/include -I/home/acel/lede/staging_dir/hostpkg/include -I/home/acel/lede/staging_dir/target-mipsel_24kc_musl/host/include  -c -o util/memfd.o util/memfd.c
util/memfd.c:40:12: error: static declaration of 'memfd_create' follows non-static declaration
 static int memfd_create(const char *name, unsigned int flags)
            ^~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/mman-linux.h:115:0,
                 from /usr/include/x86_64-linux-gnu/bits/mman.h:45,
                 from /usr/include/x86_64-linux-gnu/sys/mman.h:41,
                 from /home/acel/lede/build_dir/hostpkg/qemu-2.11.1/include/sysemu/os-posix.h:29,
                 from /home/acel/lede/build_dir/hostpkg/qemu-2.11.1/include/qemu/osdep.h:104,
                 from util/memfd.c:28:
/usr/include/x86_64-linux-gnu/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here
 int memfd_create (const char *__name, unsigned int __flags) __THROW;
     ^~~~~~~~~~~~
/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/rules.mak:66: recipe for target 'util/memfd.o' failed
make[4]: *** [util/memfd.o] Error 1
make[4]: Leaving directory '/home/acel/lede/build_dir/hostpkg/qemu-2.11.1'
Makefile:140: recipe for target '/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/.built' failed
make[3]: *** [/home/acel/lede/build_dir/hostpkg/qemu-2.11.1/.built] Error 2
make[3]: Leaving directory '/home/acel/lede/package/lean/qemu-userspace'
package/Makefile:107: recipe for target 'package/lean/qemu-userspace/host/compile' failed
make[2]: *** [package/lean/qemu-userspace/host/compile] Error 2
make[2]: Leaving directory '/home/acel/lede'
package/Makefile:103: recipe for target '/home/acel/lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/acel/lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/acel/lede'
/home/acel/lede/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

=============================================================================
http://debian.2.n7.nabble.com/Bug-891375-qemu-FTBFS-with-glibc-2-27-error-static-declaration-of-memfd-create-follows-non-static-den-td4284669.html


https://git.qemu.org/?p=qemu.git;a=commit;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0

emfd: fix configure test

Recent glibc added memfd_create in sys/mman.h.  This conflicts with
the definition in util/memfd.c:

    /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration

Fix the configure test, and remove the sys/memfd.h inclusion since the
file actually does not exist---it is a typo in the memfd_create(2) man
page.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/configure b/configure
index 9c8aa5a..99ccc17 100755 (executable)
--- a/configure
+++ b/configure
@@ -3923,7 +3923,7 @@ fi
 # check if memfd is supported
 memfd=no
 cat > $TMPC << EOF
-#include <sys/memfd.h>
+#include <sys/mman.h>
 
 int main(void)
 {
 ----------------------------------------------------------------------------------------------------------------------------------------
 
 diff --git a/util/memfd.c b/util/memfd.c
index 4571d1a..412e94a 100644 (file)
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -31,9 +31,7 @@
 
 #include "qemu/memfd.h"
 
-#ifdef CONFIG_MEMFD
-#include <sys/memfd.h>
-#elif defined CONFIG_LINUX
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
 #include <sys/syscall.h>
 #include <asm/unistd.h>
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值