Skip to content
Advertisement

ELF file exists in /usr/bin but turns out “-ash: file: not found”

i’m trying to install some new software package under openwrt using opkg,and the installation has been successful,and we can see the binary file really exists in the /usr/bin,and i have trird the lld check but turns out the same . as below:

JavaScript

thanks.

Advertisement

Answer

As mentioned by @nos in the comments on the question this can happen if binary is linked with a libc that doesn’t exist on your device.

e.g. This is the output I get when I try to run a binary that’s been built with the wrong libc (note that I specify the full path /usr/bin/ldd because without that for some reason I was getting the same “not found” error you note in your question).

JavaScript

For me the issue was that I was building my package using the wrong toolchain. I’d assumed that the git://git.openwrt.org/openwrt.git repo was for Chaos Calmer (the current release at time of writing). But of course that repo is the development branch (svn trunk). I needed to use git://git.openwrt.org/15.05/openwrt.git instead.

You can confirm which libc you’re building with by checking the name of the toolchain directory staging_dir. The libc version is the last component of the name (e.g. toolchain-mips_34kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2 is using uClibc-0.9.33.2).

Compare this version to the version of libc that’s present on your router by checking what /lib/libc.so* links to on your router (run ls -l /lib/libc.so*). If you need to change the libc version used by your toolchain then do make menuconfig in the OpenWRT buildroot and set the libc version in Advanced configuration options (for developers) -> Toolchain Options -> C Library implementation. You probably shouldn’t need to change this setting though — make sure you’re building from the correct source repo for the version installed on your router.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement