pip install pygame fails on Ubuntu 12.04

Issue #140 resolved
Jeffrey F created an issue

On Ubuntu 12.04, I am trying to install pygame in a virtual environment.

sudo aptitude install libsdl1.2-dev libsmpeg-dev libv4l-dev python-virtualenv
virtualenv env -p python2.7
. env/bin/activate
pip install pygame

However, this produces the compilation error:

src/camera.h:42:32: fatal error: linux/videodev.h: No such file or directory

Installing libv4l-dev produces a file at /usr/include/linux/videodev2.h, but linking /usr/include/linux/videodev.h to /usr/include/linux/videodev2.h produces other compilation errors:

src/camera_v4l.c: In function ‘v4l_open_device’:
src/camera_v4l.c:29:29: error: storage size of ‘cap’ isn’t known
src/camera_v4l.c:30:23: error: storage size of ‘buf’ isn’t known
src/camera_v4l.c:51:24: error: ‘VIDIOCGCAP’ undeclared (first use in this function)
src/camera_v4l.c:51:24: note: each undeclared identifier is reported only once for each function it appears in
src/camera_v4l.c:63:26: error: ‘VIDIOCGMBUF’ undeclared (first use in this function)

Comments (10)

  1. Jeffrey F reporter

    Sorry for the formatting, I expected the markup interpreter to work the same way as in GitHub.

  2. Mike Fletcher

    Ubuntu's packages for Pygame have 7 patches, including one that strips support for v4linux 1 (leaving v4linux 2). I expect the package will not build without those applied.

  3. Charles McLaughlin

    @jfinkels One way to get around this is to use Ubuntu's pygame package (apt-get install python-pygame), then use the --system-site-packages option when building your virtualenv.

  4. gdorn

    Another horrible hack which works on Mint 17.1 (derived from Ubuntu 14.something):

    cd /usr/include/linux 
    sudo ln -s ../libv4l1-videodev.h videodev.h
  5. Tariq Kamal

    Confirmed that @gdorn's hack works on Crunchbang Waldorf as well for 1.9.1release, so I suspect it'll work with Debian Wheezy, which is where I think my libv4l-dev package is from.

  6. Thomas Kluyver

    Pygame is compiling on Ubuntu without any patch for this now, and looking at camera.h it looks like v4l2 is supported now.

  7. Log in to comment