From 894fd42e7f533623eed4b6a8136a7079896b58ec Mon Sep 17 00:00:00 2001 From: Pascal Mazon Date: Tue, 15 Apr 2014 15:50:22 +0200 Subject: [PATCH] eal: do not try to load library from current directory When loading a library "libfoo.so" (depending on "libbar.so", located in an entirely different folder), with a LD_LIBRARY_PATH=/path/to/libfoo.so", it returns an error: EAL: ./libfoo.so: cannot open shared object file: No such file or directory If the first dlopen() fails (here, because it can't find all dependencies), the code requires for a second dlopen() that looks for "./libfoo.so". It turns on pathname matching, which does not use LD_LIBRARY_PATH. As a result, it fails because it cannot find "./libfoo.so". The error message matches the error of the second dlopen(), not the first's. Do not try to look for a different library ("./"-prefixed) than the one provided in argument. Let the dynamic library management handle it, just provide an appropriate LD_LIBRARY_PATH. Signed-off-by: Pascal Mazon Acked-by: Neil Horman --- lib/librte_eal/linuxapp/eal/eal.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 4f74eca253..04b2b3202e 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -1054,12 +1054,6 @@ rte_eal_init(int argc, char **argv) TAILQ_FOREACH(solib, &solib_list, next) { RTE_LOG(INFO, EAL, "open shared lib %s\n", solib->name); solib->lib_handle = dlopen(solib->name, RTLD_NOW); - if ((solib->lib_handle == NULL) && (solib->name[0] != '/')) { - /* relative path: try again with "./" prefix */ - char sopath[PATH_MAX]; - snprintf(sopath, sizeof(sopath), "./%s", solib->name); - solib->lib_handle = dlopen(sopath, RTLD_NOW); - } if (solib->lib_handle == NULL) RTE_LOG(WARNING, EAL, "%s\n", dlerror()); } -- 2.20.1