docs/README-linux.md
author Sam Lantinga <slouken@libsdl.org>
Fri, 07 Oct 2016 17:46:58 -0700
changeset 10486 5bf595c48fd4
parent 10376 a18a3cd50984
child 10500 c3874aa1f2d1
permissions -rw-r--r--
Converted README documentation to DOS text format
slouken@10486
     1
Linux
slouken@10486
     2
================================================================================
slouken@10486
     3
slouken@10486
     4
By default SDL will only link against glibc, the rest of the features will be
slouken@10486
     5
enabled dynamically at runtime depending on the available features on the target
slouken@10486
     6
system. So, for example if you built SDL with Xinerama support and the target
slouken@10486
     7
system does not have the Xinerama libraries installed, it will be disabled
slouken@10486
     8
at runtime, and you won't get a missing library error, at least with the 
slouken@10486
     9
default configuration parameters.
slouken@10486
    10
slouken@10486
    11
slouken@10486
    12
================================================================================
slouken@10486
    13
Build Dependencies
slouken@10486
    14
================================================================================
slouken@10486
    15
    
slouken@10486
    16
Ubuntu 13.04, all available features enabled:
slouken@10486
    17
slouken@10486
    18
sudo apt-get install build-essential mercurial make cmake autoconf automake \
slouken@10486
    19
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
slouken@10486
    20
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
slouken@10486
    21
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
slouken@10486
    22
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev
slouken@10486
    23
slouken@10486
    24
Ubuntu 16.04 can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
slouken@10486
    25
to that command line for Wayland support.
slouken@10486
    26
slouken@10486
    27
Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
slouken@10486
    28
line for Mir support.
slouken@10486
    29
slouken@10486
    30
NOTES:
slouken@10486
    31
- This includes all the audio targets except arts, because Ubuntu pulled the 
slouken@10486
    32
  artsc0-dev package, but in theory SDL still supports it.
slouken@10486
    33
- DirectFB isn't included because the configure script (currently) fails to find
slouken@10486
    34
  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
slouken@10486
    35
  configure script to include DirectFB support. Send patches.  :)
slouken@10486
    36
slouken@10486
    37
slouken@10486
    38
================================================================================
slouken@10486
    39
Joystick does not work
slouken@10486
    40
================================================================================
slouken@10486
    41
slouken@10486
    42
If you compiled or are using a version of SDL with udev support (and you should!)
slouken@10486
    43
there's a few issues that may cause SDL to fail to detect your joystick. To
slouken@10486
    44
debug this, start by installing the evtest utility. On Ubuntu/Debian:
slouken@10486
    45
slouken@10486
    46
    sudo apt-get install evtest
slouken@10486
    47
    
slouken@10486
    48
Then run:
slouken@10486
    49
    
slouken@10486
    50
    sudo evtest
slouken@10486
    51
    
slouken@10486
    52
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
slouken@10486
    53
Now run:
slouken@10486
    54
    
slouken@10486
    55
    cat /dev/input/event/XX
slouken@10486
    56
slouken@10486
    57
If you get a permission error, you need to set a udev rule to change the mode of
slouken@10486
    58
your device (see below)    
slouken@10486
    59
    
slouken@10486
    60
Also, try:
slouken@10486
    61
    
slouken@10486
    62
    sudo udevadm info --query=all --name=input/eventXX
slouken@10486
    63
    
slouken@10486
    64
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
slouken@10486
    65
you need to set up an udev rule to force this variable.
slouken@10486
    66
slouken@10486
    67
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
slouken@10486
    68
like:
slouken@10486
    69
    
slouken@10486
    70
   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    71
   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    72
   
slouken@10486
    73
You can set up similar rules for your device by changing the values listed in
slouken@10486
    74
idProduct and idVendor. To obtain these values, try:
slouken@10486
    75
    
slouken@10486
    76
    sudo udevadm info -a --name=input/eventXX | grep idVendor
slouken@10486
    77
    sudo udevadm info -a --name=input/eventXX | grep idProduct
slouken@10486
    78
    
slouken@10486
    79
If multiple values come up for each of these, the one you want is the first one of each.    
slouken@10486
    80
slouken@10486
    81
On other systems which ship with an older udev (such as CentOS), you may need
slouken@10486
    82
to set up a rule such as:
slouken@10486
    83
    
slouken@10486
    84
    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    85