different gcc versi0n support different parameters
# /usr/bin/gcc34 --version <== use "yum install compat-gcc-34.i386" to install gcc 3.4
version gcc34 (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# /usr/bin/gcc-4.1.2 --version
gcc-4.1.2 (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Two different version series of gcc * gcc 3.4.X * gcc 4.1.X gcc 4.1.X provides stdc++ library. So we can use -lstdc++ as compiling parameter to compile program e.g. LFLAGS = -lstdc++ -lpthread But in gcc 3.4.X, the "stdc++" library is not yet support. So can not link the library while using gcc 3.4.X version. While compile the binutils of arm toolchain, it will generate error
[root@localhost binutils-build]# make all Configuring in libiberty configure: loading cache .././config.cache checking whether to enable maintainer-specific portions of Makefiles... no checking for makeinfo... makeinfo checking for perl... perl checking build system type... i386-pc-linux-gnu checking host system type... i386-pc-linux-gnu checking for i386-pc-linux-gnu-ar... (cached) arm-linux-uclibc-ar checking for i386-pc-linux-gnu-ranlib... (cached) arm-linux-uclibc-ranlib checking whether ln -s works... yes checking for i386-pc-linux-gnu-gcc... arm-linux-uclibc-gcc checking for C compiler default output... a.out checking whether the C compiler works... configure: error: cannot run C compiled programs.==> After the help of "google", I found that this is because I don't setup the proper g++ (version 3.4) compiler
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** [configure-libiberty] Error 1
Original g++ version
# /usr/bin/g++ --version
g++ (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
install g++ version 3.4
# yum install compat-gcc-34-c++.i386
Before compile the program, make sure the default cc is correct
Use either one of the following two methods
1. readlink -f $(which gcc)
2. echo $CC
沒有留言:
張貼留言