[Clfs-support] clfs_git:

Charlie Brown stieizc.33 at gmail.com
Mon Jun 3 08:41:13 PDT 2013


I'm having trouble compiling gcc in Chapter 6. Constructing a Temporary
System.
----------------------------------------
BOOK: GIT-20130602-x86_64-Multilib
host: debian 7, x86_64
target: x86_64
$CLFS_HOST=x86_64-cross-linux-gnu $CLFS_TARGET=x86_64-unknown-linux-gnu
$BUILD32=-m32 $BUILD64=-m64

Thanks in advance.
I have to apologize that I didn't follow the version of gcc in the
book(4.6.3), but jumped to 4.8.1. I know things got greatly changed with
4.8, and that's why I want to try it out:). Everything went (relatively)
smooth when building /cross-tools, but got totally stuck at gcc for /tools.
Here's what I did:
------------------
for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
 cp -uv $file{,.orig}
 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
     -e 's@/usr@/tools at g' $file.orig > $file
 cat >> $file << EOF
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""
EOF
 touch $file.orig
done &&
cp -uv gcc/Makefile.in{,.orig} &&  # ****************Borrowed from LFS-7.3.
I think it's cleaner than the patch********************************
sed -e "s@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 /tools/include at g"
gcc/Makefile.in.orig > gcc/Makefile.in &&
mkdir -v ../gcc-build &&
cd ../gcc-build &&
CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" \
  ../gcc-4.8.1/configure --prefix=/tools \
  --libdir=/tools/lib64 --with-native-system-header-dir=/tools/include \
        # Just in case
  --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
  --with-local-prefix=/tools  --enable-long-long \
  --enable-c99 --enable-shared --enable-threads=posix \
  --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
  --disable-libstdcxx-pch --enable-cloog-backend=isl &&
cp -uv Makefile{,.orig} &&
sed "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" \
    Makefile.orig > Makefile &&
make -j4 AS_FOR_TARGET="${AS}" LD_FOR_TARGET="${LD}" &&   *#* ***********
The same with the clfs book **********
make install
------------------------------
And make failed:
In file included from ../../gcc-4.8.1/gcc/errors.c:29:0:
../../gcc-4.8.1/gcc/system.h:444:23: error: declaration of C function
'void* sbrk(int)' conflicts with
 extern void *sbrk (int);
                       ^
In file included from ../../gcc-4.8.1/gcc/genmddeps.c:19:0:
../../gcc-4.8.1/gcc/system.h:444:23: error: declaration of C function
'void* sbrk(int)' conflicts with
 extern void *sbrk (int);
                       ^
In file included from ../../gcc-4.8.1/gcc/system.h:254:0,
                 from ../../gcc-4.8.1/gcc/errors.c:29:
/usr/include/unistd.h:1065:14: error: previous declaration 'void*
sbrk(intptr_t)' here
 extern void *sbrk (intptr_t __delta) __THROW;
              ^
In file included from ../../gcc-4.8.1/gcc/system.h:254:0,
                 from ../../gcc-4.8.1/gcc/genmddeps.c:19:
/usr/include/unistd.h:1065:14: error: previous declaration 'void*
sbrk(intptr_t)' here
 extern void *sbrk (intptr_t __delta) __THROW;
              ^
*.............................
*
//Generally a lot of conflicts between the host system headers and
/tools/include/*.h
#####################################
make[2]: *** [build/errors.o] Error 1

That's very interesting. Actually, x86_64-unknown-linux-gnu-g++ -v -c
dummy.c gives this:
#include "..." search starts here:
#include <...> search starts here:
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include/c++/4.8.1
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include/c++/4.8.1/x86_64-unknown-linux-gnu
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include/c++/4.8.1/backward
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed
 /mnt/clfs/cross-tools/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include
 /mnt/clfs/tools/include
I think that means my cross-compiler works fine.

And I found this line among other make output, right before the error:
g++ -c   -g -O2 -DIN_GCC ...... // And stuff
The script is actually calling the host systems g++!
I also found make calls:
gcc -c -DHAVE_CONFIG_H ........
which works well.
I'm really frustrated. Can some one help me?  Thanks!

Sincerely,
Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clfs.org/pipermail/clfs-support-clfs.org/attachments/20130603/f1105bf5/attachment.html>


More information about the Clfs-support mailing list