Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1 libdrumstick failed to build on Ubuntu Natty

open
nobody
None
5
2010-11-05
2010-11-05
quadrispro
No

Hi,

On Ubuntu 11.04 «Natty Narwhal» libdrumstick failed to build from source:

cd /build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu/utils/vpiano && /usr/bin/cmake -E cmake_link_script CMakeFiles/drumstick-vpiano.dir/link.txt --verbose=1
/usr/bin/c++ -g -O2 -fexceptions -UQT_NO_EXCEPTIONS -fvisibility=hidden -fvisibility-inlines-hidden -Wl,-Bsymbolic-functions -Wl,--as-needed -Wl,--as-needed CMakeFiles/drumstick-vpiano.dir/moc_pianoscene.cxx.o CMakeFiles/drumstick-vpiano.dir/moc_pianokeybd.cxx.o CMakeFiles/drumstick-vpiano.dir/moc_vpianoabout.cxx.o CMakeFiles/drumstick-vpiano.dir/moc_connections.cxx.o CMakeFiles/drumstick-vpiano.dir/moc_preferences.cxx.o CMakeFiles/drumstick-vpiano.dir/moc_vpiano.cxx.o CMakeFiles/drumstick-vpiano.dir/pianokey.cpp.o CMakeFiles/drumstick-vpiano.dir/pianoscene.cpp.o CMakeFiles/drumstick-vpiano.dir/pianokeybd.cpp.o CMakeFiles/drumstick-vpiano.dir/keylabel.cpp.o CMakeFiles/drumstick-vpiano.dir/rawkeybdapp.cpp.o CMakeFiles/drumstick-vpiano.dir/vpianoabout.cpp.o CMakeFiles/drumstick-vpiano.dir/connections.cpp.o CMakeFiles/drumstick-vpiano.dir/preferences.cpp.o CMakeFiles/drumstick-vpiano.dir/vpiano.cpp.o CMakeFiles/drumstick-vpiano.dir/vpianomain.cpp.o CMakeFiles/drumstick-vpiano.dir/qrc_pianokeybd.cxx.o -o ../../bin/drumstick-vpiano -rdynamic -L/build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu/lib -lQtSvg -lQtGui -lQtDBus -lQtXml -lQtCore -lQtSvg -lQtGui -lQtDBus -lQtXml -lQtCore -lasound ../../lib/libdrumstick-common.a ../../lib/libdrumstick-alsa.so.0.5.0 -lQtSvg -lQtGui -lQtDBus -lQtXml -lQtCore -lQtSvg -lQtGui -lQtDBus -lQtXml -lQtCore -lasound -Wl,-rpath,/build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu/lib:
/usr/bin/ld: CMakeFiles/drumstick-vpiano.dir/rawkeybdapp.cpp.o: undefined reference to symbol 'XCheckIfEvent'
/usr/bin/ld: note: 'XCheckIfEvent' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [bin/drumstick-vpiano] Error 1
make[3]: Leaving directory `/build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu'
make[2]: *** [utils/vpiano/CMakeFiles/drumstick-vpiano.dir/all] Error 2
make[2]: Leaving directory `/build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/build/buildd/libdrumstick-0.5.0/obj-i686-linux-gnu'
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2

I've applied the following patch to fix the build failure:

diff -Nru libdrumstick-0.5.0/debian/patches/missing_libs.patch libdrumstick-0.5.0/debian/patches/missing_libs.patch
--- libdrumstick-0.5.0/debian/patches/missing_libs.patch 1970-01-01 00:00:00.000000000 +0000
+++ libdrumstick-0.5.0/debian/patches/missing_libs.patch 2010-11-04 20:53:59.000000000 +0000
@@ -0,0 +1,15 @@
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- libdrumstick-0.5.0.orig/CMakeLists.txt
++++ libdrumstick-0.5.0/CMakeLists.txt
+@@ -83,7 +83,7 @@ IF(QT4_FOUND)
+ INCLUDE (${QT_USE_FILE})
+ INCLUDE_DIRECTORIES (${QT_INCLUDES})
+ LINK_DIRECTORIES (${QT_LIBRARY_DIR})
+- LINK_LIBRARIES (${QT_LIBRARIES})
++ LINK_LIBRARIES (${QT_LIBRARIES} -lX11)
+ ADD_DEFINITIONS (-DQT_STRICT_ITERATORS)
+ ELSE(QT4_FOUND)
+ MESSAGE(FATAL_ERROR "Qt4 not found")

Discussion

  • Thanks for testing, but the patch is wrong. If you add -lX11 to LINK_LIBRARIES in the main CMakeLists.txt, it will link every drumstick library and program to libX11, which is an overkill. The only program that needs to link directly to libX11 is drumstick-vpiano. In utils/vpiano/CMakeLists.txt this program has this link specification:

    TARGET_LINK_LIBRARIES(drumstick-vpiano
    ${QT_LIBRARIES}
    ${ALSA_LIBS}
    ${QT_X11_X11_LIBRARY}
    drumstick-common
    drumstick-alsa
    )

    The variable QT_X11_X11_LIBRARY should contain the X11 library name, added by CMake. Unless that cmake in Ubuntu has some problem, in this case probably other programs fail to build as well.

     
  • quadrispro
    quadrispro
    2010-11-06

    Thanks for your reply, I'll investigate further.