運行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,做好庫備份,有興趣的可以去實驗一下。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章