SuSE 9.1 vs. VMware (vmware-config-tools.pl vs. kstrdup )
I’m testing out SuSE 9.1 on VMware 4.5.2 on top of Windows XP.
VMware comes with the ‘vmware-tools’ package, which enhances performance and usability when running SuSE or any flavor of Linux under VMware.
Unfortunately, vmware-tools fails to build with the following error:
# ./vmware-config-tools.pl
(… snip …)
make[1]: Entering directory `/usr/src/linux-2.6.1-111′
/tmp/vmware-config/vmhgfs-only/cpName.o
/tmp/vmware-config/vmhgfs-only/cpNameLinux.o
/tmp/vmware-config/vmhgfs-only/dev.o
/tmp/vmware-config/vmhgfs-only/dev.c:20:
/tmp/vmware-config/vmhgfs-only/main.h:184: error: conflicting types for ‘kstrdup’
include/linux/slab.h:121: error: previous declaration of `kstrdup’
make[2]: *** [/tmp/vmware-config/vmhgfs-only/dev.o] Error 1
make[1]: *** [_module_/tmp/vmware-config4/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.1-111′
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/vmware-config/vmhgfs-only’
Unable to build the vmhgfs module.
EWW! GROSS!
This is because the function ‘kstrdup’ in the vmware-tools source (in the vmhgfs module) is conflicting with the function ‘kstrdup’ in the Linux kernel source, in mm/slab.c , drivers/md/dm-ioctl.c , and a few other places.
To work around this error, you need to modify the vmware-tools source a little bit.
- Find the file vmhgfs.tar and untar it:
cd modules/source
cp vmhgfs.tar vmhgfs.tar.old
tar xvf vmhgfs.tar
cd vmhgfs-only
- in main.c main.h and driver.c , replace the string ‘kstrdup’ with something unique, like ‘vmkstrdup’.
Then tar it back up, remove your old temprary files and re-run the tool again:
cd ..
tar cf vmhgfs.tar vmhgfs-only
rm -rf vmhgfs-only
Rerun vmware-config-tools.pl and it should work!
Leave a Reply