When setting the CONFIG_RTE_BUILD_SHARED_LIB to y,
and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include
relative codes.
mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to `dlclose'
Fixes:
7b4f1e6bd367 ("common/mlx5: introduce common library")
Cc: stable@dpdk.org
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Tested-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
* Copyright 2019 Mellanox Technologies, Ltd
*/
* Copyright 2019 Mellanox Technologies, Ltd
*/
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
*/
RTE_INIT_PRIO(mlx5_glue_init, CLASS)
{
*/
RTE_INIT_PRIO(mlx5_glue_init, CLASS)
{
/* Initialize common log type. */
mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
if (mlx5_common_logtype >= 0)
/* Initialize common log type. */
mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
if (mlx5_common_logtype >= 0)
/* The glue initialization was done earlier by mlx5 common library. */
#ifdef RTE_IBVERBS_LINK_DLOPEN
char glue_path[sizeof(RTE_EAL_PMD_PATH) - 1 + sizeof("-glue")];
/* The glue initialization was done earlier by mlx5 common library. */
#ifdef RTE_IBVERBS_LINK_DLOPEN
char glue_path[sizeof(RTE_EAL_PMD_PATH) - 1 + sizeof("-glue")];
const char *path[] = {
/*
* A basic security check is necessary before trusting
const char *path[] = {
/*
* A basic security check is necessary before trusting
mlx5_glue->fork_init();
return;
glue_error:
mlx5_glue->fork_init();
return;
glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
if (handle)
dlclose(handle);
if (handle)
dlclose(handle);
DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
" run-time dependency on rdma-core libraries (libibverbs,"
" libmlx5)");
DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
" run-time dependency on rdma-core libraries (libibverbs,"
" libmlx5)");
* mlx4 driver initialization.
*/
* mlx4 driver initialization.
*/
#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC