Dear developers & friends,
I'm making an Orocos component (with Non-RTT feature) which uses the ZDB library ( a connection database pool : http://code.google.com/p/libzdb/
) and it's compile successfully but the linking process has problem with it. I write different tags on CMakeList.txt in order to be sure that the Linker has a reference of the installed library (zdb).
link_directories(/usr/local/lib) find_library(ZDB_LIB zdb) if ("${ZDB_LIB}" STREQUAL "ZDB_LIB-NOTFOUND") message(FATAL_ERROR "'zdb' wasn't found!") else() message("'zdb' found: " ${ZDB_LIB}) endif () ... orocos_use_package(${ZDB_LIB}) orocos_use_package(zdb) ... target_link_libraries(mysqlDB ${ZDB_LIB})
But it's appear something wrong, because the linker not found the referenced objects from the ZDB library. (and it's exists and has been compiled and linked in a generic C++ project [not orocos]).
mysqlDB-component.cpp:(.text+0x493): undefined reference to `URL_new(char const*)' mysqlDB-component.cpp:(.text+0x4a1): undefined reference to `ConnectionPool_new(URL_S*)' mysqlDB-component.cpp:(.text+0x4bb): undefined reference to `ConnectionPool_start(ConnectionPool_S*)'
Somebody knows if I need any different tag? I put VERBOSE=2 and the result has been:
antonio_castellon@WS-02:/orocos/projects/mysqlDB$ make Makefile:7: This Makefile builds this package with default settings mkdir -p build cd build ; cmake .. -DINSTALL_PATH=orocos && make Re-run cmake no build system arguments Orocos-RTT found in /orocos/install/lib/cmake/orocos-rtt/orocos-rtt-gnulinux-libraries.cmake -- Found orocos-rtt 2.4.0 for the gnulinux target. Available transports: corba mqueue -- - Found requested orocos-rtt components: rtt-marshalling rtt-scripting [UseOrocos] Building package mysqlDB 'zdb' found: /usr/local/lib/libzdb.so [UseOrocos] Linking all targets with libraries from package 'ocl-logging'. [UseOrocos] Linking all targets with libraries from package 'log4cpp'. -- checking for one of the modules '/usr/local/lib/libzdb.so;/usr/local/lib/libzdb.so-gnulinux' -- checking for one of the modules 'zdb;zdb-gnulinux' [UseOrocos] Building component mysqlDB in library mysqlDB-gnulinux [UseOrocos] Generating package version 1.0 (default version). -- Configuring done -- Generating done -- Build files have been written to: /orocos/projects/mysqlDB/build make[1]: Entering directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' /usr/bin/cmake -H/orocos/projects/mysqlDB -B/orocos/projects/mysqlDB/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /orocos/projects/mysqlDB/build/CMakeFiles /orocos/projects/mysqlDB/build/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[2]: Entering directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' make -f CMakeFiles/mysqlDB.dir/build.make CMakeFiles/mysqlDB.dir/depend make[3]: Entering directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' cd /orocos/projects/mysqlDB/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /orocos/projects/mysqlDB /orocos/projects/mysqlDB /orocos/projects/mysqlDB/build /orocos/projects/mysqlDB/build /orocos/projects/mysqlDB/build/CMakeFiles/mysqlDB.dir/DependInfo.cmake --color= make[3]: Leaving directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' make -f CMakeFiles/mysqlDB.dir/build.make CMakeFiles/mysqlDB.dir/build make[3]: Entering directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' Linking CXX shared library libmysqlDB-gnulinux.so /usr/bin/cmake -E cmake_link_script CMakeFiles/mysqlDB.dir/link.txt --verbose=2 /usr/bin/c++ -fPIC -Wl,-z,defs -shared -Wl,-soname,libmysqlDB-gnulinux.so -o libmysqlDB-gnulinux.so CMakeFiles/mysqlDB.dir/src/com/digital/services/mysqlDB-component.cpp.o CMakeFiles/mysqlDB.dir/src/com/digital/services/mysqlDB-macros.cpp.o -L/usr/local/lib /orocos/install/lib/liborocos-ocl-log4cpp-gnulinux.so /media/DATA/orocos-toolchain/install/lib/orocos/gnulinux/ocl/liborocos-ocl-logging-gnulinux.so /media/DATA/orocos-toolchain/install/lib/orocos/gnulinux/ocl/liborocos-ocl-log4cxx-gnulinux.so /orocos/install/lib/liborocos-rtt-gnulinux.so -lpthread -lrt /usr/local/lib/liblog4cpp.so -lnsl /orocos/install/lib/liborocos-rtt-gnulinux.so.2.4.0 /usr/local/lib/libzdb.so /orocos/install/lib/orocos/gnulinux/plugins/librtt-marshalling-gnulinux.so /orocos/install/lib/orocos/gnulinux/plugins/librtt-scripting-gnulinux.so -lboost_filesystem-mt -lboost_system-mt -lboost_serialization-mt -lpthread -lrt -ldl -Wl,-rpath,/usr/local/lib:/orocos/install/lib:/media/DATA/orocos-toolchain/install/lib/orocos/gnulinux/ocl:/orocos/install/lib/orocos/gnulinux/plugins:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CMakeFiles/mysqlDB.dir/src/com/digital/services/mysqlDB-component.cpp.o: In function `emperocd::services::mysqlDB::configureHook()': mysqlDB-component.cpp:(.text+0x493): undefined reference to `URL_new(char const*)' mysqlDB-component.cpp:(.text+0x4a1): undefined reference to `ConnectionPool_new(URL_S*)' mysqlDB-component.cpp:(.text+0x4bb): undefined reference to `ConnectionPool_start(ConnectionPool_S*)' collect2: ld returned 1 exit status make[3]: *** [libmysqlDB-gnulinux.so] Error 1 make[3]: Leaving directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' make[2]: *** [CMakeFiles/mysqlDB.dir/all] Error 2 make[2]: Leaving directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' make[1]: *** [all] Error 2 make[1]: Leaving directory `/media/DATA/orocos-toolchain.2.4.0/projects/mysqlDB/build' make: *** [all] Error 2