dpdk库链接问题

dpdk library Linking issue

默认安装使用Meson的dpdk,Ninja将提供libdpdk.pc.Please在Cmakefile dpdk版本20.11.2中提供链接dpdk库的建议。

cmake

    Checking for libdpdk
    Found libdpdk,version 20.11.2

制作错误信息:

In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:37:0,
from /usr/local/include/rte_vect.h:31,
from /usr/local/include/rte_memcpy.h:17,
from /home/sample.c:88, 

/usr/lib/gcc/x86_64-linux-gnu/5/include/tmmintrin.h:185:1: 错误:调用 always_inline ‘_mm_alignr_epi8’ 时内联失败:目标特定选项不匹配

libdpdk.pc

prefix=/usr/local
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name:DPDK
Requires:libdpdk-libs
Cflags:-I{includedir}

CMakeLists.txt

    find_package(PkgConfig REQUIRED)
    pkg_check_modules(DPDK REQUIRED libdpdk)
    include_directories(${DPDK_INCLUDE_DIR})
    include_directories(${CMAKE_SOURCE_DIR}/include)
    link_directories(${DPDK_LIBRARY_DIR})
set(DPDK_LIBS "-Wl,--whole-archive -l dpdk -Wl,--no-whole-archive")

    add_executable(sample sample.c)
   # target_include_directories(sample PUBLIC /usr/local/include)
    #target_include_directories(sample PUBLIC /usr/local/lib/x86_64-linux-gnu)
    target_link_libraries(sample PUBLIC ${DPDK_LIBS})

你或许应该使用

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3")

CMakeLists.txt.