I’ve been using the upcoming Ubuntu 9.10 installed as a guest system on VirtualBox for a while without any big problems. After one of big updates I found that currently under development 2.6.31 kernel version was installed. So, I decided to rebuild VirtualBox Guest Additions and it failed. Digging the logs helped me to find out what was the problem:
/home/mloskot/tmp/vbox/linux/module/vboxvfs/utils.c:423: error: implicit declaration of function utf8_mbtowc
Should be simple to fix. However, it seems that signatures of nls.h functions in the kernel have changed or have been moved to new place which I have no idea about. I’m not a kernel developer but I like to dig codes. Thus, I unpacked the VirtualBox installer, found the victim – utils.c and applied a very ugly fix:
extern int utf8_mbtowc(wchar_t*, const __u8*, int); extern int utf8_wctomb(__u8*, wchar_t, int);
At least, it allowed me to compile and install the VirtualBox additions. I haven’t notice any run-time issues. I have reported this problem back to the VirtualBox as its code may need to be updated: #4823 (Missing declaration of utf8_mbtowc function in utils.c). So far, so good.
thank you mloskot.. this is great to catch..
(I filed a bug report on FireWire handling, just so you know.. :-)
You’re welcome!
For those who do not want to upgrade to vbox 3.x but have kernel 2.6.31:
the patch above simply disables vboxvfs (virtual folders for guest):
modules remains unloaded because of unknown symbol.
But your blog entry made it easy to find the solution.
In my case, virtualbox-2.2.4 this patch works:
--- a/vboxvfs/utils.c 2009-09-07 17:20:13.000000000 +0200 +++ b/vboxvfs/utils.c 2009-09-07 17:25:36.000000000 +0200 @@ -25,6 +25,11 @@ #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 31) +int utf8_mbtowc(wchar_t*pu, const __u8*s, int len){return utf8_to_utf32(s,len,(unicode_t *)pu);} +int utf8_wctomb(__u8*s, wchar_t u, int maxlen){return utf32_to_utf8((unicode_t)u,s,maxlen);} +#endif + /* #define USE_VMALLOC */ #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)@spblinux I’m glad it is helpful. Thanks for the comment and improved patch.
Thanks so much for posting this. I’d tripped over exactly this issue and never would have figured it out myself.
Hi David,
You are welcome. I’m glad you’ve found it helpful.