2

I am following the Linux from Scratch book, Version 8.4 and am stuck on compiling bc (Chapter 6.15).

I have copied and pasted the commands on that page up to the make command, but when I run make, I get this error:

./fbc -c ./libmath.b </dev/null >libmath.h
./fbc: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory
make[2]: *** [Makefile:631: libmath.h] Error 127
make[2]: Leaving directory '/sources/bc-1.07.1/bc'

I have checked inside /lib and /usr/lib for libreadline.so.8 and it is present in both directories. I have also tried copying libreadline.so.8 to /sources/bc-1.07.1/bc, /sources/bc-1.07.1/bc/lib, and /sources/bc-1.07.1/bc/bc, but I still get the same error.

Output of cat config.log | grep readline:

  $ ./configure --prefix=/usr --with-readline --mandir=/usr/share/man --infodir=/usr/share/info
configure:5164: checking for readline in -lreadline
configure:5189: gcc -o conftest -g -O2   -lncurses conftest.c -lreadline   >&5
configure:5201: checking readline/readline.h usability
configure:5201: checking readline/readline.h presence
configure:5201: checking for readline/readline.h
ac_cv_header_readline_readline_h=yes
ac_cv_lib_readline_readline=yes
READLINELIB='-lreadline -lncurses'

Could anyone please help me with this problem?

Edit:

I managed to solve this issue by running the configure script outside of the chroot environment. The make command and tests return no errors, however I am not sure if this will break anything else in the book.

  • Could you elaborate on how you did it e.g. which options you gave the chroot ? readline is notorious for its ability of not being found by other prgrams using it. In particular, when more than one version of readline is installed on the same system, it gives those kinds of errors. – Romario Aug 28 '19 at 19:56
  • 1
    To enter the chroot environment, I used chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='(lfs chroot) \u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h where $LFS is equal to /mnt/lfs – Ryan Bester Aug 28 '19 at 20:00
  • This issue should also be resolved in the latest release of Linux from Scratch; the book switched to using a bc implementation that is easier to build. – Gavin Howard Dec 23 '19 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.