docs/README-linux.md
author Sam Lantinga <slouken@libsdl.org>
Thu, 23 May 2019 14:19:00 -0700
changeset 12756 4116bf232fe7
parent 12391 ca6e41ade79a
permissions -rw-r--r--
Added a function to get the current Android SDK version at runtime
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
NOTES:
slouken@10486
    29
- This includes all the audio targets except arts, because Ubuntu pulled the 
slouken@10486
    30
  artsc0-dev package, but in theory SDL still supports it.
icculus@10788
    31
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
icculus@10788
    32
  for higher-quality audio resampling. SDL will work without it if the library
icculus@10788
    33
  is missing, so it's safe to build in support even if the end user doesn't
icculus@10788
    34
  have this library installed.
slouken@10486
    35
- DirectFB isn't included because the configure script (currently) fails to find
slouken@10486
    36
  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
slouken@10486
    37
  configure script to include DirectFB support. Send patches.  :)
slouken@10486
    38
slouken@10486
    39
slouken@10486
    40
================================================================================
slouken@10486
    41
Joystick does not work
slouken@10486
    42
================================================================================
slouken@10486
    43
slouken@10486
    44
If you compiled or are using a version of SDL with udev support (and you should!)
slouken@10486
    45
there's a few issues that may cause SDL to fail to detect your joystick. To
slouken@10486
    46
debug this, start by installing the evtest utility. On Ubuntu/Debian:
slouken@10486
    47
slouken@10486
    48
    sudo apt-get install evtest
slouken@10486
    49
    
slouken@10486
    50
Then run:
slouken@10486
    51
    
slouken@10486
    52
    sudo evtest
slouken@10486
    53
    
slouken@10486
    54
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
slouken@10486
    55
Now run:
slouken@10486
    56
    
slouken@10486
    57
    cat /dev/input/event/XX
slouken@10486
    58
slouken@10486
    59
If you get a permission error, you need to set a udev rule to change the mode of
slouken@10486
    60
your device (see below)    
slouken@10486
    61
    
slouken@10486
    62
Also, try:
slouken@10486
    63
    
slouken@10486
    64
    sudo udevadm info --query=all --name=input/eventXX
slouken@10486
    65
    
slouken@10486
    66
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
slouken@10486
    67
you need to set up an udev rule to force this variable.
slouken@10486
    68
slouken@10486
    69
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
slouken@10486
    70
like:
slouken@10486
    71
    
slouken@10486
    72
   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    73
   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    74
   
slouken@10486
    75
You can set up similar rules for your device by changing the values listed in
slouken@10486
    76
idProduct and idVendor. To obtain these values, try:
slouken@10486
    77
    
slouken@10486
    78
    sudo udevadm info -a --name=input/eventXX | grep idVendor
slouken@10486
    79
    sudo udevadm info -a --name=input/eventXX | grep idProduct
slouken@10486
    80
    
slouken@10486
    81
If multiple values come up for each of these, the one you want is the first one of each.    
slouken@10486
    82
slouken@10486
    83
On other systems which ship with an older udev (such as CentOS), you may need
slouken@10486
    84
to set up a rule such as:
slouken@10486
    85
    
slouken@10486
    86
    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
slouken@10486
    87