运行QEMU时,出现错误:(process:8559): GLib-WARNING...gmem.c:483: custom memory allocation vtable not support

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhaixuebuluo/article/details/52860362
在Ubuntu上主机上,手动编译安装好QEMU后,运行自己编译的linux4.4内核的zImage镜像,会出现以下错误:
root@ubuntu:/home# qemu-system-arm -M vexpress-a9 -m 512M -kernel linux-4.4/arch/arm/boot/zImage -nographic -append "console=ttyAMA0"

(process:8559): GLib-WARNING **: /build/glib2.0-8EA4QF/glib2.0-2.48.1/./glib/gmem.c:483: custom memory allocation vtable not supported


这个在编译安装QEMU的时候就因为glibc的一个库函数调用g_mem_set_vtable 产生了警告,导致编译终止,后来忽略掉编译警告才编译完成,qemu安装的还是有问题。网上看了很多解决方法,包括关smm off都没有解决。

网上搜了这个函数:g_mem_set_vtable

has been deprecated since version 2.46 and should not be used in newly-written code.
Use other memory profiling tools instead
This function used to let you override the memory allocation function. However, its use was incompatible with the use of global constructors in GLib and GIO, because those use the GLib allocators before main is reached. Therefore this function is now deprecated and is just a stub.

在glibc中查看该函数的声明和定义:glib.h->ghash.h->glist.h->glib.h->gmem.h

GLIB_DEPRECATED_IN_2_46
void     g_mem_set_vtable (GMemVTable   *vtable);
GLIB_DEPRECATED_IN_2_46
gboolean g_mem_is_system_malloc (void);

大概的意思,就是这个函数由于跟glibc的不兼容等问题,从2.46版本就将这个函数标记为GLIB_DEPRECATED_IN_2_46,再加上make编译参数的warnning设置,导致编译失败。这样,接下来,解决的思路大致有两个:

1.downgradding glibc,但是可能会对系统造成影响,导致向下兼容的一些新版本软件可能存在问题

2.使用新版本的qemu,从qemu2.0,更新到qemu2.7,patch这个漏洞,新版本的qemu源码中应该使用其它函数实现这个内存定位的功能。结果使用QEMU2.7版本,编译顺利通过,但是最新的版本貌似不再支持mini2440,对vexpress支持更加完善。

对于方法1,做好库备份,有兴趣的可以去实验一下。

 

猜你喜欢

转载自blog.csdn.net/zhaixuebuluo/article/details/52860362