构建交叉编译 64 位 GCC 失败

发布于 2024-11-10 08:25:19 字数 9389 浏览 5 评论 0原文

我正在尝试创建一个运行在我的本地计算机上的 gcc 交叉编译器 [Darwin new-host-2.home 10.7.4 Darwin Kernel Version 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 --with -system-zlib --enable-__cxa_atexit" 并使用 "--enable-64-bit-bfd" 配置 binutils

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

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/gcc-4.3.1/x86_64-pc-freebsd7 /lib/libc.a:当前ar存档
sh-3.2#文件/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/Cocotron/1.0/build/FreeBSD/x86_64/gcc-4.3.1/./gcc/ -B/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ -B/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc- freebsd7/lib/-isystem /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/include -isystem /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/sys -包括-O2 -O2 -g -m32 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pthread -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -O2 -g -m32 -B./ _muldi3_s.o _negdi2_s。 _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so &&如果 [ -f ./libgcc_s.so.1 ];然后 mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup;否则为真;菲&& mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:跳过不兼容的 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc- freebsd7/lib//libc.so 搜索 -lc 时 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:跳过不兼容的 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc- freebsd7/lib/libc.a 搜索 -lc 时 /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld:找不到-lc Collect2: ld 返回 1 退出状态 make[2]: *** [libgcc_s.so] 错误 1 make[1]: *** [all-target-libgcc] 错误 2 make: *** [全部] 错误 2

我很惊讶 ld 无法处理它,因为当我运行这个版本的 'ld' 时,我得到以下输出:

/Developer/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_64 elf32-i386 elf64-x86-64 elf64-little elf64-big elf32-little elf32-big srec 符号rec tekhex 二进制 ihex /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 文件没有符号..这可能是正常的,但我不知道?

良好生产规范:

/usr/bin/ranlib: 文件:.libs/libprintf.a(obprintf.o) 没有符号
/usr/bin/ranlib: 文件:.libs/libprintf.a(obvprintf.o) 没有符号
/usr/bin/ranlib: 文件:.libs/libprintf.a(obprntffuns.o) 没有符号
/usr/bin/ranlib: 文件:.libs/libprintf.a(repl-vsnprintf.o) 没有符号
ranlib.libs/libprintf.a
ranlib: 文件:.libs/libprintf.a(obprintf.o) 没有符号
ranlib: 文件:.libs/libprintf.a(obvprintf.o) 没有符号
ranlib: 文件:.libs/libprintf.a(obprntffuns.o) 没有符号
ranlib:文件:.libs/libprintf.a(repl-vsnprintf.o) 没有符号

我进一步了解了..

ranlib /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a
ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(mp_clz_tab.o) 没有符号
ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obprintf.o) 没有符号
ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obvprintf.o) 没有符号
ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(obprntffuns.o) 没有符号
ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libgmp.a(repl-vsnprintf.o) 没有符号

MPFR:

类似交易:

/usr/bin/ranlib: 文件:.libs/libmpfr.a(volatile.o) 没有符号 /usr/bin/ranlib: 文件:.libs/libmpfr.a(mp_clz_tab.o) 没有符号 /usr/bin/ranlib: 文件:.libs/libmpfr.a(logging.o) 没有符号 /usr/bin/ranlib: 文件:.libs/libmpfr.a(set_d64.o) 没有符号 /usr/bin/ranlib: 文件:.libs/libmpfr.a(get_d64.o) 没有符号 ranlib.libs/libmpfr.a ranlib:文件:.libs/libmpfr.a(易失性.o)没有符号 ranlib:文件:.libs/libmpfr.a(mp_clz_tab.o) 没有符号 ranlib:文件:.libs/libmpfr.a(logging.o) 没有符号 ranlib: 文件:.libs/libmpfr.a(set_d64.o) 没有符号 ranlib:文件:.libs/libmpfr.a(get_d64.o) 没有符号 创建 libmpfr.la

还有一点..

ranlib /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(volatile.o) 没有符号 ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(mp_clz_tab.o) 没有符号 ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(logging.o) 没有符号 ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(set_d64.o) 没有符号 ranlib: 文件:/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/lib/libmpfr.a(get_d64.o) 没有符号

然后我们进入 GCC,大概有良好的 binutils、GMP 和 MPFR.. 但最后在 gcc(特别是 libgcc)的构建过程中,我得到了 ld 链接失败。


更多支持信息:

我使用以下方式编译 binutils:

CFLAGS="-m32 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags

但是,如果我遇到同样的问题我切换到-m64..

CFLAGS="-m64 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags

我使用以下命令编译 GMP 和 MPFR:

ABI=32 $sourceFolder/gmp-$gmpVersion/configure --prefix="$resultFolder"

我使用以下方式编译 GCC:

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

对于所有这些,我正在使用:

编译器目标=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"


在我的目标 FreeBSD 系统(顺便说一句,它是标准 FreeBSD 8.2 RELEASE amd64)上, ld 表示与我的交叉编译系统非常相似的功能。事实上,看来我的交叉编译环境的 ld 处理的是实际目标 ld 处理的超集 - 让我认为我应该能够处理任何文件,而不会出现我所看到的不兼容性

ld:支持的目标: elf64-x86-64 efi-app-ia32 elf32-i386-freebsd srec Symbolsrec tekhex 二进制 ihex ld:支持的仿真:elf_i386_fbsd elf_x86_64_fbsd ld:仿真特定选项: elf_i386_fbsd:

I'm trying to get a working gcc cross-compiler created that lives on my local machine [Darwin new-host-2.home 10.7.4 Darwin Kernel Version 10.7.4: Mon Apr 18 21:24:17 PDT 2011; root:xnu-1504.14.12~3/RELEASE_X86_64 x86_64] and targets a FreeBSD 8.2 x86_64 (AMD64 in FreeBSD terms) target.

I'm compiling gcc 4.3.1, binutils 2.19, GMP 4.2.3, MPFR 2.3.2.

I'm seeing a couple of things that could be going wrong, but they may be red herrings. For what it's worth I am taking known working scripts to build a cross compiler and simply trying to get them to work for x86_64 architecture, so I know I'm not out in left field..

I'm using the gcc compiler target "x86_64-pc-freebsd7" which seems correct. I use compiler flags of: compilerConfigureFlags="--enable-version-specific-runtime-libs --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit" and I configure binutils using "--enable-64-bit-bfd"

In my final error; something that catches my attention is '-m32' which I'm not sure if it should be there. The error is because ld can't make sense out of my "incompatible" file /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.a when searching for -lc. When I run file on libc.a and libc.so from the FreeBSD box I get:

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/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.a: current ar archive

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-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, stripped

Final line my build dies on:

/Developer/Cocotron/1.0/build/FreeBSD/x86_64/gcc-4.3.1/./gcc/xgcc -B/Developer/Cocotron/1.0/build/FreeBSD/x86_64/gcc-4.3.1/./gcc/ -B/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ -B/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/ -isystem /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/include -isystem /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/sys-include -O2 -O2 -g -m32 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pthread -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -O2 -g -m32 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld: skipping incompatible /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib//libc.so when searching for -lc
/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld: skipping incompatible /Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/lib/libc.a when searching for -lc
/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[1]: *** [all-target-libgcc] Error 2
make: *** [all] Error 2

I'm surprised ld can't handle it, because when I run this version of 'ld' I get the followig output:

/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld: supported targets: 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_64 elf32-i386 elf64-x86-64 elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex binary ihex
/Developer/Cocotron/1.0/FreeBSD/x86_64/gcc-4.3.1/x86_64-pc-freebsd7/bin/ld: supported emulations: 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: emulation specific options:
elf_x86_64_fbsd:

Which indicates to me that I've built the binutils correctly.. yet that can't handle a library that's an ELF 64-bit x86-64 FreeBSD shared object??

To give the story from the start - compiling binutils is flawless it seems.

Compiling GMP and MPFR both give me some ranlib issues that worry me a bit, trying to build up a .a library but the .o files have no symbols.. this could be normal but I can't tell?

GMP:

/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

And I get some more further along..

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

MPFR:

Similar deal:

/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

And a bit further along..

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

Then we're on to GCC, presumably with good binutils, GMP, and MPFR.. but finally during build of gcc (specifically libgcc) I get the ld linking failure.


Some more supporting information:

I compile binutils using:

CFLAGS="-m32 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags

However I encounter the same problem if I switch to -m64..

CFLAGS="-m64 -Wformat=0 -Wno-error=deprecated-declarations" $sourceFolder/binutils-$binutilsVersion/configure --prefix="$resultFolder" --target=$compilerTarget $binutilsConfigureFlags

I compile GMP and MPFR using:

ABI=32 $sourceFolder/gmp-$gmpVersion/configure --prefix="$resultFolder"

I compile GCC using:

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

For all these, I'm using:

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"


On my target FreeBSD system, which by the way is standard FreeBSD 8.2 RELEASE amd64, ld indicates very similar capabilities to my cross-compiling one. In fact, it appears that my cross-compiling environment's ld handles a superset of what the actual target's ld handles - making me think I should be able to handle any files without the incompatibility I'm seeing

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:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洛阳烟雨空心柳 2024-11-17 08:25:19

64 位库只能链接到 64 位目标代码。您需要 -m64 来构建 64 位目标代码,-m32 确实会生成 32 位目标代码。

A 64 bit library can only linked to 64 bit object code. You need -m64 to build 64 bit object code, -m32 does produce 32 bit object code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文