Skip to content
  • Sam Protsenko's avatar
    tests: Fix incorrect order of linker flags · b4c0354a
    Sam Protsenko authored
    
    
    Libraries flags (like -lglib-2.0) should be provided in the end of
    compile command. It's not how it's done right now in tests/Makefile.am,
    because _LDFLAGS is used where we should actually use _LDADD. Due to
    this, on Ubuntu 16.04 with GCC 5 we have next linking errors:
    
        gcc -lxcb-damage -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb
            -lxcb-xtest -lxcb -lxcb-shm -lxcb -lxcb-util -lxcb -lgtk-x11-2.0
            -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0
            -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0
            -lfontconfig -lfreetype -lspice-server -lglib-2.0 -lpixman-1
            -o x11spice_test tests.o x11spice_test.o xcb.o xdummy.o util.o
            main.o  -laudit
    
        tests.o: In function `check_binary':
        src/tests/tests.c:83: undefined reference to `g_log'
        src/tests/tests.c:84: undefined reference to `g_test_skip'
        tests.o: In function `test_common_start':
        src/tests/tests.c:46: undefined reference to `g_test_build_filename'
        src/tests/tests.c:56: undefined reference to `g_log'
        src/tests/tests.c:57: undefined reference to `g_test_fail'
        src/tests/tests.c:39: undefined reference to `g_test_skip'
        src/tests/tests.c:48: undefined reference to `g_log'
        src/tests/tests.c:49: undefined reference to `g_test_fail'
    
    Use _LDADD instead of _LDFLAGS for libs, so that libraries are
    specified in the end of compile line.
    
    Signed-off-by: default avatarSam Protsenko <joe.skb7@gmail.com>
    b4c0354a