[lfs-support] Help with a linker problem

Chris Staub chris at beaker67.com
Fri Nov 30 08:17:55 PST 2012

On 11/30/2012 06:37 AM, Simon Geard wrote:
> Hey guys...
> Rewriting my LFS build scripts, I'm getting an interesting linking error
> with bash in chapter 6, and am hoping someone can point me in the right
> direction for tracking down the cause.
> Basically, bash builds correctly, but the resulting binary is bad, any
> attempt to invoke it resulting in:
> # /bin/bash --version
> /bin/bash: error while loading shared libraries: libncurses.so.5: cannot
> open shared object file: No such file or directory
> Now, the obvious problem is that it's complaining about libncurses, not
> the libncursesw version built in chapter 6. As far as I can tell, it
> should be linked to the latter, thanks to the "INPUT(-lncursesw)" linker
> script created when we installed ncurses.
> My suspicion is that when the bash binary was linked, the linker found
> ncurses in /tools ahead of /lib, and so not applied that linker script.
> It then fails runtime linking, since /tools isn't in the search path at
> runtime (unless I put it there with LD_LIBRARY_PATH).
> So, it seems pretty clear that I've missed something in my script -
> probably in one of those first few parts of chapter 6. But I can't spot
> the problem myself, so I'm hoping someone can point me in the direction
> of what could be causing this.
> Simon.

First, check how Bash is linked: "readelf -l /bin/bash | grep 
interpret". Of course, this should say that it's looking for the dynamic 
linker in /lib. Then verify you actually have all the right libraries 
for Ncurses: "ls -la {/usr,}/lib/*ncurses*"

You could also just upload your build scripts for Ncurses, Readline, and 

More information about the lfs-support mailing list