I am trying to compile the PCL tutorial described here and I am facing these linking errors.
Linking CXX executable pcl_visualizer usr/lib/libpq.so.5: undefined reference to
SSL_get_peer_certificate@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFReadDirectory@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toCRYPTO_num_locks@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFIsTiled@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference to
SSL_use_certificate_file@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toENGINE_free@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
OPENSSL_config@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_get_error@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_use_PrivateKey_file@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toX509_STORE_load_locations@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFDefaultStripSize@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFReadTile@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference to
SSL_set_ex_data@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFWriteScanline@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
_TIFFfree@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toSSL_read@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFGetField@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFScanlineSize@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference to
X509_STORE_set_flags@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSLv23_method@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
ENGINE_load_private_key@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toX509_get_subject_name@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
CRYPTO_set_id_callback@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFClose@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFClientOpen@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toSSL_CTX_new@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_CTX_get_cert_store@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_check_private_key@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFGetFieldDefaulted@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toENGINE_by_id@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFNumberOfDirectories@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toERR_get_error@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
CRYPTO_set_locking_callback@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_load_error_strings@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_new@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toX509_NAME_get_text_by_NID@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFOpen@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toSSL_write@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
X509_free@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_CTX_load_verify_locations@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFReadRGBAImage@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toSSL_free@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_ctrl@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFSetField@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference to
SSL_set_verify@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toENGINE_init@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_set_fd@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_connect@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
ERR_reason_error_string@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_CTX_ctrl@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference to
SSL_pending@OPENSSL_1.0.0' usr/lib/libpq.so.5: undefined reference toSSL_use_PrivateKey@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFSetWarningHandler@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toENGINE_finish@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFSetErrorHandler@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to_TIFFmalloc@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference to
SSL_library_init@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference toTIFFSetDirectory@LIBTIFF_4.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFReadScanline@LIBTIFF_4.0' usr/lib/libpq.so.5: undefined reference toSSL_shutdown@OPENSSL_1.0.0' usr/lib/libvtkIO.so.5.8.0: undefined reference to
TIFFNumberOfTiles@LIBTIFF_4.0' collect2: error: ld returned 1 exit status make[2]: * [pcl_visualizer] Error 1 make1: * [CMakeFiles/pcl_visualizer.dir/all] Error 2 make: *** [all] Error 2
The CmakeList file is define as follow:
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
project (pcl-visualizer)
find_package (Qt4 REQUIRED)
find_package (VTK REQUIRED)
find_package (PCL 1.7.1 REQUIRED)
include_directories (${PCL_INCLUDE_DIRS})
link_directories (${PCL_LIBRARY_DIRS})
add_definitions (${PCL_DEFINITIONS})
set (project_SOURCES main.cpp pclviewer.cpp)
set (project_HEADERS pclviewer.h)
set (project_FORMS pclviewer.ui)
set (VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid QVTK)
QT4_WRAP_CPP (project_HEADERS_MOC ${project_HEADERS})
QT4_WRAP_UI (project_FORMS_HEADERS ${project_FORMS})
INCLUDE (${QT_USE_FILE})
ADD_DEFINITIONS (${QT_DEFINITIONS})
ADD_EXECUTABLE (pcl_visualizer ${project_SOURCES}
${project_FORMS_HEADERS}
${project_HEADERS_MOC})
TARGET_LINK_LIBRARIES (pcl_visualizer ${QT_LIBRARIES} ${PCL_LIBRARIES} ${VTK_LIBRARIES})
Is there anything missing in the CMakeList file?
The PostgreSQL library you are linking to is missing openssl, you can check it with
ldd /usr/lib/libpq.so.5
it should report something like
libssl.so.1.0.0 => not found
The same with vtk, but it doesn't find a valid TIFF library.
First, check that you have both openssl and tiff libraries installed, if linking still fails, check if versions are correct.
Second, if all libraries are installed, check if are from the correct architecture (all 32-bit or all 64-bit).
Third, manually force your project to load libraries flags (both from command line CMAKE_MODULE_LINKER_FLAGS
/ CMAKE_SHARED_LINKER_FLAGS
or in the target_link_libraries
directive).