Skip to content
Javier Cardona edited this page Mar 6, 2012 · 2 revisions

Installing libnl on qemu

You will need libnl installed correctly on your guest in order to run iw, wpa_supplicant, etc. What worked for me:

  1. Install gcc'' and ''make on your guest

Halt qemu and then:


mount -t ext3 /dev/loop0 /mnt/qemu-rootfs/
chroot /mnt/qemu-rootfs/ /bin/bash
apt-get install gcc make
  1. Build libnl on your host

git clone git://git.kernel.org/pub/scm/libs/netlink/libnl.git
cd libnl; ./configure; make
  1. Install on your guest

Lunch qemu, cd /path/to/mounted/libnl/dir


./configure --prefix=/usr
make install

Hmmm... apparently this needs to recompile a bunch of files and is taking a long time. Well, this is a one time step so we can live with it.

Troubleshooting

  1. Seems to be a bug in libnl... If you get nl_sock redefinition errors,

In file included from /usr/include/netlink/handlers.h:19,
                 from /usr/include/netlink/netlink.h:32,
                 from /usr/include/netlink/genl/genl.h:15,
                 from netlink.h:21,
                 from main.c:18:
/usr/include/netlink/netlink-kernel.h:9: error: redefinition of ‘struct sockaddr_nl’
/usr/include/netlink/netlink-kernel.h:33: error: redefinition of ‘struct nlmsghdr’
/usr/include/netlink/netlink-kernel.h:173: error: redefinition of ‘struct nlmsgerr’
/usr/include/netlink/netlink-kernel.h:182: error: redefinition of ‘struct nl_pktinfo’
/usr/include/netlink/netlink-kernel.h:229: error: redefinition of ‘struct nlattr’

this is how to fix:


sudo echo "#include " > /usr/include/netlink/netlink-kernel.h
Clone this wiki locally