FLTK 1.3 Linking errors - c++

I update my FLTK from 1.1 to 1.3, then I can't compile my code which is worked well before update.
...
[100%] Building CXX object CMakeFiles/PROSTVIEW.dir/include/nifti/vtkznzlib.cxx.o
Linking CXX executable PROSTVIEW
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fontopen(char const*, int, bool, int)':
fl_font.cxx:(.text+0x298): undefined reference to `FcPatternCreate'
fl_font.cxx:(.text+0x362): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x3e3): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x3f7): undefined reference to `FcPatternAddInteger'
fl_font.cxx:(.text+0x40b): undefined reference to `FcPatternAddInteger'
fl_font.cxx:(.text+0x424): undefined reference to `FcPatternAddDouble'
fl_font.cxx:(.text+0x43c): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x4df): undefined reference to `FcMatrixRotate'
fl_font.cxx:(.text+0x4f7): undefined reference to `FcPatternAddMatrix'
fl_font.cxx:(.text+0x516): undefined reference to `FcPatternAddBool'
fl_font.cxx:(.text+0x52c): undefined reference to `FcPatternAddBool'
fl_font.cxx:(.text+0x549): undefined reference to `XftFontMatch'
fl_font.cxx:(.text+0x5a0): undefined reference to `XftFontOpen'
fl_font.cxx:(.text+0x5b0): undefined reference to `FcPatternDestroy'
fl_font.cxx:(.text+0x5f3): undefined reference to `XftFontOpenPattern'
fl_font.cxx:(.text+0x603): undefined reference to `FcPatternDestroy'
fl_font.cxx:(.text+0x659): undefined reference to `XftFontOpenXlfd'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `utf8extents(Fl_Font_Descriptor*, char const*, int, _XGlyphInfo*)':
fl_font.cxx:(.text+0x84b): undefined reference to `XftTextExtents32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_xft_width(Fl_Font_Descriptor*, unsigned int*, int)':
fl_font.cxx:(.text+0x98a): undefined reference to `XftTextExtents32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_destroy_xft_draw(unsigned long)':
fl_font.cxx:(.text+0x102e): undefined reference to `XftDrawChange'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x10c6): undefined reference to `XftDrawCreate'
fl_font.cxx:(.text+0x10f6): undefined reference to `XftDrawChange'
fl_font.cxx:(.text+0x1140): undefined reference to `XftDrawSetClip'
fl_font.cxx:(.text+0x1202): undefined reference to `XftDrawString32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_drawUCS4(Fl_Graphics_Driver*, unsigned int const*, int, int, int)':
fl_font.cxx:(.text+0x1313): undefined reference to `XftDrawCreate'
fl_font.cxx:(.text+0x1343): undefined reference to `XftDrawChange'
fl_font.cxx:(.text+0x138d): undefined reference to `XftDrawSetClip'
fl_font.cxx:(.text+0x1433): undefined reference to `XftDrawString32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::rtl_draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x1480): undefined reference to `FcUtf8Len'
fl_font.cxx:(.text+0x14ff): undefined reference to `FcUtf8ToUcs4'
collect2: ld returned 1 exit status
make[2]: *** [PROSTVIEW] Error 1
make[1]: *** [CMakeFiles/PROSTVIEW.dir/all] Error 2
make: *** [all] Error 2
Here's my CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
PROJECT(PROSTVIEW)
SET(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_CXX__FLAGS -O3 -pipe -ffast-math -Wno-deprecated)
# Chargement Package
# FLTK
FIND_PACKAGE ( FLTK )
IF ( FLTK_FOUND )
INCLUDE_DIRECTORIES( ${FLTK_INCLUDE_DIR} )
ENDIF ( FLTK_FOUND )
# ITK
FIND_PACKAGE ( ITK )
IF ( ITK_FOUND )
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )
# VTK
FIND_PACKAGE ( VTK )
IF ( VTK_FOUND )
INCLUDE( ${USE_VTK_FILE} )
ENDIF( VTK_FOUND )
SET(VTK_LIBRARIES vtkCommon vtkRendering vtkWidgets vtkGraphics vtkGenericFiltering vtkzlib)
# vtkFlRenderWindowInteractor
SET(VTKFL_INCLUDE_DIR "include/vtkfl")
SET(VTKFL_CPP
${VTKFL_INCLUDE_DIR}/vtkFlRenderWindowInteractor.cxx)
# Auxiliary_Tools
SET(AT_DIR "include/Auxiliary_Tools")
SET(AT_INCLUDE_DIR ${AT_DIR}/include)
SET(AT_LIBRARY_DIR ${AT_DIR}/lib)
#Nifty
SET(NII_DIR "include/nifti")
SET(NII_SRC
${NII_DIR}/vtkNIfTIReader.cxx
${NII_DIR}/vtkNIfTIWriter.cxx
${NII_DIR}/vtkAnalyzeReader.cxx
${NII_DIR}/vtkAnalyzeWriter.cxx
${NII_DIR}/vtknifti1_io.cxx
${NII_DIR}/vtkznzlib.cxx)
#Other include
SET(PROSTVIEW_INCLUDE_DIR "include")
SET(PROSTVIEW_SRC
${PROSTVIEW_INCLUDE_DIR}/ContourTmt.cpp
${PROSTVIEW_INCLUDE_DIR}/conversion.cpp
${PROSTVIEW_INCLUDE_DIR}/TmtMatrix.cpp)
# VOLUME Widget
SET(VOLUME_WIDGET_DIR "include/GUI")
SET(VOLUME_WIDGET
${VOLUME_WIDGET_DIR}/VOLUME_Loader.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Mouse_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_3DView.cpp
${VOLUME_WIDGET_DIR}/CONTOUR_Loader.cpp
${VOLUME_WIDGET_DIR}/ProstView.cpp)
# MODULES
SET(MODULE_DIR "Module")
# SEGMENTATION
SET(SEGMENTATION_DIR "Module/Segmentation")
SET(SEGMENTATION
${SEGMENTATION_DIR}/DDC2D.cpp
${SEGMENTATION_DIR}/DDC3D.cpp
${SEGMENTATION_DIR}/DDC3DHu.cpp
${SEGMENTATION_DIR}/DDC3DPlus.cpp
${SEGMENTATION_DIR}/DDC3DBal.cpp
${SEGMENTATION_DIR}/IMAGE_ENERGY.cpp
${SEGMENTATION_DIR}/REGULARIZATION.cpp
${SEGMENTATION_DIR}/OPTIMAL_SURFACE_DETECTION.cpp
${SEGMENTATION_DIR}/OPTIMAL_MULTIPLE_SURFACES_DETECTION.cpp
${SEGMENTATION_DIR}/RESAMPLE_From_Prostate.cpp
${SEGMENTATION_DIR}/RECTAL_WALL_US.cpp
${SEGMENTATION_DIR}/BLADDER_MRI.cpp
${SEGMENTATION_DIR}/RECTUM_MRI.cpp
${SEGMENTATION_DIR}/REGION_GROWING.tpp )
#MESH
SET(MESH_DIR "Module/Mesh")
SET(MESH
${MESH_DIR}/GENERIC_MESH.cpp
${MESH_DIR}/ELLIPSOID_MESH.cpp
${MESH_DIR}/PROSTATE_MESH.cpp
${MESH_DIR}/TUBULAR_MESH.cpp
${MESH_DIR}/OPEN_MESH.cpp
${MESH_DIR}/QUADRIC_MESH.cpp
${MESH_DIR}/ELLIPTICAL_CYLINDER_MESH.cpp
${MESH_DIR}/CONTOURS_MAN_MESH.cpp)
#STUDY
SET(STUDY_DIR "Module/Statistics")
SET(STUDY
${STUDY_DIR}/PROFILE.cpp
${STUDY_DIR}/Histogram.cpp
${STUDY_DIR}/HISTOGRAM_FROM_MESH.cpp
${STUDY_DIR}/TRAINING_SET_ALIGNMENT.cpp
${STUDY_DIR}/APPEARANCE_MODEL.cpp)
# MOMENTS
SET(MOMENTS_DIR "Module/Moments")
SET(MOMENTS
${MOMENTS_DIR}/KRAWTCHOUK_Moments.tpp
${MOMENTS_DIR}/TCHEBICHEF_Moments.tpp
${MOMENTS_DIR}/GEOMETRIC_Moments.tpp)
#VALIDATION
SET(VALIDATION_DIR "Module/Evaluation")
SET(VALIDATION
${VALIDATION_DIR}/Metrics.cpp)
# Include et Link Directories
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} ${VTKFL_INCLUDE_DIR} ${AT_INCLUDE_DIR} ${NII_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
LINK_DIRECTORIES(${FLTK_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} ${AT_LIBRARY_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
# Sources
SET(SRC main.cpp)
# Executables and "stand-alone " librairies
ADD_EXECUTABLE(PROSTVIEW ${SRC} ${PROSTVIEW_SRC} ${VTKFL_CPP} ${VOLUME_WIDGET} ${SEGMENTATION} ${MESH} ${STUDY} ${MOMENTS} ${VALIDATION} ${NII_SRC})
# Linkage
TARGET_LINK_LIBRARIES(PROSTVIEW ${FLTK_LIBRARIES} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
I tried to add some libs in my CMakeLists.txt, but it's not work. Who can tell me what’s the problem?

From FLTK 1.3's README.CMake.txt:
USING CMAKE WITH FLTK
This howto assumes that you have FLTK libraries which were built using
CMake, installed. Building them with CMake generates some CMake
helper files which are installed in standard locations, making FLTK
easy to find and use.
Here is a basic CMakeLists.txt file using FLTK.
cmake_minimum_required(VERSION 2.6)
project(hello)
find_package(FLTK REQUIRED NO_MODULE) include(${FLTK_USE_FILE})
add_executable(hello WIN32 hello.cxx)
target_link_libraries(hello fltk)
The find_package command tells CMake to find the package FLTK,
REQUIRED means that it is an error if it's not found. NO_MODULE tells
it to search only for the FLTKConfig file, not using the
FindFLTK.cmake supplied with CMake, which doesn't work with this
version of FLTK.
Once the package is found we include the ${FLTK_USE_FILE} which adds
the FLTK include directories and library link information to its
knowledge base. After that your programs will be able to find FLTK
headers and when you link the fltk library, it automatically links the
libraries fltk depends on.
It seems that from FLTK 1.1 to 1.3 they changed the method needed to find the library, maybe for comparability/testing reasons?
I got hung up on the same issue, hope someone finds this useful. :)

Related

How to use cmake to compile a project written in C and C++ with dpdk

I am using dpdk-stable-19.11.3, and the NIC is Mellaonx Connect5-X. The project's main function is written in C++, but all other functions it calls are written in C. I use cmake to manage my project. I packed all C code to a static library. Without dpdk, it's fine. After adding dpdk, the CMakeLists.txt seems missing some libs. It compiled successfully. But when running the executable file, it returns "open file error". Then I added libs rte_pmd_mlx5 and ibverbs. The errors occur when running command make.
➜ build git:(master) ✗ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hewen/demo/build
[ 83%] Built target mylib
[ 91%] Linking CXX executable demo
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dv_open_device':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:830: undefined reference to `mlx5dv_open_device'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_port_query':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:1030: undefined reference to `mlx5dv_query_devx_port'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_qp_query':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:1012: undefined reference to `mlx5dv_devx_qp_query'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_umem_dereg':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:999: undefined reference to `mlx5dv_devx_umem_dereg'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_umem_reg':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:984: undefined reference to `mlx5dv_devx_umem_reg'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_get_async_cmd_comp':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:969: undefined reference to `mlx5dv_devx_get_async_cmd_comp'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_obj_query_async':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:950: undefined reference to `mlx5dv_devx_obj_query_async'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_destroy_cmd_comp':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:937: undefined reference to `mlx5dv_devx_destroy_cmd_comp'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_create_cmd_comp':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:925: undefined reference to `mlx5dv_devx_create_cmd_comp'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_general_cmd':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:910: undefined reference to `mlx5dv_devx_general_cmd'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_obj_modify':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:893: undefined reference to `mlx5dv_devx_obj_modify'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_obj_query':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:876: undefined reference to `mlx5dv_devx_obj_query'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_obj_destroy':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:863: undefined reference to `mlx5dv_devx_obj_destroy'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_devx_obj_create':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:847: undefined reference to `mlx5dv_devx_obj_create'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dv_destroy_flow_matcher':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:815: undefined reference to `mlx5dv_dr_matcher_destroy'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dv_destroy_flow':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:804: undefined reference to `mlx5dv_dr_rule_destroy'
...
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:517: undefined reference to `mlx5dv_create_wq'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dv_create_cq':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:502: undefined reference to `mlx5dv_create_cq'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_destroy_domain':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:489: undefined reference to `mlx5dv_dr_domain_destroy'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_domain':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:476: undefined reference to `mlx5dv_dr_domain_create'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_destroy_flow_tbl':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:463: undefined reference to `mlx5dv_dr_table_destroy'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_tbl':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:450: undefined reference to `mlx5dv_dr_table_create'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_action_pop_vlan':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:439: undefined reference to `mlx5dv_dr_action_create_pop_vlan'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_action_push_vlan':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:426: undefined reference to `mlx5dv_dr_action_create_push_vlan'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_action_drop':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:414: undefined reference to `mlx5dv_dr_action_create_drop'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_action_dest_port':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:397: undefined reference to `mlx5dv_dr_action_create_dest_ib_port'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_dr_create_flow_action_dest_flow_tbl':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:385: undefined reference to `mlx5dv_dr_action_create_dest_table'
/home/hewen/dpdk-stable-19.11.3/x86_64-native-linuxapp-gcc/lib/librte_pmd_mlx5.a(mlx5_glue.o): In function `mlx5_glue_destroy_flow_action':
/home/hewen/dpdk-stable-19.11.3/drivers/net/mlx5/mlx5_glue.c:190: undefined reference to `mlx5dv_dr_action_destroy'
collect2: error: ld returned 1 exit status
CMakeFiles/demo.dir/build.make:95: recipe for target 'demo' failed
make[2]: *** [demo] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/demo.dir/all' failed
Is there any libs I missed? This is my CMakeLists.txt.
cmake_minimum_required(VERSION 3.10)
project(myPJ LANGUAGES C CXX)
find_package(Threads REQUIRED)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_FLAGS "-msse4.2")
option(DEBUG "add complie options for gdb" ON)
set(RTE_SDK /home/hewen/dpdk-stable-19.11.3)
set(RTE_TARGET x86_64-native-linuxapp-gcc)
include_directories(${RTE_SDK}/${RTE_TARGET}/include)
link_directories(${RTE_SDK}/${RTE_TARGET}/lib)
include_directories(./tools)
link_directories("./tools/")
add_definitions(-pthread)
if(DEBUG)
add_compile_options(-g -O0)
endif()
add_definitions(-DBUCKET_CLEANER)
add_definitions(-DCOLLECT_STATS -DTABLE_COLLECT_STATS -DLOG_COLLECT_STATS)
add_definitions(-DVERBOSE)
add_library(mylib STATIC a.c b.c c.c d.c)
add_executable(demo main.cpp)
target_link_libraries(demo PRIVATE mylib)
target_link_libraries(demo PRIVATE libxxhash.so)
target_link_libraries(demo PRIVATE Threads::Threads)
target_link_libraries(demo PRIVATE
-Wl,--whole-archive
rte_ethdev
rte_eal
rte_mempool
rte_pmd_mlx5
ibverbs
rte_pmd_e1000
rte_pmd_i40e
rte_pmd_ixgbe
rte_pmd_virtio
rte_pmd_vmxnet3_uio
rte_hash
rte_kvargs
rte_bus_pci
rte_pci
rte_bus_vdev
rte_mbuf
rte_ring
rte_net
pthread
dl
-Wl,--no-whole-archive
numa
rt
pcap
m
)
If using custom Makefile or CMakeLists.txt, one has to ensure the following
DPDK is built with appropriate MXL5 PMD
For DPDK Makefile is used, libraries added to build path are
EXTRA_CFLAGS=-I/path/to/rdma-core/build/include
EXTRA_LDFLAGS=-L/path/to/rdma-core/build/lib
PKG_CONFIG_PATH=/path/to/rdma-core/build/lib/pkgconfig
Cross check and verify example code like l2fwd and skeleton works.
note: as mentioned in the comment it is useful to check
https://doc.dpdk.org/guides/nics/mlx5.html
check the build flags for example/l2fwde in build folder too.
[EDIT-1] as per the update in comment, the problem is resolved by including mxl5 library to CMakeLists.txt.

Installing GTest and GMock

I have installed GTest and GMock on my Ubuntu 17.04 box. Broadly speaking installed as follows;
sudo apt-get install libgtest-dev
cmake CMakeLists.txt
make
I then sym linked the libraries creaetd in /usr/src in /usr/lib. (ie link in /usr/lib points to /usr/src)
I then did the same for GMock
sudo apt-get install -y google-mock
then cmake and make as above
Libraries sym linked as before.
I have created the following CMakeLists.txt
project(chapterFirstExample)
cmake_minimum_required(VERSION 2.6)
include_directories(/usr/include)
link_directories(/usr/lib)
add_definitions(-std=c++0x)
set(CMAKE_CXX_FLAGS "${CMAXE_CXX_FLAGS} -Wall")
set(sources
main.cpp
SoundexTest.cpp)
add_executable(tddTest ${sources})
target_link_libraries(tddTest pthread)
target_link_libraries(tddTest gmock)
target_link_libraries(tddTest gtest)
And have two source files
main.cpp
#include "gmock/gmock.h"
int main(int argc, char** argv) {
testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
SoundexTest.cpp
class Soundex
{
};
#include "gmock/gmock.h"
TEST(SoundexEncoding, RetainsSoleLetterOfOneLetterWord)
{
Soundex soundex;
}
(I am working through Jeff Langr's Modern C++ Programming with Test Driven Development book)
I run cmake on my CmakeLists.txt file, which runs without error. When I run make though I get this;
[ 33%] Linking CXX executable tddTest
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::~ThreadLocal()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x24): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x39): undefined reference to `pthread_key_delete'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::~ThreadLocal()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x24): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x39): undefined reference to `pthread_key_delete'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x25): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x88): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv]+0x27): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv]+0x27): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::GetOrCreateValue() const':
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x25): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x88): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gmock-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::CreateKey()':
gmock-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEE9CreateKeyEv]+0x27): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gmock-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::GetOrCreateValue() const':
gmock-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv]+0x25): undefined reference to `pthread_getspecific'
gmock-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv]+0x88): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgmock.a(gmock-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::~ThreadLocal()':
gmock-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEED5Ev]+0x24): undefined reference to `pthread_getspecific'
gmock-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEED5Ev]+0x39): undefined reference to `pthread_key_delete'
collect2: error: ld returned 1 exit status
CMakeFiles/tddTest.dir/build.make:120: recipe for target 'tddTest' failed
make[2]: *** [tddTest] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/tddTest.dir/all' failed
make[1]: *** [CMakeFiles/tddTest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I am new to cmake, and very rusty on make. This output though makes me feel thought that I have not built GTest or GMock correctly. Can anyone give some pointers please. (No pun intended)
Thanks
The order of libraries passed to the linker matters. When the linker sees a library file name, by default (*) it pulls in just the objects from that library which resolve one or more undefined symbols it knows are needed at that point.
So if a library A depends on a library B but you pass main.o -lB -lA to the linker, when it comes to -lB it will pull in some objects from B if they are needed by main.o, but then if A needs additional symbols from B, it will not go back and look for additional objects from B, so those needed symbols remain unresolved.
gmock depends on gtest, and gmock (and maybe gtest?) depend on pthread, so a better order for your libraries would be:
target_link_libraries(tddTest gtest)
target_link_libraries(tddTest gmock)
target_link_libraries(tddTest pthread)
(*) Some GNU ld linker options cause different behavior. In particular, --whole-archive -lsomething --no-whole-archive will force it to get ALL the contents from a library file, needed or not. --start-group -lA -lB -lC --end-group will cause it to repeatedly loop over a set of libraries until none of them can be used to resolve any more symbols for a whole loop. But most of the time, it's enough to just list the libraries you need so that the libraries that use other libraries come earlier in the list.

Failure to link Qhull C++ interface in ROS catkin project

I'm having some trouble getting the QHull C++ interface working in a catkin project. My project compiles fine and I've specified the library to be used by the linker, however it fails to link with the following error messages.
CMakeFiles/path_to/my_code.cpp.o: In function `main':
my_code.cpp:(.text+0x17ab): undefined reference to `orgQhull::RboxPoints::RboxPoints()'
my_code.cpp:(.text+0x182a): undefined reference to `orgQhull::PointCoordinates::appendPoints(std::istream&)'
my_code.cpp:(.text+0x1839): undefined reference to `orgQhull::Qhull::Qhull()'
my_code.cpp:(.text+0x1857): undefined reference to `orgQhull::Qhull::runQhull(orgQhull::RboxPoints const&, char const*)'
my_code.cpp:(.text+0x18aa): undefined reference to `orgQhull::Qhull::outputQhull(char const*)'
my_code.cpp:(.text+0x19d0): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x19ee): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
my_code.cpp:(.text+0x1c10): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x1c38): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
CMakeFiles/build_path/my_code.cpp.o: In function `orgQhull::Qhull::setOutputStream(std::ostream*)':
I've installed the following packages, to get the shared object and development files.
libqhull-dev
libqhull-doc
libqhull7
qhull-bin
I don't know if this is related to the problem, but looking into the libqhull.so shared object there are no symbols in it.
####:/usr/lib/x86_64-linux-gnu$ nm -g libqhull.so
nm: libqhull.so: no symbols
Has anyone got any experience getting this to work on linux? Any help would be appreciated.
I'm using ROS Indigo, this works for me:
SET(qhullDir path_to_qhull_code)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(${qhullDir}/src)
LINK_DIRECTORIES(${qhullDir}/build)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(include)
SET(qhullLibs qhullcpp qhull_r)
add_library(${PROJECT_NAME}_library
src/myClass.cpp)
add_executable(libExample
src/myrunnable.cpp)
target_link_libraries(libExample
${PROJECT_NAME}_library ${qhullLibs})
SET_TARGET_PROPERTIES(libExample PROPERTIES
COMPILE_DEFINITIONS "qh_QHpointer")
I'm compiling qhull from source with cmake.
Maybe this helps someone.

Bundling opencv as a static library gives thousands of undefined references

I have a library that I am trying to link with openCV (and I think I did successfully) into one big dynamic library. I then try and add an executable and link everything together to test the library and I get 2000-3000 errors each saying
In function `________________`: undefined reference to `________`
some examples are:
/path/to/libs/libopencv_features2d.a(matchers.cpp.o): In function `cv::FlannBasedMatcher::read(cv::FileNode const&)':
matchers.cpp:(.text._ZN2cv17FlannBasedMatcher4readERKNS_8FileNodeE+0x227): undefined reference to `cv::flann::IndexParams::setAlgorithm(int)'
/path/to/libs/libopencv_videoio.a(cap_gstreamer.cpp.o)` In function `CvCapture_GStreamer::getProperty(int) const':
cap_gstreamer.cpp:(.text._ZNK19CvCapture_GStreamer11getPropertyEi+0x8b): undefined reference to `gst_element_query_position'
/path/to/lib/libopencv_core.a(stat.cpp.o): In function `cv::norm(cv::_InputArray const&, int, cv::_InputArray const&)':
stat.cpp:(.text._ZN2cv4normERKNS_11_InputArrayEiS2_+0x1d27): undefined reference to `ippicviNorm_L1_32f_C1MR'
stat.cpp:(.text._ZN2cv4normERKNS_11_InputArrayEiS2_+0x1dab): undefined reference to `ippicviNorm_L1_8u_C1MR'
My cmake file which runs:
project(SDK-build)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(MYLIB_SRC
file1.cpp
file2.cpp
file3.cpp
)
add_library(gesture SHARED ${MYLIB_SRC})
cmake_policy(SET CMP0015 NEW)
link_directories(./opencvlib-wgstreamer)
set(OPENCV_LIBS
libopencv_calib3d.a
libopencv_core.a
libopencv_features2d.a
libopencv_highgui.a
libopencv_imgcodecs.a
libopencv_imgproc.a
libopencv_ml.a
libopencv_objdetect.a
libopencv_photo.a
libopencv_video.a
libopencv_videoio.a
)
set(TEST_SRC
test.cpp
)
add_executable(gesture_test ${TEST_SRC})
#build library
#target_link_libraries(gesture -Wl,-whole-archive ${OPENCV_LIBS} -Wl,--no-whole-archive)
#build library with executable
target_link_libraries(gesture_test gesture -Wl,-whole-archive ${OPENCV_LIBS} -Wl,--no-whole-archive)
When I use the first target_link_libraries, everything builds and make has no problem executing, but linking with the file with main() causes the massive confusion. Any suggestions I've been banging my head over this for hours. I also tried several combinations of compiling opencv, using both WITH_IPP=ON, WITH_IPP=OFF, and WITH_GSTREAMER_ON
You have to specify the libraries in the correct order.
See here for more information.
Edit I see you are using -Wl-whole-archive which I believe is an other possible way to fix the problem, so maybe I'm wrong

Cmake ld error while compiling

Hello i am trying to compile a program with cmake. but when ever i run make install. its gives this error. I have never worked with Cmake before so its all new to me. plz help me.
libstructure.so: undefined reference to `AptamerTree::~AptamerTree()'
libparserfastq.so: undefined reference to `ParserMain::ProcessLaneInParallel(std::string, std::string, std::string, std::string, std::string, int)'
libstructure.so: undefined reference to `AptamerTree::GetRoot()'
libparserfastq.so: undefined reference to `ParserMain::ParserMain(Parameters*, std::vector<AptamerPool*, std::allocator<AptamerPool*> >*, _win_st*)'
libparserfastq.so: undefined reference to `ParserMain::StoreStatistics()'
libparserfastq.so: undefined reference to `ParserMain::IsGZipped(std::string)'
libparserfastq.so: undefined reference to `ParserMain::StoreConsensusSizes()'
libparserfastq.so: undefined reference to `ParserMain::ProcessLaneInParallel(std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, int, int, int)'
libparserfastq.so: undefined reference to `ParserMain::~ParserMain()'
libstructure.so: undefined reference to `AptamerTree::AptamerTree()'
libstructure.so: undefined reference to `AptamerTree::InsertEdge(Node*, Node*)'
libparserfastq.so: undefined reference to `ParserMain::SetStatus(std::string, int, int)'
libparserfastq.so: undefined reference to `ParserMain::StoreQualities()'
libstructure.so: undefined reference to `AptamerTree::begin()'
libparserfastq.so: undefined reference to `ParserMain::StoreFrequencies()'
libparserfastq.so: undefined reference to `ParserMain::StoreRandomizedRegionSizes()'
libstructure.so: undefined reference to `AptamerTree::end()'
libstructure.so: undefined reference to `AptamerTree::CreateNode()'
libparserfastq.so: undefined reference to `ParserMain::LogStatistics()'
collect2: error: ld returned 1 exit status
make[2]: *** [src/htsaptamotiftest] Error 1
make[1]: *** [src/CMakeFiles/htsaptamotiftest.dir/all] Error 2
make: *** [all] Error 2
Here is the Cmakelist.txt
#this is just a basic CMakeLists.txt, for more information see the cmake manpage
MESSAGE("CONFIGURING HTSAptamotif")
# set variables required for build
get_filename_component(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR} PATH)
SET(INSTALL_PATH ${CMAKE_INSTALL_PREFIX})
SET(EXTERNAL_INCLUDE_PATH ${INSTALL_PATH}/include/)
SET(EXTERNAL_LIB_PATH ${INSTALL_PATH}/lib/)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${INSTALL_PATH}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${INSTALL_PATH}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${INSTALL_PATH}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
# we need openMP
INCLUDE(FindOpenMP)
IF(OPENMP_FOUND)
MESSAGE(" FOUND OPENMP")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ENDIF()
#and ncurses
FIND_LIBRARY(NCURSRS_PANEL_LIBRARY NAMES panel DOC "The ncureses panel library")
INCLUDE(FindCurses)
IF(CURSES_FOUND)
MESSAGE(" FOUND CURSES")
# add panels to the library path
SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSRS_PANEL_LIBRARY})
ENDIF()
#add definitions, compiler switches, etc.
#-g is with debugging info. disable this for production code
#-lprofiler uses google cpu profiler. disable for production
# debugging flags
ADD_DEFINITIONS(-Wall -lmysqlcppconn -std=gnu++0x -ltcmalloc -lncurses -lpanel -O2 -g -lprofiler )
# productions flags
# ADD_DEFINITIONS(-Wall -lmysqlcppconn -std=gnu++0x -ltcmalloc -lncurses -lpanel -O2)
#OLD ADD_DEFINITIONS(-Wall -lncurses -lpanel -lmysqlcppconn -std=gnu++0x -O2 -g -ltcmalloc -lprofiler)
#ADD_DEFINITIONS(-Wno-sign-compare)
# define include and link directories
INCLUDE_DIRECTORIES(
${EXTERNAL_INCLUDE_PATH}
# /usr/local/google-perftools/1.8.2/include
)
LINK_DIRECTORIES(
${EXTERNAL_LIB_PATH}
# /usr/local/google-perftools/1.8.2/lib
)
#Define non-header libs here
MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
SET(MySQL_LIBRARIES
${EXTERNAL_LIB_PATH}libmysqlcppconn.so
)
MESSAGE(" MySQL_LIBRARIES: ${MySQL_LIBRARIES}")
SET(ViennaRNA_LIBRARIES
${EXTERNAL_LIB_PATH}libRNA.a
)
MESSAGE(" ViennaRNA_LIBRARIES: ${ViennaRNA_LIBRARIES}")
SET(GPTOOLS_LIBRARIES
${EXTERNAL_LIB_PATH}libprofiler.so
${EXTERNAL_LIB_PATH}libtcmalloc.so
)
MESSAGE(" GooglePrefTools_LIBRARIES: ${GPTOOLS_LIBRARIES}")
MESSAGE(" Curses_LIBRARIES: ${CURSES_LIBRARIES}")
#build the shared libraries
ADD_LIBRARY(htsaptamotif SHARED htsaptamotif.cpp)
ADD_LIBRARY(parameters SHARED parameters.cpp)
ADD_LIBRARY(aptamer SHARED aptamer.cpp)
ADD_LIBRARY(aptamertree SHARED aptamertree.cpp)
ADD_LIBRARY(databasesocket SHARED databasesocket.cpp)
ADD_LIBRARY(aptamerpool SHARED aptamerpool.cpp)
ADD_LIBRARY(structure SHARED structure.cpp)
ADD_LIBRARY(substructure SHARED substructure.cpp)
ADD_LIBRARY(substructureensemble SHARED substructureensemble.cpp)
# ADD_LIBRARY(aptagraph SHARED aptagraph.cpp) #templates
ADD_LIBRARY(numericalintegrator SHARED numericalintegrator.cpp)
# ADD_LIBRARY(mstprims SHARED mstprims.cpp) #templates
ADD_LIBRARY(aptamotif SHARED aptamotif.cpp)
ADD_LIBRARY(poolgenerator SHARED poolgenerator.cpp)
ADD_LIBRARY(lshcluster SHARED lshcluster.cpp)
ADD_LIBRARY(dnacompressor SHARED dnacompressor.cpp)
ADD_LIBRARY(aptamercluster SHARED aptamercluster.cpp)
ADD_LIBRARY(parsermain SHARED parsermain.cpp)
ADD_LIBRARY(parserfastq SHARED parserfastq.cpp)
ADD_LIBRARY(parserfasta SHARED parserfasta.cpp)
ADD_LIBRARY(parsertext SHARED parsertext.cpp)
#external alignment library
ADD_LIBRARY(nwaligner SHARED ssw.c)
ADD_LIBRARY(nwalignerwrapper SHARED ssw_cpp.cpp)
#for testing the shared library you probably need some test app too
ADD_EXECUTABLE(htsaptamotiftest htsaptamotiftest.cpp)
#need to link to some other libraries ? just add them here
TARGET_LINK_LIBRARIES(parameters ${Boost_LIBRARIES} ${GPTOOLS_LIBRARIES} ${CURSES_LIBRARIES})
TARGET_LINK_LIBRARIES(databasesocket ${MySQL_LIBRARIES})
TARGET_LINK_LIBRARIES(aptamer ${ViennaRNA_LIBRARIES})
TARGET_LINK_LIBRARIES(htsaptamotiftest htsaptamotif parameters databasesocket aptamerpool aptamer aptamertree aptamotif structure substructure substructureensemble numericalintegrator poolgenerator parsermain parserfastq parserfasta parsertext lshcluster dnacompressor aptamercluster nwaligner nwalignerwrapper ${GPTOOLS_LIBRARIES} ${CURSES_LIBRARIES}) #aptagraph mstprims are templates
# compile the socket program for gui comunication
ADD_EXECUTABLE(guisocket guisocket.cpp)
TARGET_LINK_LIBRARIES(guisocket ${Boost_LIBRARIES} parameters)
#add and install target here
INSTALL(TARGETS htsaptamotiftest htsaptamotif parameters databasesocket aptamerpool aptamer aptamertree structure substructure substructureensemble numericalintegrator aptamotif poolgenerator parsermain parserfastq parsertext parserfasta lshcluster dnacompressor aptamercluster nwaligner nwalignerwrapper guisocket
RUNTIME DESTINATION ${INSTALL_PATH}/bin
LIBRARY DESTINATION ${INSTALL_PATH}/lib
ARCHIVE DESTINATION ${INSTALL_PATH}/lib
)
any idea's how to solve this problem?
You need to link all yout binaries with all libraries they use. Your libstructure and libparserfastq are most likely not linked with libraries containing symbols mentioned in the errors. You need to add appropriate TARGET_LINK_LIBRARIES commands for those libraries.