docs/README-linux.md
author Ryan C. Gordon <icculus@icculus.org>
Wed, 31 Oct 2018 15:03:41 -0400
changeset 12381 dc9108cd4340
parent 11476 b1718d4980ba
child 12391 ca6e41ade79a
permissions -rw-r--r--
Merge SDL-ryan-batching-renderer branch to default.
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@10500
    22
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
icculus@11194
    23
fcitx-libs-dev libsamplerate0-dev libsndio-dev
slouken@10486
    24
icculus@11365
    25
Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
slouken@11476
    26
to that command line for Wayland support.
slouken@10486
    27
slouken@10486
    28
Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
slouken@10486
    29
line for Mir support.
slouken@10486
    30
slouken@10486
    31
NOTES:
slouken@10486
    32
- This includes all the audio targets except arts, because Ubuntu pulled the 
slouken@10486
    33
  artsc0-dev package, but in theory SDL still supports it.
icculus@10788
    34
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
icculus@10788
    35
  for higher-quality audio resampling. SDL will work without it if the library
icculus@10788
    36
  is missing, so it's safe to build in support even if the end user doesn't
icculus@10788
    37
  have this library installed.
slouken@10486
    38
- DirectFB isn't included because the configure script (currently) fails to find
slouken@10486
    39
  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
slouken@10486
    40
  configure script to include DirectFB support. Send patches.  :)
slouken@10486
    41
slouken@10486
    42
slouken@10486
    43
================================================================================
slouken@10486
    44
Joystick does not work
slouken@10486
    45
================================================================================
slouken@10486
    46
slouken@10486
    47
If you compiled or are using a version of SDL with udev support (and you should!)
slouken@10486
    48
there's a few issues that may cause SDL to fail to detect your joystick. To
slouken@10486
    49
debug this, start by installing the evtest utility. On Ubuntu/Debian:
slouken@10486
    50
slouken@10486
    51
    sudo apt-get install evtest
slouken@10486
    52
    
slouken@10486
    53
Then run:
slouken@10486
    54
    
slouken@10486
    55
    sudo evtest
slouken@10486
    56
    
slouken@10486
    57
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
slouken@10486
    58
Now run:
slouken@10486
    59
    
slouken@10486
    60
    cat /dev/input/event/XX
slouken@10486
    61
slouken@10486
    62
If you get a permission error, you need to set a udev rule to change the mode of
slouken@10486
    63
your device (see below)    
slouken@10486
    64
    
slouken@10486
    65
Also, try:
slouken@10486
    66
    
slouken@10486
    67
    sudo udevadm info --query=all --name=input/eventXX
slouken@10486
    68
    
slouken@10486
    69
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
slouken@10486
    70
you need to set up an udev rule to force this variable.
slouken@10486
    71
slouken@10486
    72
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
slouken@10486
    73
like:
slouken@10486
    74
    
slouken@10486
    75
   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    76
   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    77
   
slouken@10486
    78
You can set up similar rules for your device by changing the values listed in
slouken@10486
    79
idProduct and idVendor. To obtain these values, try:
slouken@10486
    80
    
slouken@10486
    81
    sudo udevadm info -a --name=input/eventXX | grep idVendor
slouken@10486
    82
    sudo udevadm info -a --name=input/eventXX | grep idProduct
slouken@10486
    83
    
slouken@10486
    84
If multiple values come up for each of these, the one you want is the first one of each.    
slouken@10486
    85
slouken@10486
    86
On other systems which ship with an older udev (such as CentOS), you may need
slouken@10486
    87
to set up a rule such as:
slouken@10486
    88
    
slouken@10486
    89
    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    90