* [PATCH] eal: do not try to load library with a local pathname
@ 2014-04-15 13:50 David Marchand
[not found] ` <1397569822-3294-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2014-04-15 13:50 UTC (permalink / raw)
To: dev-VfR2kkLFssw; +Cc: Pascal Mazon
From: Pascal Mazon <pascal.mazon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
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 <pascal.mazon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
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 3ded563..d2753ec 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1049,12 +1049,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());
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1397569822-3294-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] eal: do not try to load library with a local pathname [not found] ` <1397569822-3294-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2014-04-15 13:57 ` Neil Horman [not found] ` <20140415135704.GB3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Neil Horman @ 2014-04-15 13:57 UTC (permalink / raw) To: David Marchand; +Cc: dev-VfR2kkLFssw, Pascal Mazon On Tue, Apr 15, 2014 at 03:50:22PM +0200, David Marchand wrote: > From: Pascal Mazon <pascal.mazon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > > 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 <pascal.mazon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org> > --- > 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 3ded563..d2753ec 100644 > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -1049,12 +1049,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()); > } > -- > 1.7.10.4 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20140415135704.GB3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>]
* Re: [PATCH] eal: do not try to load library with a local pathname [not found] ` <20140415135704.GB3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org> @ 2014-04-17 22:47 ` Thomas Monjalon 0 siblings, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2014-04-17 22:47 UTC (permalink / raw) To: Pascal Mazon; +Cc: dev-VfR2kkLFssw > > 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 <pascal.mazon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > > Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org> Applied for version 1.6.0r2. Thanks, it's a good usability improvement (simpler is better :) -- Thomas ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-17 22:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 13:50 [PATCH] eal: do not try to load library with a local pathname David Marchand
[not found] ` <1397569822-3294-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-15 13:57 ` Neil Horman
[not found] ` <20140415135704.GB3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-04-17 22:47 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).