error "fatal error: linux/smp_lock.h: No such file or directory" during installation of VMWare tools on Ubuntu 12.04.2

I have Ubuntu 12.04.2 LTS installed on a VMware machine on Windows 7 host. I seem to have a problem with Kernel headers when trying to install them

I did:

sudo apt-get install gcc make build-essential linux-headers-$(uname -r)

and got this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version.
build-essential is already the newest version.
linux-headers-3.5.0-28-generic is already the newest version.
make is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.

However, when installing VMware tools I get the following error:

make[1]: Entering directory `/usr/src/linux-headers-3.5.0-28-generic'
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoor.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoorGcc32.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/bdhandler.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpName.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLinux.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLite.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dentry.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dir.o
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/file.o
/tmp/vmware-root/modules/vmhgfs-only/file.c:122:4: warning: initialization from incompatible pointer type [enabled by default]
/tmp/vmware-root/modules/vmhgfs-only/file.c:122:4: warning: (near initialization for ‘HgfsFileFileOperations.fsync’) [enabled by default]
  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/filesystem.o
/tmp/vmware-root/modules/vmhgfs-only/filesystem.c:48:28: fatal error: linux/smp_lock.h: No such file or directory
compilation terminated.
make[2]: *** [/tmp/vmware-root/modules/vmhgfs-only/filesystem.o] Error 1
make[1]: *** [_module_/tmp/vmware-root/modules/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-28-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/vmware-root/modules/vmhgfs-only'

Any help appreciated!


Solution 1:

A voice from the future: I am compiling 5.9.0rc5. The source tree is exactly what came off linux.org. My platform: Ubuntu 20.04.1 (upgraded from 18.04.5 a week ago. No VmWare, just a pristinekernel tarball, and yet:

DKMS make.log for virtualbox-guest-6.1.10 for kernel 5.9.0-rc5 (x86_64)
Wed 16 Sep 2020 01:35:06 AM EDT
  CC [M]  /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest-linux.o
  CC [M]  /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest.o
  CC [M]  /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/common/string/strformatrt.o
  CC [M]  /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/combined-agnostic.o
In file included from /var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/VBoxGuest-linux.c:36:
/var/lib/dkms/virtualbox-guest/6.1.10/build/vboxguest/r0drv/linux/the-linux-kernel.h:141:11: fatal error: linux/smp_lock.h: No such file or directory
  141 | # include <linux/smp_lock.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.

The error is in TWO places;

/usr/src/virtualbox-guest-6.1.10/vboxsf/r0drv/linux
/usr/src/virtualbox-guest-6.1.10/vboxguest/r0drv/linux

Find the old, forgotten lineS, surround with #if 0 and #endif, run make install in the kernel source directory and be done. I put the changes into revision control, etc. but these steps are not vital.

Oh, the Copyright is Oracle now, updated to 2020, but the code is pure 2003.