From: Tonghao Zhang > On Tue, Mar 3, 2020 at 3:15 PM Matan Azrad <ma...@mellanox.com> wrote: > > > > > > Hi > > > > From: xiangxia.m....@gmail.com > > > From: Tonghao Zhang <xiangxia.m....@gmail.com> > > > > > > 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: sta...@dpdk.org > > > > > > Signed-off-by: Tonghao Zhang <xiangxia.m....@gmail.com> > > > Tested-by: Ali Alnubani <alia...@mellanox.com> > > > > The title should point to the root cause - not to the results. > > > > Something like: > > > > common/mlx5: fix dynamic loading reference > > > > > drivers/common/mlx5/mlx5_common.c | 5 +++-- > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/common/mlx5/mlx5_common.c > > > b/drivers/common/mlx5/mlx5_common.c > > > index 610fb48..570a3f4 100644 > > > --- a/drivers/common/mlx5/mlx5_common.c > > > +++ b/drivers/common/mlx5/mlx5_common.c > > > @@ -209,8 +209,6 @@ enum mlx5_class > > > */ > > > RTE_INIT_PRIO(mlx5_glue_init, CLASS) { > > > - void *handle = NULL; > > > - > > > /* Initialize common log type. */ > > > mlx5_common_logtype = rte_log_register("pmd.common.mlx5"); > > > if (mlx5_common_logtype >= 0) > > > @@ -249,6 +247,7 @@ enum mlx5_class > > > mlx5_glue_path(glue_path, sizeof(glue_path)) : ""), > > > }; > > > unsigned int i = 0; > > > + void *handle = NULL; > > > void **sym; > > > const char *dlmsg; > > > > > > @@ -320,8 +319,10 @@ enum mlx5_class > > > mlx5_glue->fork_init(); > > > return; > > > glue_error: > > > +#ifdef RTE_IBVERBS_LINK_DLOPEN > > > if (handle) > > > dlclose(handle); > > > +#endif > > > > > > What's about " #include <dlfcn.h> " Is it compiled for you? > Yes, still building fail. > > If so, why dlclose is not known on your setup? > When I fixed it, I found the codes in mlx5_glue_init, use the > RTE_IBVERBS_LINK_DLOPEN. > but dlclose is not included in it. I think we should add > RTE_IBVERBS_LINK_DLOPEN to fix the building fail.
I agree, but looks like the include should be in the define area too. No? > > > > > > > DRV_LOG(WARNING, "Cannot initialize MLX5 common due to > > > missing" > > > " run-time dependency on rdma-core libraries (libibverbs," > > > " libmlx5)"); > > > -- > > > 1.8.3.1 > > > > > -- > Thanks, > Tonghao