[CMake] CMake with CPack - unresolved libraries

Marcin Czenko marcin.czenko at sioux.eu
Mon Oct 25 09:49:19 EDT 2010


Hello everybody.

I need your help to solve the following problem.

The installed version of CMake is:  2.8.0.
The installed version of CPack is: 2.8.0.
I am running on Ubuntu LTS 10.04.

I have a CMake project. The output of the project is an executable. The 
executable depends on a number of shared
libraries:

=====================================================================
 > ldd UserCockpit-Application

linux-gate.so.1 =>  (0x00cdb000)
libimage_transport.so => 
/opt/ros/cturtle/stacks/image_common/image_transport/lib/libimage_transport.so 
(0x001ec000)
libpoco_lite.so => 
/opt/ros/cturtle/stacks/common/pluginlib/lib/libpoco_lite.so (0x009e2000)
libboost_fs_wrapper.so => 
/opt/ros/cturtle/stacks/common/pluginlib/lib/libboost_fs_wrapper.so 
(0x00f53000)
libtinyxml.so => /opt/ros/cturtle/stacks/common/tinyxml/libtinyxml.so 
(0x00c12000)
libmessage_filters.so => 
/opt/ros/cturtle/ros/core/message_filters/lib/libmessage_filters.so 
(0x00bc3000)
libsensor_msgs.so => 
/opt/ros/cturtle/stacks/common_msgs/sensor_msgs/lib/libsensor_msgs.so 
(0x00c91000)
librosrecorder.so => 
/opt/ros/cturtle/ros/tools/rosrecord/lib/librosrecorder.so (0x00afc000)
librosbag.so => /opt/ros/cturtle/ros/tools/rosbag/lib/librosbag.so 
(0x00269000)
libtopic_tools.so => 
/opt/ros/cturtle/ros/tools/topic_tools/lib/libtopic_tools.so (0x00d80000)
libros.so => /opt/ros/cturtle/ros/core/roscpp/lib/libros.so (0x00391000)
libboost_signals.so.1.40.0 => /usr/lib/libboost_signals.so.1.40.0 
(0x00c40000)
libXmlRpc.so => /opt/ros/cturtle/ros/3rdparty/xmlrpcpp/lib/libXmlRpc.so 
(0x00615000)
librosconsole.so => 
/opt/ros/cturtle/ros/core/rosconsole/lib/librosconsole.so (0x0018a000)
libboost_thread.so.1.40.0 => /usr/lib/libboost_thread.so.1.40.0 (0x004f0000)
liblog4cxx.so.10 => /usr/lib/liblog4cxx.so.10 (0x00632000)
libroslib.so => /opt/ros/cturtle/ros/core/roslib/lib/libroslib.so 
(0x00110000)
librospack.so => /opt/ros/cturtle/ros/tools/rospack/lib/librospack.so 
(0x00f99000)
librosstack.so => /opt/ros/cturtle/ros/tools/rospack/lib/librosstack.so 
(0x0098a000)
libsqlite3.so.0 => 
/home/czenkom/TSR/3rdParty/sqlite/sqlite/lib/libsqlite3.so.0 (0x00505000)
libQtGui.so.4 => /opt/qtsdk-2010.04/qt/lib/libQtGui.so.4 (0x00fc7000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00121000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x0012a000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x007e8000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x007f2000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00143000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00173000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00868000)
libQtCore.so.4 => /opt/qtsdk-2010.04/qt/lib/libQtCore.so.4 (0x0eeb2000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00183000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00d88000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x001ad000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x004e5000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x00590000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x005a9000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x00e52000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x005ad000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x01aac000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0099c000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x095d1000)
libboost_system.so.1.40.0 => /usr/lib/libboost_system.so.1.40.0 (0x005d3000)
libboost_filesystem.so.1.40.0 => /usr/lib/libboost_filesystem.so.1.40.0 
(0x007d1000)
libboost_iostreams.so.1.40.0 => /usr/lib/libboost_iostreams.so.1.40.0 
(0x00bdf000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00603000)
libboost_regex.so.1.40.0 => /usr/lib/libboost_regex.so.1.40.0 (0x17a1c000)
libboost_program_options.so.1.40.0 => 
/usr/lib/libboost_program_options.so.1.40.0 (0x00a39000)
libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x009bb000)
libdb-4.8.so => /usr/lib/libdb-4.8.so (0x0c26a000)
libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00a81000)
libz.so.1 => /lib/libz.so.1 (0x00aac000)
libuuid.so.1 => /lib/libuuid.so.1 (0x005d8000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00ac1000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00b0d000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00b27000)
/lib/ld-linux.so.2 (0x005e6000)
libicudata.so.42 => /usr/lib/libicudata.so.42 (0xb6881000)
libicui18n.so.42 => /usr/lib/libicui18n.so.42 (0x0b17b000)
libicuuc.so.42 => /usr/lib/libicuuc.so.42 (0x039ad000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0x00b58000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00cbb000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x005dd000)
=====================================================================

Now I am trying to use CPack with CMake to make a deb package. Everythig 
works perfectly except one thing. When I run ldd on the executable that 
is included in the package I get the following output:

=====================================================================
 > ldd UserCockpit-Application
linux-gate.so.1 =>  (0x00dc5000)
libimage_transport.so => not found
libpoco_lite.so => not found
libboost_fs_wrapper.so => not found
libtinyxml.so => not found
libmessage_filters.so => not found
libsensor_msgs.so => not found
librosrecorder.so => not found
librosbag.so => not found
libtopic_tools.so => not found
libros.so => not found
libboost_signals.so.1.40.0 => /usr/lib/libboost_signals.so.1.40.0 
(0x00dea000)
libXmlRpc.so => not found
librosconsole.so => not found
libboost_thread.so.1.40.0 => /usr/lib/libboost_thread.so.1.40.0 (0x006ed000)
liblog4cxx.so.10 => /usr/lib/liblog4cxx.so.10 (0x00110000)
libroslib.so => not found
librospack.so => not found
librosstack.so => not found
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00983000)
libQtGui.so.4 => /opt/qtsdk-2010.04/qt/lib/libQtGui.so.4 (0x00dfe000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x0030a000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x005cb000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x0078d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00d10000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00cd8000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x002af000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00ac9000)
libQtCore.so.4 => /opt/qtsdk-2010.04/qt/lib/libQtCore.so.4 (0x00313000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x002bf000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x005e4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00bed000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x002c5000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x002ce000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x002e7000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x00797000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x006ae000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0085f000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x002eb000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x07c57000)
libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00702000)
libdb-4.8.so => /usr/lib/libdb-4.8.so (0x2029c000)
libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x0074b000)
libz.so.1 => /lib/libz.so.1 (0x006d4000)
libuuid.so.1 => /lib/libuuid.so.1 (0x005ba000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00955000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00a85000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00a06000)
/lib/ld-linux.so.2 (0x0072e000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0x00a37000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x005bf000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x005c3000)

===================================================================================

I do not understand why it is happening. I spent several hours on it 
without success. I appreciate your help.

Please find my top level CMakeLists.txt and the the one with the CPack 
INSTALL statements:

============================ TOP LEVEL CMakeLists.txt 
======================================
cmake_minimum_required(VERSION 2.4.6)
project(UserCockpit)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

find_package(Qt4 REQUIRED)

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

include_directories(
     "../Common"
     "../Common/Library"
)

add_subdirectory(../Common/TsrGui "${CMAKE_CURRENT_BINARY_DIR}/TsrGui")
add_subdirectory(../Common/Library "${CMAKE_CURRENT_BINARY_DIR}/Library")
add_subdirectory(Application)


IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set(CMAKE_INSTALL_PREFIX /usr/local)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

include(InstallRequiredSystemLibraries)

set(CPACK_GENERATOR DEB)
SET(CPACK_SET_DESTDIR "ON")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "UserCockpit Application")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER tsr at sioux.eu)
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Readme.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_FILE_NAME 
UserCockpit-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-ubuntu-10.04_LTS)

set(CPACK_DEBIAN_PACKAGE_DEPENDS
         "libstdc++6 (>= 4.4.3-4ubuntu5),
          libqtgui4 (>= 4:4.6.2-0ubuntu5),
          libqtcore4 (>= 4:4.6.2-0ubuntu5),
          libsqlite3-0 (>= 3.6.22-1),
          libglib2.0-0 (>= 2.24.1-0ubuntu1),
          libsm6 (>= 2:1.1.1-1),
          libice6 (>= 2:1.0.6-1),
          libxrender1 (>= 1:0.9.5-1),
          libfreetype6 (>= 2.3.11-1ubuntu2.2),
          libfontconfig1 (>= 2.8.0-2ubuntu1),
          libxext6 (>= 2:1.1.1-2),
          libx11-6 (>= 2:1.3.2-1ubuntu3),
          libc6-i686 (>= 2.11.1-0ubuntu7.2),
          libgcc1 (>= 1:4.4.3-4ubuntu5)"
)

include(CPack)

============================================================= END 
=======================================

======================================= Application CMakeLists.txt 
==============================================
include(${QT_USE_FILE})

set(application_SRCS
     main.cpp
     RoseStartup.cpp
     RoseMain.cpp
     LedController.cpp
     Led.cpp
     CamController.cpp
     SpeechVolumeController.cpp
)

SET(application_UIS
     Forms/RoseStartup.ui
     Forms/RoseMain.ui
)

SET(application_MOC_HDRS
     RoseStartup.h
     RoseMain.h
     Led.h
)

SET(application_RESOURCES
     UserCockpit.qrc
)

include_directories(
    ${QT_INCLUDE_DIR}
)

# After this call, foo_MOC_SRCS =
#    moc_Class1.cxx moc_Class2.cxx moc_Class3.cxx.
QT4_WRAP_CPP(application_MOC_SRCS ${application_MOC_HDRS})

QT4_WRAP_UI(application_UIS_H ${application_UIS})

QT4_ADD_RESOURCES(application_RESOURCES_RCC ${application_RESOURCES})

# Don't forget to include output directory, otherwise
# the UI file won't be wrapped!
include_directories(${CMAKE_CURRENT_BINARY_DIR})

#Now add these generated files to the ADD_EXECUTABLE
# step. If this is NOT done, then the ui_*.h files
# will not be generated
rosbuild_add_executable(UserCockpit-Application
     ${application_SRCS}
     ${application_MOC_SRCS}
     ${application_UIS_H}
     ${application_RESOURCES_RCC}
)

target_link_libraries(UserCockpit-Application
    ${QT_LIBRARIES}
    ApplicationServices
    AlsaServices
    TsrGui
    SQLiteWrapper
    sqlite3
    asound
)

INSTALL(TARGETS UserCockpit-Application
     RUNTIME DESTINATION ${PROJECT_NAME}/bin
)

INSTALL(FILES ${PROJECT_SOURCE_DIR}/Resources/tsr.sqlite
     ${CMAKE_CURRENT_SOURCE_DIR}/Resources/rose-icon.png
     DESTINATION ${PROJECT_NAME}/Resources
)

INSTALL(FILES ${PROJECT_SOURCE_DIR}/Launchers/UserCockpit.launch
     DESTINATION ${PROJECT_NAME}/Launchers
)

INSTALL(FILES ${PROJECT_SOURCE_DIR}/Launchers/UserCockpit.sh
     DESTINATION ${PROJECT_NAME}/bin
     PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
                 GROUP_EXECUTE GROUP_READ
                 WORLD_READ WORLD_EXECUTE
)

INSTALL(FILES ${PROJECT_SOURCE_DIR}/mainpage.dox
     ${PROJECT_SOURCE_DIR}/manifest.xml
     ${PROJECT_SOURCE_DIR}/Resources/ROS_NOBUILD
     DESTINATION ${PROJECT_NAME}
)

INSTALL(FILES ${PROJECT_SOURCE_DIR}/Resources/UserCockpit.desktop
     DESTINATION ${PROJECT_NAME}/Resources
     PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
                 GROUP_EXECUTE GROUP_READ
                 WORLD_READ WORLD_EXECUTE
)
==================================================== END 
============================================




More information about the CMake mailing list