Build error for SDL2-2.0.5 on Ubuntu 16.04
uranus@uranus:~/lib/SDL2-2.0.5$ make
/bin/bash build-scripts/updaterev.sh
LTLINK build/libSDL2.la
build/.libs/SDL_mirvideo.o: In function 'MIR_InitDisplayFromOutput':
/home/uranus/lib/SDL2-2.0.5/src/video/mir/SDL_mirvideo.c:258: undefined reference to 'mir_output_get_current_mode'
collect2: error: ld returned 1 exit status
Makefile:147: recipe for target 'build/libSDL2.la' failed
make: *** [build/libSDL2.la] Error 1
SDL2 Configuration Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math : mmx 3dnow sse sse2
Audio drivers : disk dummy oss alsa(dynamic) pulse(dynamic) sndio
Video drivers : dummy x11(dynamic) opengl opengl_es2 mir(dynamic)
X11 libraries : xcursor xdbe xinerama xinput2 xinput2_multitouch xrandr xscrnsaver xshape xvidmode
Input drivers : linuxev linuxkd
Using libudev : YES
Using dbus : YES
Using ime : YES
Using ibus : NO
Using fcitx : NO
source to share
The linker requires the name of the library where this function resides.
I fixed it by adding "-lmirclient" to the Makefile.
# diff Makefile Makefile-ORG
26c26
< EXTRA_LDFLAGS = -Wl,--no-undefined -lm -ldl -lasound -lm -ldl -lpthread -lsndio -lX11 -lXext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lpthread -lrt -lmirclient
---
> EXTRA_LDFLAGS = -Wl,--no-undefined -lm -ldl -lasound -lm -ldl -lpthread -lsndio -lX11 -lXext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lpthread -lrt
#
source to share
I had the same problem and I could not solve but I was using SDL2.0.3 and I did not face any problems and it worked and compiled with me You can install it here https://sourceforge.net/ projects / libsdl / files / SDL / 2.0.3 /
source to share
A quick fix is ββto set a static link to the mir library when running configure:
./configure --enable-mir-shared=no
This causes the variable to EXTRA_LDFLAGS
have a parameter -lmirclient
appended to it, as per Juan's answer.
For what the problem is, see bug 3539 , which was resolved in patch shortly after.
Looking at the patch shows the missing definition required to dynamically bind to the "mir_output_get_current_mode" function mentioned in the error message.
source to share