构建交叉编译64位GCC失败

构建交叉编译64位GCC失败,gcc,cross-compiling,x86-64,ld,binutils,Gcc,Cross Compiling,X86 64,Ld,Binutils,我正在尝试创建一个在本地机器上运行的gcc交叉编译器[Darwin new-host-2.home 10.7.4 Darwin内核版本10.7.4:Mon Apr 18 21:24:17 PDT 2011;root:xnu-1504.14.12~3/RELEASE_X86_64 X86_64],目标是FreeBSD 8.2 X86_64(FreeBSD术语中的AMD64) 我正在编译gcc 4.3.1、binutils 2.19、GMP 4.2.3、MPFR 2.3.2 我看到一些事情可能会出问

我正在尝试创建一个在本地机器上运行的gcc交叉编译器[Darwin new-host-2.home 10.7.4 Darwin内核版本10.7.4:Mon Apr 18 21:24:17 PDT 2011;root:xnu-1504.14.12~3/RELEASE_X86_64 X86_64],目标是FreeBSD 8.2 X86_64(FreeBSD术语中的AMD64)

我正在编译gcc 4.3.1、binutils 2.19、GMP 4.2.3、MPFR 2.3.2

我看到一些事情可能会出问题,但它们可能是转移注意力。值得一提的是,我使用已知的工作脚本来构建一个交叉编译器,并简单地尝试让它们为x86_64体系结构工作,所以我知道我并不是左撇子

我正在使用gcc编译器目标“x86_64-pc-freebsd7”,这似乎是正确的。我使用编译器标志:
compilerConfigureFlags=“--enable version-specific runtime libs--enable shared--enable threads=posix--disable checking--disable libunwind exceptions--system zlib--enable--uuuucxa uAtexit”
并使用
配置binutils--enable-64位bfd“

在我最后的错误;引起我注意的是'-m32',我不确定它是否应该在那里。错误是因为在搜索-lc时,ld无法理解我的“不兼容”文件/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.a。当我在libc.a和libc.so上运行
file
时,我从FreeBSD框中得到:

sh-3.2#file/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.a/Developer/Cocotron/1.0/FreeBSD/x86_64-pc-freebsd7/libc.a:当前ar存档 sh-3.2#file/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.so /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.so:ELF 64位LSB共享对象,x86-64,版本1(FreeBSD),动态链接,剥离 最后一行我的构建在:

/Developer/Cocotron/1.0/build/FreeBSD/x86_64/gcc-4.3.1//gcc/xgcc-B/Developer/cococotron/1.0/build/FreeBSD/x86_64/gcc-4.3.1//gcc/-B/Developer/FreeBSD/x86_64/gcc-4.3.1/x86_-pc-freebsd7/bin/-B/Developer/cootron/1.0/FreeBSD/x86_64/gcc-64/gcc-4.3.3.1/lib-pc-isd7/-is7/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/include-isystem/Developer/cococotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/sys-include-O2-O2-g-m32-DIN_gcc-DCROSS_目录结构-DNATIVE_交叉-W-Wall-Wwrite字符串-ricwstt原型-Wmissing原型-Wold样式定义-isystem./include-fPIC-pthread-g-DHAVE_GTHR_DEFAULT-DIN_LIBGCC2-D_GCC_FLOAT_NOT_NEEDED-shared-nodefaultlibs-Wl,--soname=libgcc_s.so.1-Wl,--5.2-g-m32-B.//目前的Mudi3个城市的运营商(U U U U U U U U U U U U s.o.U U-Mudi3个国家的运营商(U U U U U s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.o.版本脚本(libgcc.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.I3_s.o_addvdi3_s.o_subvsi3_s.o_subvdi3_s.o_mulvsi3_s.o_mulvdi3_s.o_negvsi2_s.o_这些公司的运营运营商和运营商的运营运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商的运营商和运营商的运营商的运营商和运营商的运营商的运营商的运营商的运营商的运营商的运营商的运营商的运营商和人口统计人口统计数字和人口统计数据以及人口统计数据以及人口统计数据以及人口统计数据以及人口国家的人口统计数据和人口统计数据和人口统计数据以及人口统计数据以及人口统计数据和人口统计数据以及人口统计数据和人口统计数据以及人口统计数据和人口统计数据以及人口统计数据和人口统计数据以及人口统计数据和人口统计数据,以及人口统计数据和人口统计数据和人口统计数据,以及美国电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司电力公司_我们的服务对象是非政府组织的服务对象,即我们的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象,我们的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的服务对象是非政府组织的s.o_floatundidf_s.o_floatundexf_s.o_floatunditf_s.o_divid3_s.o_moddi3_s.o_udivdi3_s.o_umoddi3_s.o_udiv_w_sdiv_.o_udivmoddi4_.o unwind-dw2_.o unwind-dw2-fde_.o unwind-sjlj_.o gthr-gnat_.o unwind-c_.o emutls_.o-lc&rm-f./libgcc_.so&&if[-f./libgcc_.so.1];然后mv-f./libgcc_.so.1./libgcc_.so.1.backup;否则是真的;fi&&mv./libgcc_.so.1.tmp./libgcc_.so.1&&ln-s libgcc_.so.1./libgcc_.so /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:在搜索-lc时跳过不兼容/Developer/cococotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib//libc.so /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:在搜索-lc时跳过不兼容的/Developer/cococotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/libc.a /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:找不到-lc collect2:ld返回了1个退出状态 生成[2]:***[libgcc_.so]错误1 生成[1]:***[所有目标libgcc]错误2 make:**[全部]错误2 我很惊讶ld不能处理它,因为当我运行此版本的“ld”时,我得到以下输出:

/开发者/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:支持的目标:elf64-x86-64-FreeBSD elf32-i386-FreeBSD coff-i386 efi-app-ia32 efi-bsdrv-ia32 efi-rtdrv-ia32 efi-app-x86_64 efi-bsdrv-x86_64 efi-rtdrv-x86-x86-x86-elf64 elf32十六进制elf32 ELFI386-elf64 elf64-elf64小码大码 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:支持的仿真:elf_x86_64_fbsd elf_i386_fbsd elf_x86_64 elf_i386 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:仿真特定选项: elf_x86_64_fbsd: 这表明我已经正确构建了binutils。。但它不能处理ELF 64位x86-64 FreeBSD共享对象的库

从一开始就讲故事——编译binutils似乎是完美无瑕的

编译GMP和MPFR都会给我带来一些ranlib问题,这让我有点担心,试图建立一个.a库,但.o文件没有符号。。这可能很正常,但我不知道

GMP:

/usr/bin/ranlib:文件:.libs/libprintf.a(obprintf.o)没有符号 /usr/bin/ranlib:文件:.libs/libprintf.a(obvprintf.o)有n个 /usr/bin/ranlib: file: .libs/libprintf.a(obprintf.o) has no symbols /usr/bin/ranlib: file: .libs/libprintf.a(obvprintf.o) has no symbols /usr/bin/ranlib: file: .libs/libprintf.a(obprntffuns.o) has no symbols /usr/bin/ranlib: file: .libs/libprintf.a(repl-vsnprintf.o) has no symbols ranlib .libs/libprintf.a ranlib: file: .libs/libprintf.a(obprintf.o) has no symbols ranlib: file: .libs/libprintf.a(obvprintf.o) has no symbols ranlib: file: .libs/libprintf.a(obprntffuns.o) has no symbols ranlib: file: .libs/libprintf.a(repl-vsnprintf.o) has no symbols ranlib /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(mp_clz_tab.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obprintf.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obvprintf.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obprntffuns.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(repl-vsnprintf.o) has no symbols

/usr/bin/ranlib: file: .libs/libmpfr.a(volatile.o) has no symbols /usr/bin/ranlib: file: .libs/libmpfr.a(mp_clz_tab.o) has no symbols /usr/bin/ranlib: file: .libs/libmpfr.a(logging.o) has no symbols /usr/bin/ranlib: file: .libs/libmpfr.a(set_d64.o) has no symbols /usr/bin/ranlib: file: .libs/libmpfr.a(get_d64.o) has no symbols ranlib .libs/libmpfr.a ranlib: file: .libs/libmpfr.a(volatile.o) has no symbols ranlib: file: .libs/libmpfr.a(mp_clz_tab.o) has no symbols ranlib: file: .libs/libmpfr.a(logging.o) has no symbols ranlib: file: .libs/libmpfr.a(set_d64.o) has no symbols ranlib: file: .libs/libmpfr.a(get_d64.o) has no symbols creating libmpfr.la
ranlib /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(volatile.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(mp_clz_tab.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(logging.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(set_d64.o) has no symbols ranlib: file: /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(get_d64.o) has no symbols
CFLAGS="-m32 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags
CFLAGS="-m64 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags
ABI=32 $sourceFolder/gmp-$gmpVersion/configure --prefix="$resultFolder"
CFLAGS="-m32" $sourceFolder/gcc-$gccVersion/configure -v --prefix="$resultFolder" --target=$compilerTarget \ --with-gnu-as --with-gnu-ld --with-headers=$resultFolder/$compilerTarget/include \ --without-newlib --disable-multilib --disable-libssp --disable-nls --enable-languages="$enableLanguages" \ --with-gmp=$buildFolder/gmp-$gmpVersion --enable-decimal-float --with-mpfr=$resultFolder --enable-checking=release \ --enable-objc-gc \
$compilerConfigureFlags
compilerTarget=x86_64-pc-freebsd7 compilerConfigureFlags="--enable-version-specific-runtime-libs --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit" binutilsConfigureFlags="--enable-64-bit-bfd"
ld: supported targets: elf64-x86-64 efi-app-ia32 elf32-i386-freebsd srec symbolsrec tekhex binary ihex ld: supported emulations: elf_i386_fbsd elf_x86_64_fbsd ld: emulation specific options: elf_i386_fbsd: