Linux 工具链臂glibc 2.12.1错误

Linux 工具链臂glibc 2.12.1错误,linux,cross-compiling,Linux,Cross Compiling,我尝试为手臂创建交叉工具 但是有一个错误: In file included from dl-lookup.c:28:0: ../glibc-ports-2.11/sysdeps/arm/dl-machine.h:29:0: warning: "VALID_ELF_ABIVERSION" redefined In file included from dynamic-link.h:88:0, from dl-load.c:34: ../glibc-ports-2

我尝试为手臂创建交叉工具 但是有一个错误:

In file included from dl-lookup.c:28:0:
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:29:0: warning: "VALID_ELF_ABIVERSION" redefined
In file included from dynamic-link.h:88:0,
                 from dl-load.c:34:
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:29:0: warning: "VALID_ELF_ABIVERSION" redefined
../sysdeps/unix/sysv/linux/ldsodefs.h:62:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:30:0: warning: "VALID_ELF_OSABI" redefined
../sysdeps/unix/sysv/linux/ldsodefs.h:60:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:32:0: warning: "VALID_ELF_HEADER" redefined
../sysdeps/unix/sysv/linux/ldsodefs.h:58:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h: In function 'elf_machine_load_address':
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:81:38: warning: taking address of expression of type 'void'
../sysdeps/unix/sysv/linux/ldsodefs.h:62:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:30:0: warning: "VALID_ELF_OSABI" redefined
../sysdeps/unix/sysv/linux/ldsodefs.h:60:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:32:0: warning: "VALID_ELF_HEADER" redefined
../sysdeps/unix/sysv/linux/ldsodefs.h:58:0: note: this is the location of the previous definition
../glibc-ports-2.11/sysdeps/arm/dl-machine.h: In function 'elf_machine_load_address':
../glibc-ports-2.11/sysdeps/arm/dl-machine.h:81:38: warning: taking address of expression of type 'void'
dl-load.c: In function 'open_verify':
dl-load.c:1663:41: error: macro "VALID_ELF_ABIVERSION" passed 2 arguments, but takes just 1
dl-load.c:1662:12: error: 'VALID_ELF_ABIVERSION' undeclared (first use in this function)
dl-load.c:1662:12: note: each undeclared identifier is reported only once for each function it appears in
dl-load.c:1708:36: error: macro "VALID_ELF_ABIVERSION" passed 2 arguments, but takes just 1
dl-load.c:1577:3: warning: unused variable 'expected2'
make[2]: *** [/home/pahlevan/Desktop/rezaee/sources/glibc-build/elf/dl-load.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/pahlevan/Desktop/rezaee/sources/glibc-2.12.1/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/home/pahlevan/Desktop/rezaee/sources/glibc-2.12.1'
我的配置是:

gcc-4.5.1+linux.2.6.35.4+binutils-2.20.51+glibc-2.12.1+port-2.11

CLFS_TARGET="arm-pahlevan-linux-gnu"


cd /sources

tar -jxf glibc-2.12.1.tar.bz2

cd ./glibc-2.12.1

tar -jxf ../glibc-ports-2.11.tar.bz2

cp -v Makeconfig{,.orig}

sed -e 's/-lgcc_eh//g' Makeconfig.orig > Makeconfig

patch -Np1 -i ../glibc-2.12.1-gcc_fix-1.patch

patch -Np1 -i ../glibc-2.12.1-makefile_fix-1.patch

mkdir -v ../glibc-build
cd ../glibc-build

export CC="${CLFS_TARGET}-gcc"

export LD="${CLFS_TARGET}-ld"

export AS="${CLFS_TARGET}-as"

export RANLIB="${CLFS_TARGET}-ranlib"

../glibc-2.12.1/configure --prefix=/tools \
    --host=${CLFS_TARGET} --build=${CLFS_HOST} --with-tls --with-__thread \
    --disable-profile --enable-add-ons --with-binutils=/cross-tools/bin --with-headers=/tools/include \
    --enable-kernel=2.6.22.5 --with-headers=/tools/include  libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes libc_cv_gnu89_inline=yes

make 

make install 

cd ..

rm -rf glibc-2.12.1 glibc-build
我解决了编译错误(glic-ports-2.12.1) 此文件中的问题

“glibc-ports-2.12.1/sysdeps/arm/dl machine.h”

必须删除以下行:

#define VALID_ELF_ABIVERSION(ver)       (ver == 0)
#define VALID_ELF_OSABI(osabi)          (osabi == ELFOSABI_SYSV || osabi == ELFOSABI_ARM)
#define VALID_ELF_HEADER(hdr,exp,size)   memcmp (hdr,exp,size-2) == 0   && VALID_ELF_OSABI (hdr[EI_OSABI])   &&  VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])
并替换为行:

#ifndef VALID_ELF_ABIVERSION
#define VALID_ELF_ABIVERSION(ver)   (ver == 0)
#endif

#ifndef VALID_ELF_OSABI
#define VALID_ELF_OSABI(osabi)   (osabi == ELFOSABI_SYSV || osabi == ELFOSABI_ARM)
#endif

#ifndef VALID_ELF_HEADER
#define VALID_ELF_HEADER(hdr,exp,size)   memcmp (hdr,exp,size-2) == 0   && VALID_ELF_OSABI (hdr[EI_OSABI])   && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])
#endif