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

在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,做好库备份,有兴趣的可以去实验一下。

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宅学部落-王利涛

just for test

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值