-   Linux From Scratch (
-   -   Getting stuck on 6.13/14 - cannot open shared object file (

DrinkinHomeBrew 12-24-2011 12:31 PM

Getting stuck on 6.13/14 - cannot open shared object file
I first noticed it when I went to compile 6.14-GMP, and I thought my first compilation of 6.14-BinUtils went alright. But I went back and re-compiled BinUtils and I'm getting the following error on "make tooldir=/usr"

<<< You can skip this, I got it working here but GMP still has a problem described in the next post. Keeping the information below in case it is relevant later.>>


rm -f ./libiberty.a pic/./libiberty.a
ar rc ./libiberty.a \
  ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./crc32.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./safe-ctype.o ./simple-object.o ./simple-object-coff.o ./simple-object-elf.o ./simple-object-mach-o.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o ./strsignal.o ./unlink-if-ordinary.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o  ./setproctitle.o
ar: error while loading shared libraries: cannot open shared object file: No such file or directory
make[2]: *** [libiberty.a] Error 127
make[2]: Leaving directory `/sources/binutils-build/libiberty'
make[1]: *** [all-libiberty] Error 2
make[1]: Leaving directory `/sources/binutils-build'
make: *** [all] Error 2

I did see a copy of this file in /usr/lib dated earlier this morning. Thinking it may have been corrupted, I deleted it and tried to rebuild the entire BinUtils package, where I get the above error (I got the same error that it wasn't able to access the file when I went to build GMP also).

I'm running on Linux Mint 12 (fresh install in VMWare), and have checked all of my host settings via version-check (all are at or greater than listed in the introduction).

I was thinking maybe something is broken higher up in the build process, but reading through the book, it looks like this file is first created in 6.14. Is there a point earlier in the process where this file is created?

These are the exact commands I used to build BinUtils


# 6.13. Binutils-2.21.1a (1.9 SBU)
# ================================================

cd /sources
tar xvfj binutils-2.21.1a.tar.bz2
cd binutils-2.21.1

expect -c "spawn ls"

### Verify output: spawn ls
### If output is: The system has no more ptys. Ask your system administrator to create more.
### Then fix the issue

rm -fv etc/
sed -i.bak '/^INFO/s/ //' etc/

sed -i "/exception_defines.h/d" ld/testsuite/ld-elf/
sed -i "s/-fvtable-gc //" ld/testsuite/ld-selective/selective.exp

mkdir -v ../binutils-build
cd ../binutils-build

../binutils-2.21.1/configure --prefix=/usr --enable-shared

make tooldir=/usr

### Must run make check
make -k check

make tooldir=/usr install

cp -v ../binutils-2.21.1/include/libiberty.h /usr/include

cd /sources
rm -rf  binutils-2.21.1
rm -rf /binutils-build

DrinkinHomeBrew 12-24-2011 01:12 PM

Ok, managed to get BinUtils to process immediately after I posted the last message. But I am still in a position where GMP is failing.

When I run "make 2>&1 | tee /sources/out/6.14-gmp-make.log" I get


libtool: link: ar cq .libs/libmpn.a .libs/fib_table.o .libs/mp_bases.o .libs/add.o .libs/add_1.o .libs/add_n.o .libs/sub.o .libs/sub_1.o .libs/sub_n.o .libs/neg.o .libs/com.o .libs/mul_1.o .libs/addmul_1.o .libs/submul_1.o .libs/lshift.o .libs/rshift.o .libs/dive_1.o .libs/diveby3.o .libs/divis.o .libs/divrem.o .libs/divrem_1.o .libs/divrem_2.o .libs/fib2_ui.o .libs/mod_1.o .libs/mod_34lsub1.o .libs/mode1o.o .libs/pre_divrem_1.o .libs/pre_mod_1.o .libs/dump.o .libs/mod_1_1.o .libs/mod_1_2.o .libs/mod_1_3.o .libs/mod_1_4.o .libs/lshiftc.o .libs/mul.o .libs/mul_fft.o .libs/mul_n.o .libs/sqr.o .libs/mul_basecase.o .libs/sqr_basecase.o .libs/nussbaumer_mul.o .libs/random.o .libs/random2.o .libs/pow_1.o .libs/rootrem.o .libs/sqrtrem.o .libs/get_str.o .libs/set_str.o .libs/scan0.o .libs/scan1.o .libs/popcount.o .libs/hamdist.o .libs/cmp.o .libs/perfsqr.o .libs/perfpow.o .libs/gcd_1.o .libs/gcd.o .libs/gcdext_1.o .libs/gcdext.o .libs/gcd_lehmer.o .libs/gcd_subdiv_step.o .libs/gcdext_lehmer.o .libs/gcdext_subdiv_step.o .libs/div_q.o .libs/tdiv_qr.o .libs/jacbase.o .libs/get_d.o .libs/matrix22_mul.o .libs/hgcd2.o .libs/hgcd.o .libs/mullo_n.o .libs/mullo_basecase.o .libs/toom22_mul.o .libs/toom32_mul.o .libs/toom42_mul.o .libs/toom52_mul.o .libs/toom62_mul.o .libs/toom33_mul.o .libs/toom43_mul.o .libs/toom53_mul.o .libs/toom63_mul.o .libs/toom44_mul.o .libs/toom6h_mul.o .libs/toom6_sqr.o .libs/toom8h_mul.o .libs/toom8_sqr.o .libs/toom_couple_handling.o .libs/toom2_sqr.o .libs/toom3_sqr.o .libs/toom4_sqr.o .libs/toom_eval_dgr3_pm1.o .libs/toom_eval_dgr3_pm2.o .libs/toom_eval_pm1.o .libs/toom_eval_pm2.o .libs/toom_eval_pm2exp.o .libs/toom_eval_pm2rexp.o .libs/toom_interpolate_5pts.o .libs/toom_interpolate_6pts.o .libs/toom_interpolate_7pts.o .libs/toom_interpolate_8pts.o .libs/toom_interpolate_12pts.o .libs/toom_interpolate_16pts.o .libs/invertappr.o .libs/invert.o .libs/binvert.o .libs/mulmod_bnm1.o .libs/sqrmod_bnm1.o .libs/sbpi1_div_q.o .libs/sbpi1_div_qr.o .libs/sbpi1_divappr_q.o .libs/dcpi1_div_q.o .libs/dcpi1_div_qr.o .libs/dcpi1_divappr_q.o .libs/mu_div_qr.o .libs/mu_divappr_q.o .libs/mu_div_q.o .libs/bdiv_q_1.o .libs/sbpi1_bdiv_q.o .libs/sbpi1_bdiv_qr.o .libs/dcpi1_bdiv_q.o .libs/dcpi1_bdiv_qr.o .libs/mu_bdiv_q.o .libs/mu_bdiv_qr.o .libs/bdiv_q.o .libs/bdiv_qr.o .libs/divexact.o .libs/bdiv_dbm1c.o .libs/redc_1.o .libs/redc_2.o .libs/redc_n.o .libs/powm.o .libs/powlo.o .libs/powm_sec.o .libs/subcnd_n.o .libs/redc_1_sec.o .libs/trialdiv.o .libs/remove.o .libs/and_n.o .libs/andn_n.o .libs/nand_n.o .libs/ior_n.o .libs/iorn_n.o .libs/nior_n.o .libs/xor_n.o .libs/xnor_n.o .libs/copyi.o .libs/copyd.o .libs/zero.o .libs/umul.o .libs/udiv.o .libs/invert_limb.o
ar: error while loading shared libraries: cannot open shared object file: No such file or directory
make[2]: *** [] Error 127
make[2]: Leaving directory `/sources/gmp-5.0.2/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/sources/gmp-5.0.2'
make: *** [all] Error 2

I started to tee the stdout/stderr to a log file for easier debugging. The only thing that stands out during the binutils install are the following warnings showing up in the make check log


WARNING: Couldn't find the global config file.
WARNING: Couldn't find tool init file
Test Run By root on Sat Dec 24 17:45:37 2011
Native configuration is i686-pc-linux-gnu

As posted above, these are the commands I am using to build GMP, but it isn't going past the "make" command at this point.


# 6.14. GMP-5.0.2 (1.7 SBU)
# ================================================

tar xvfj gmp-5.0.2.tar.bz2
cd gmp-5.0.2

sed -i 's/np + dn, qn/& - dn/' mpn/generic/dcpi1_bdiv_q.c

ABI=32 ./configure --prefix=/usr --enable-cxx --enable-mpbsd 2>&1  | tee /sources/out/6.14-gmp-configure.log

make 2>&1  | tee /sources/out/6.14-gmp-make.log

### It is critical to run tests and check all 162 tests passed
make check 2>&1  | tee /sources/out/6.14-gmp-make-check.log

awk '/tests passed/{total+=$2} ; END{print total}' /sources/out/6.14-gmp-make-check.log

make install 2>&1  | tee /sources/out/6.14-gmp-make-install.log

mkdir -v /usr/share/doc/gmp-5.0.2
cp    -v doc/{isa_abi_headache,configuration} doc/*.html \

cd /sources
rm -rf  gmp-5.0.2

And just to confirm, the file does exist:


root:/sources/gmp-5.0.2# ls /usr/lib/libb* -al
-rwxr-xr-x 1 root root 3090225 Dec 24 17:53 /usr/lib/
-rw-r--r-- 1 root root 6008118 Dec 24 17:53 /usr/lib/libbfd.a
-rwxr-xr-x 1 root root    994 Dec 24 17:53 /usr/lib/
lrwxrwxrwx 1 root root      16 Dec 24 17:53 /usr/lib/ ->
-rw-r--r-- 1 root root    1814 Dec 24 05:13 /usr/lib/libbsd-compat.a

DrinkinHomeBrew 12-24-2011 09:59 PM

OK, running "/sbin/ldconfig -v" seems to have fixed the problem. I encountered the same issue of libraries not being found when I performed the next two chapters (it's compiling GCC now). Running ldconfig -v fixed it all three times.

druuna 12-25-2011 04:27 AM


A word of warning:

You should _not_ have to run the ldconfig command after/during the build process (unless explicitly stated in the book). If you have to do this to make things work then you probably still have an underlying problem which might pop-up at some point.

Looking at the first 2 post in this thread I cannot find anything that is out of the ordinary (well, the error message is, of course :) ). I'm guessing something might have gone wrong during the Re-adjusting the Toolchain part.

One other thing: Looking at posts 1 and 2 it does look like you are using scripts/files to build the packages. If that is true then this could be the problem. I don't see any error checks in those "scripts" and if these are parsed all commands will be executed, even if one fails.

Hope this helps.

DrinkinHomeBrew 12-26-2011 11:58 AM

Thank you, I ended up having problems on the GCC build with it not finding another library, so you're probably correct with something going wrong somewhere in the process. I've actually restarted it and paying attention to make sure I didn't miss anything in the book (as I did once before).

The code blocks posted above were not scripts but I've been pasting all of the commands in a text file along with some personal addendum that I'm cutting & pasting in chunks into the shell. Currently I've just been eyeballing for errors as they come up, but I like the idea of adding in scripted checks for errors.

I've known from the start I will probably want to approach this in multiple passes, first getting a working known good installation (possibly adding a few packages from BLFS) and then starting again digging into each chapter further to see what it is building along the way and peering into some of the code. Knowing that, I had no desire to be retyping the same commands over and over.

All times are GMT -5. The time now is 09:46 AM.