LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   glibc-2.5.1 cannot find libstdc++ (https://www.linuxquestions.org/questions/linux-from-scratch-13/glibc-2-5-1-cannot-find-libstdc-579486/)

dwhitney67 08-24-2007 10:10 AM

glibc-2.5.1 cannot find libstdc++
 
Hi,

I am working with the LFS Version SVN-20070821 guide, which I believe was recently updated to use glibc-2.5.1. I am building LFS under Ubuntu 7.04 (Feisty) with the latest updates.

Anyhow, I am stuck at a point where it cannot find the libstdc++ library. Here's the error output leading up to the error:
PHP Code:

g++ bug-atexit3-lib.cc --isystem /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2 -isystem /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu -isystem /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants --mpreferred-stack-boundary=2  -fPIC    -I../include -I/mnt/lfs/sources/glibc-build/dlfcn -I/mnt/lfs/sources/glibc-build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i686 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu -I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem /mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.1.2/include -isystem /tools/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED     -/mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.os -MD -MP -MF /mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.os.dt -MT /mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.os
../include/unistd.h:4warning'void _exit(int)'visibility attribute ignored because it
../posix/unistd.h:548warningconflicts with previous declaration here
../include/unistd.h:7warning'int execl(const char*, const char*, ...)'visibility attribute ignored because it
../posix/unistd.h:527warningconflicts with previous declaration here
../include/unistd.h:8warning'int execle(const char*, const char*, ...)'visibility attribute ignored because it
../posix/unistd.h:522warningconflicts with previous declaration here
../include/unistd.h:9warning'int execlp(const char*, const char*, ...)'visibility attribute ignored because it
../posix/unistd.h:538warningconflicts with previous declaration here
../include/unistd.h:10warning'int execvp(const char*, char* const*)'visibility attribute ignored because it
../posix/unistd.h:532warningconflicts with previous declaration here
gcc 
-B/tools/bin/   -shared -static-libgcc  -Wl,-dynamic-linker=/tools/lib/ld-linux.so.2 -Wl,-z,defs -B/mnt/lfs/sources/glibc-build/csu/  -Wl,-z,combreloc -Wl,-z,relro  -L/mnt/lfs/sources/glibc-build -L/mnt/lfs/sources/glibc-build/math -L/mnt/lfs/sources/glibc-build/elf -L/mnt/lfs/sources/glibc-build/dlfcn -L/mnt/lfs/sources/glibc-build/nss -L/mnt/lfs/sources/glibc-build/nis -L/mnt/lfs/sources/glibc-build/rt -L/mnt/lfs/sources/glibc-build/resolv -L/mnt/lfs/sources/glibc-build/crypt -L/mnt/lfs/sources/glibc-build/nptl -Wl,-rpath-link=/mnt/lfs/sources/glibc-build:/mnt/lfs/sources/glibc-build/math:/mnt/lfs/sources/glibc-build/elf:/mnt/lfs/sources/glibc-build/dlfcn:/mnt/lfs/sources/glibc-build/nss:/mnt/lfs/sources/glibc-build/nis:/mnt/lfs/sources/glibc-build/rt:/mnt/lfs/sources/glibc-build/resolv:/mnt/lfs/sources/glibc-build/crypt:/mnt/lfs/sources/glibc-build/nptl -/mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.so -/mnt/lfs/sources/glibc-build/shlib.lds /mnt/lfs/sources/glibc-build/csu/abi-note./mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.os /mnt/lfs/sources/glibc-build/libc.so /mnt/lfs/sources/glibc-build/libc_nonshared.-lstdc++ -lgcc_eh /mnt/lfs/sources/glibc-build/elf/ld.so /mnt/lfs/sources/glibc-build/libc_nonshared.a
/tools/bin/ldcannot find -lstdc++
collect2ld returned 1 exit status
make
[2]: *** [/mnt/lfs/sources/glibc-build/dlfcn/bug-atexit3-lib.soError 1
make
[2]: Leaving directory `/mnt/lfs/sources/glibc-2.5.1/dlfcn'
make[1]: *** [dlfcn/tests] Error 2
make[1]: Leaving directory 
`/mnt/lfs/sources/glibc-2.5.1'
make: *** [check] Error 2
lfs@huahin:/mnt/lfs$ 

These are my environment (shell) settings:
PHP Code:

lfs@huahin:/mnt/lfsenv 
TERM
=xterm
OLDPWD
=/mnt/lfs/sources
LC_ALL
=POSIX
LFS
=/mnt/lfs
PATH
=/tools/bin:/bin:/usr/bin
PWD
=/mnt/lfs
PS1
=${debian_chroot:+($debian_chroot)}\u@\h:\w\$ 
SHLVL=1
HOME
=/home/lfs
_
=/usr/bin/env
lfs
@huahin:/mnt/lfs

And included here is the partial listing of the script I am using to perform the build:

PHP Code:

#!/bin/sh

PrintStep()
{
  echo 
"##########################################"
  
echo "#"
  
echo "#  $1"
  
echo "#"
  
echo "##########################################"
}


#
# Transition to sources directory
#
pushd sources


#
# binutils -- PASS 1
#
if [ ! -f bp1_binutils_pass1.done ]
then
        PrintStep 
"Building binutils-2.17 -- PASS 1"
        
tar xjvf binutils-2.17.tar.bz2
        mkdir 
-v binutils-build
        pushd binutils
-build
        CC
="gcc -B/usr/bin/" ../binutils-2.17/configure \
            --
prefix=/tools --disable-nls --disable-werror
        make 
|| exit 1
        make install 
|| exit 2
        make 
-C ld clean || exit 3
        make 
-C ld LIB_PATH=/tools/lib || exit 4
        cp 
-v ld/ld-new /tools/bin || exit 5
        popd
        touch bp1_binutils_pass1
.done
fi


#
# gcc -- PASS 1
#
if [ ! -f bp1_gcc_pass1.done ]
then
        PrintStep 
"Building gcc-4.1.2 -- PASS 1"
        
tar xjvf gcc-4.1.2.tar.bz2
        mkdir 
-v gcc-build
        pushd gcc
-build
        CC
="gcc -B/usr/bin/" ../gcc-4.1.2/configure --prefix=/tools \
            --
with-local-prefix=/tools --disable-nls --enable-shared \
            --
enable-languages=c
        make bootstrap 
|| exit 1
        make install 
|| exit 2
        ln 
-vs gcc /tools/bin/cc || exit 3
        popd
        touch bp1_gcc_pass1
.done
fi


#
# Linux API headers
#
if [ ! -f bp1_linux_headers.done ]
then
        PrintStep 
"Installing linux-2.6.22.4 API Headers"
        
tar xjvf linux-2.6.22.4.tar.bz2
        pushd linux
-2.6.22.4
        make mrproper 
|| exit 1
        make headers_check 
|| exit 2
        make INSTALL_HDR_PATH
=dest headers_install || exit 3
        cp 
-rv dest/include/* /tools/include || exit 4
        popd
        touch bp1_linux_headers.done
fi


#
# glibc
#
if [ ! -f bp1_glibc.done ]
then
        PrintStep "Building glibc-2.5.1"
        tar xjvf glibc-2.5.1.tar.bz2
        mkdir -v glibc-build
        pushd glibc-build
        ../glibc-2.5.1/configure --prefix=/tools \
            --disable-profile --enable-add-ons \
            --enable-kernel=2.6.0 --with-binutils=/tools/bin \
            --without-gd --with-headers=/tools/include \
            --without-selinux
        make || exit 1
        make check || exit 2
        mkdir -v /tools/etc
        touch /tools/etc/ld.so.conf
        make install || exit 3
        popd
        touch bp1_glibc.done
fi
.
.


As you can see I have not gotten very far. I had copied/pasted all of the commands from the LFS guide, so I am confident I did not miss any steps.

Please let me know if you have any thoughts on this issue, or if you require additional info.

Thank you.

P.S. When previewing my post, I noticed that the PHP wrapping around my script removes the "\" character following some of the lengthier statements (generally the configure commands). Please bear in mind that my script actually does contains them.

P.S.S. One final thing... the the libstdc++ does not exist in /tools/lib (or anywhere else under /tools).

dwhitney67 08-25-2007 07:09 AM

Hmmm, I wonder why PHP truncated the shell script I posted?

Anyhow, I figured out the problem with the build. I was exiting the script when a failure occurred while testing glibc used for the temp system (Section 5.6). Had I read the LFS guide more carefully, I would have been made aware that it is possible for some tests to fail and that these results should be ignored.

In lieu of a "make -k check" statement in my script, I stupidly included "make check || exit 2".

HowDoIProgramIt 08-30-2007 12:12 PM

Quote:

Originally Posted by dwhitney67 (Post 2870064)
Anyhow, I figured out the problem with the build. I was exiting the script when a failure occurred while testing glibc used for the temp system (Section 5.6). ...
In lieu of a "make -k check" statement in my script, I stupidly included "make check || exit 2".

Hi -

Saw your post && just wanted to make sure that you understood what was up with that - "make check" in pass 1 is gonna bomb on the libstdc++ tests because libstdc++ is a host tool (it resides on the build host only at that point) and the library search path has been restricted to use only libraries from the system you're constructing, right?

That's the reason for the "-k". Also, some LFS docs have said that "if 'make test' fails, and you 'make test' again, it'll pick up where it left off" (I'm paraphrasing here) - that hasn't been my experience; I stick with the -k and dump the compile, etc. to a log file ( bash: gcc ... > log.txt 2>&1 )

- Larry


All times are GMT -5. The time now is 01:08 PM.