Compilation of VirtualBox add-ins for Ubuntu 9.10

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.

6 thoughts on “Compilation of VirtualBox add-ins for Ubuntu 9.10

  1. thank you mloskot.. this is great to catch..
    (I filed a bug report on FireWire handling, just so you know.. :-)

  2. 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)
    

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>