12/10/2022 17:16, Olivier Matz: > On Tue, Oct 11, 2022 at 12:44:56AM +0200, Thomas Monjalon wrote: > As discussed off-list with Robin, it appears that "ldd" is not available > on buildroot-based images. See: > http://lists.busybox.net/pipermail/buildroot/2013-July/074927.html > > The link is quite old but it seems it's still true today if we don't > build the toolchain. > > Robin suggested this patch: > > --- a/usertools/dpdk-pmdinfo.py > +++ b/usertools/dpdk-pmdinfo.py > @@ -290,8 +290,10 @@ def get_needed_libs(path: Path) -> Iterator[Path]: > """ > Extract the dynamic library dependencies from an ELF executable. > """ > + env = os.environ.copy() > + env["LD_TRACE_LOADED_OBJECTS"] = "1" > with subprocess.Popen( > - ["ldd", str(path)], stdout=subprocess.PIPE, stderr=subprocess.PIPE > + [str(path)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env > ) as proc: > out, err = proc.communicate() > if proc.returncode != 0: > > One subtle difference is that the patched version won't work on > non-executable files, but I don't think it can happen in real-life. > > An alternative for us is to provide a simple "ldd" shell script in our > buildroot-based images. > > I don't have a strong opinion, I'll tend to say that the patch is a > better option. Any comment?
What about implementing both? If ldd is available, use it, otherwise use LD_TRACE_LOADED_OBJECTS variable.