在交叉编译期间将GMP问题链接到GCC [英] Linking problems for GMP to GCC during cross compilation

查看:2132
本文介绍了在交叉编译期间将GMP问题链接到GCC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遵循此如何构建GCC 4.8.2 ARM交叉编译器,我已经成功安装了一切。但是,GMP与GCC的链接没有在那里完成,我参考了这篇教程

a> -

  mkdir $ BUILDDIR / gmp 
cd $ BUILDDIR / gmp
export CFLAGS = -static
../../sources/gmp-4.3.2/configure \
--build = $ BUILDMACH \
--host = $ TARGETMACH \
--prefix = $ INSTALLDIR \
--disable-shared
make
make install

当我尝试配置时,会发生以下情况:

 检查构建系统类型... i686-pc-linux-gnu 
检查主机系统类型... arm-none-linux-gnueabi
检查BSD兼容安装... / usr / bin / install -c
检查构建环境是否理智...是
检查gawk ... gawk
检查是否make sets $(MAKE)...是
检查arm-none-linux- gnueabi-strip ... no
检查strip ... strip
configure:警告:将来,Autoconf将不会检测到名称不以主机三元组开头的交叉工具
。如果您认为此
配置对您有用,请写信至autoconf@gnu.org。
检查是否启用Makefiles的维护者特定部分... no
检查ABI =标准
检查编译器arm-none-linux-gnueabi-gcc -static ... no
检查编译器gcc -static ...是
检查ARM gcc无符号分区是否工作...是
检查arm-none-linux-gnueabi-gcc ... gcc
检查C编译器默认输出文件名... a.out
检查C编译器是否工作...是
检查我们是否正在交叉编译...是
检查可执行文件的后缀。 ..
检查目标文件的后缀... o
检查我们是否使用GNU C编译器...是
检查gcc是否接受-g ...是
检查gcc选项以接受ISO C89 ...无需
检查gcc选项以接受ISO C99 ... -std = gnu99
检查gcc -std = gnu99选项以接受ISO标准C ...(缓存)-std = gnu99
检查如何运行C程序eprocessor ... gcc -std = gnu99 -E
检查编译系统编译器gcc -std = gnu99 ...是
检查编译系统预处理器... gcc -std = gnu99 -E
检查构建系统可执行文件后缀...
检查构建系统编译器是否是ANSI ...是
检查构建系统编译器数学库... -lm
检查处理的grep使用ABI =standard
CC =gcc -std = gnu99
CFLAGS = - static
CPPFLAGS =
MPN_PATH =arm通用
检查函数原型...是
检查ANSI C头文件...是
检查sys / types.h ...是
检查sys / stat.h ...是
检查stdlib.h ...是
检查string.h ...是
检查memory.h ...是
检查strings.h ...是
检查inttypes.h ...是
检查stdint.h ...是
检查unistd.h ...是
检查string.h ...(缓存)是
检查汇编程序是否支持--noexecstack选项...是
检查arm-none-linux-gnueabi-ar ...否
检查ar ... ar
检查兼容BSD的nm ... nm
检查与BSD兼容的nm ... / usr / bin / nm -B
检查不截断输出的sed ... / bin / sed
检查gcc使用的ld -std = gnu99 ... / usr / bin / ld
检查链接器(/ usr / bin / ld)是否为GNU ld ...是
检查/ usr / bin / ld选项重新加载目标文件... -r
检查ln -s是否工作...是
检查如何识别相关库... pass_all
检查dlfcn.h可用性...是
检查dlfcn.h存在...是
检查dlfcn.h ...是
检查命令行参数的最大长度... 1572864
检查命令来解析/ USR /斌/ nm -b输出gcc -std = gnu99对象... ok
检查objdir ... .libs
检查arm-none-linux-gnueabi-ar ... ar
检查arm-none-linux-gnueabi-ranlib ... no
检查ranlib ... ranlib
检查arm-none-linux-gnueabi-strip ... strip
检查如果gcc -std = gnu99支持-fno-rtti -fno-exceptions ... no
检查gcc -std = gnu99选项以产生PIC ... -fPIC
检查gcc -std = gnu99 PIC标志-fPIC工作...是
检查gcc -std = gnu99静态标志-static工作...是
检查gcc -std = gnu99是否支持-c -o file.o .. 。yes
检查gcc -std = gnu99链接器(/ usr / bin / ld)是否支持共享库...是
检查动态链接器特性... GNU / Linux ld.so
检查如何将库路径硬编码为程序... immediate
检查剥离库是否可行...是
检查libtool是否支持共享库。 ..是
检查是否构建共享库...否
检查是否构建静态库...是
configure:创建libtool
检查ANSI C头文件。 ..(缓存)是
检查是否可以包含time.h和sys / time.h ...是
检查fcntl.h可用性...是
检查fcntl.h存在...是
检查fcntl.h ...是
检查float.h可用性...是
检查float.h存在...是
检查float.h ...是
检查invent.h可用性...不
检查invent.h存在...不
检查invent.h ...不
检查langinfo.h可用性...是
检查langinfo.h存在...是
检查langinfo.h ...是
检查locale.h可用性...是
检查locale.h存在...是
检查locale.h ...是
检查nl_types.h可用性...是
检查nl_types.h存在...是
检查nl_types.h ...是
检查sys / attributes.h可用性... no
检查sys / attributes.h存在... no
检查sys / attributes.h ... no
检查sys / iograph.h可用性... no
检查sys / iograph.h存在... no
检查sys / iograph.h ... no
检查sys / mman.h可用性...是
检查sys / mman.h存在...是
检查sys / mman.h .. 。yes
检查sys / param.h可用性...是
检查sys / param.h存在...是
检查sys / param.h ...是
检查sys / processor.h可用性... no
检查sys / processor.h状态...不检查
检查sys / processor.h ...不检查
检查sys / pstat .h可用性... no
检查sys / pstat.h状态...不检查
检查sys / pstat.h ...没有
检查sys / sysinfo.h可用性.. 。yes
检查sys / sysinfo.h状态...是
检查sys / sysinfo .h ...是
检查sys / syssgi.h可用性...不检查
检查sys / syssgi.h存在...没有
检查sys / syssgi.h ... no
检查sys / systemcfg.h可用性... no
检查sys / systemcfg.h存在... no
检查sys / systemcfg.h ... no
检查sys / time.h可用性...是
检查sys / time.h存在...是
检查sys / time.h ...是
检查sys / times。 h可用性...是
检查sys / times.h存在...是
检查sys / times.h ...是
检查sys / resource.h ...是
检查sys / sysctl.h ...是
检查machine / hal_sysinfo.h ...否
检查是否声明了fgetc ...是
检查是否fscanf被声明...是
检查是否声明了optarg ...是
检查是否声明了ungetc ...是
检查是否声明vfprintf ...是
检查是否声明了sys_errlist .. 。是
检查是否声明了sys_nerr ...是
检查信号处理程序的返回类型... void
检查intmax_t ...是
检查长双精度.. 。是
检查很长时间...是
检查ptrdiff_t ...是
检查quad_t ...是
检查uint_least32_t ...是
检查预处理器字符串化操作符...是
检查是否工作volatile ...是
检查C / C ++ restrict关键字... restrict
检查是否< stdarg.h>存在和工作...是
检查gcc __attribute__((const))是否工作...是
检查gcc __attribute__((malloc))是否工作...是
检查gcc __attribute__((mode(XX)))工作...是
检查gcc __attribute__((noreturn))是否工作...是
检查是否内嵌... inline
检查cos in -lm ... yes
检查工作的alloca.h ...是
检查alloca(通过gmp-impl.h)...是
检查如何分配临时内存... alloca
检查字节排序是否是bigendian ... no
检查双精度浮点的格式... IEEE little endian
检查报警...是
检查attr_get ... no
检查时钟...是
检查clock_gettime ...是
检查cputime ...否
检查getpagesize .. 。是
检查getrusage ...是
检查gettimeofday ...是
检查for getsysinfo ... no
检查localeconv ...是
检查memset ...是
检查mmap ...是
检查mprotect ...是
检查nl_langinfo ...是
检查obstack_vprintf ...是
检查popen ...是
检查processor_info ... no
检查pstat_getprocessor ... no
检查raise ... yes
检查read_real_time ... no
检查sigaction ... yes
检查sigaltstack ... yes
检查sigstack ... yes
检查syssgi ... no
检查strchr ... yes
检查strerror ... yes
检查strnlen ...是
检查strtol ...是
检查strtoul ...是
检查sysconf ...是
检查sysctl ...是
检查sysctlbyname ...否
检查时间...是
检查vsnprintf ...是
检查是否vsnprintf工作...可能
configure:警告:无法检查交叉编译时正常工作的vsnprintf,会认为它是好的
检查sscanf是否需要可写输入...不$
检查struct pst_processor.psp_iticksperclktick ... no
检查合适的m4 ... m4
检查m4wrap是否产生假输出... no
检查如何切换到文本部分... .text
检查如何切换到数据部分... .data
检查汇编程序标签后缀...:
检查汇编程序全局指令... .globl
检查汇编程序全局指令属性...
检查全局变量是否以下划线作为前缀...否
检查如何切换到只读数据区段... .section .rodata
检查汇编器类型指令... .type $ 1,@ $ 2
检查汇编器.size指令... .size $ 1,$ 2
检查汇编器本地标号前缀... .L
检查汇编程序字节指令... .byte
检查如何定义32位字... .long
检查.align汇编指令是否是对数... no
检查unsigned short ... yes
检查unsigned short的大小... 2
检查unsigned ... yes
检查未签名的大小... 4
检查unsigned long ...是
检查unsigned long的大小... 8
检查mp_limb_t ...是
检查mp_limb_t的大小... 8
configure:错误:糟糕,mp_limb_t是64位,但在此配置中的汇编程序代码
需要32位。
您似乎设置了$ CFLAGS,也许您还需要告诉GMP
预期的ABI,请参阅手册中的ABI和ISA。

如何解决这个问题?我已经详尽地看过,但徒劳无功。

感谢!

解决方案


:警告:将来,Autoconf将不会检测其名称不以主机三元组开头的交叉工具。如果您认为此配置对您有用,请写信至autoconf@gnu.org。


这是查看以前消息的线索,它们是:


检查arm-none-linux-gnueabi-strip ... no



检查strip ... strip


看来您的交叉binutils没有找到。请注意, configure 也可能在正常桌面系统上的名为 mt 的实用程序发出此警告,但那不是真的是一个问题。在指定的主机/目标系统中找不到binutils程序的事实通常表明,您无法按照您的意图编译任何内容。



< blockquote>

检查编译器arm-none-linux-gnueabi-gcc -static ... no


更进一步表明您在 PATH 中根本没有交叉工具链,因为它找不到C交叉编译器。如果您为编译的所有内容运行了 make install ,并且还将安装的 bin 目录添加到 PATH ,它应该找到适当的工具。从您链接的 ARM交叉编译器教程


完成! :)现在用你的新玩具编译一个测试程序,看看它是否有效。在终端运行:

  $ export INSTALLDIR =〜/ workbench / gcc-4.8.2 / arm 
$ export PATH = $ INSTALLDIR / bin:$ PATH
$ export TARGETMACH = arm-none-linux-gnueabi
$ export BUILDMACH = i686-pc-linux-gnu
$ export CROSS = arm-none-linux-gnueabi
$ export CC = $ {CROSS} -gcc
$ export LD = $ {CROSS} -ld
$ export AS = $ { CROSS} - 为


注意 INSTALLDIR PATH 。另外,请确保您可以编译一个测试程序:
$ b


现在编译您的测试程序:

  $ $ CC -Wall -Wextra< your test> .c -o< your test> 

检查您的测试程序是否已成功针对ARM进行交叉编译:

  $ file< your test> 
bash:GNU / Linux 2.6.16的ELF 32位LSB可执行文件,ARM版本1(SYSV),动态链接(使用共享库),未剥离



如果您看到类似于上述输出的内容,那么您已经成功交叉编译了您的测试程序。



Following this How To Build GCC 4.8.2 ARM Cross-Compiler, I have successfully installed everything. But GMP linkage to GCC isn't done there for which I referred to this tutorial- shown below

    mkdir $BUILDDIR/gmp
    cd $BUILDDIR/gmp
    export CFLAGS=-static
    ../../sources/gmp-4.3.2/configure \
    --build=$BUILDMACH \
    --host=$TARGETMACH \
    --prefix=$INSTALLDIR \
    --disable-shared
    make
    make install

When I try to configure, this is what happens:

    checking build system type... i686-pc-linux-gnu
    checking host system type... arm-none-linux-gnueabi
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for arm-none-linux-gnueabi-strip... no
    checking for strip... strip
    configure: WARNING: In the future, Autoconf will not detect cross-tools
    whose name does not start with the host triplet.  If you think this
    configuration is useful to you, please write to autoconf@gnu.org.
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking ABI=standard
    checking compiler arm-none-linux-gnueabi-gcc -static ... no
    checking compiler gcc -static ... yes
    checking whether ARM gcc unsigned division works... yes
    checking for arm-none-linux-gnueabi-gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... yes
    checking for suffix of executables... 
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for gcc option to accept ISO C99... -std=gnu99
    checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
    checking how to run the C preprocessor... gcc -std=gnu99 -E
    checking build system compiler gcc -std=gnu99... yes
    checking for build system preprocessor... gcc -std=gnu99 -E
    checking for build system executable suffix... 
    checking whether build system compiler is ANSI... yes
    checking for build system compiler math library... -lm
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    using ABI="standard"
          CC="gcc -std=gnu99"
          CFLAGS="-static"
          CPPFLAGS=""
          MPN_PATH=" arm generic"
    checking for function prototypes... yes
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for string.h... (cached) yes
    checking whether assembler supports --noexecstack option... yes
    checking for arm-none-linux-gnueabi-ar... no
    checking for ar... ar
    checking for BSD-compatible nm... nm
    checking for BSD-compatible nm... /usr/bin/nm -B
    checking for a sed that does not truncate output... /bin/sed
    checking for ld used by gcc -std=gnu99... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for /usr/bin/ld option to reload object files... -r
    checking whether ln -s works... yes
    checking how to recognize dependent libraries... pass_all
    checking dlfcn.h usability... yes
    checking dlfcn.h presence... yes
    checking for dlfcn.h... yes
    checking the maximum length of command line arguments... 1572864
    checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok
    checking for objdir... .libs
    checking for arm-none-linux-gnueabi-ar... ar
    checking for arm-none-linux-gnueabi-ranlib... no
    checking for ranlib... ranlib
    checking for arm-none-linux-gnueabi-strip... strip
    checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
    checking for gcc -std=gnu99 option to produce PIC... -fPIC
    checking if gcc -std=gnu99 PIC flag -fPIC works... yes
    checking if gcc -std=gnu99 static flag -static works... yes
    checking if gcc -std=gnu99 supports -c -o file.o... yes
    checking whether the gcc -std=gnu99 linker (/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... no
    checking whether to build static libraries... yes
    configure: creating libtool
    checking for ANSI C header files... (cached) yes
    checking whether time.h and sys/time.h may both be included... yes
    checking fcntl.h usability... yes
    checking fcntl.h presence... yes
    checking for fcntl.h... yes
    checking float.h usability... yes
    checking float.h presence... yes
    checking for float.h... yes
    checking invent.h usability... no
    checking invent.h presence... no
    checking for invent.h... no
    checking langinfo.h usability... yes
    checking langinfo.h presence... yes
    checking for langinfo.h... yes
    checking locale.h usability... yes
    checking locale.h presence... yes
    checking for locale.h... yes
    checking nl_types.h usability... yes
    checking nl_types.h presence... yes
    checking for nl_types.h... yes
    checking sys/attributes.h usability... no
    checking sys/attributes.h presence... no
    checking for sys/attributes.h... no
    checking sys/iograph.h usability... no
    checking sys/iograph.h presence... no
    checking for sys/iograph.h... no
    checking sys/mman.h usability... yes
    checking sys/mman.h presence... yes
    checking for sys/mman.h... yes
    checking sys/param.h usability... yes
    checking sys/param.h presence... yes
    checking for sys/param.h... yes
    checking sys/processor.h usability... no
    checking sys/processor.h presence... no
    checking for sys/processor.h... no
    checking sys/pstat.h usability... no
    checking sys/pstat.h presence... no
    checking for sys/pstat.h... no
    checking sys/sysinfo.h usability... yes
    checking sys/sysinfo.h presence... yes
    checking for sys/sysinfo.h... yes
    checking sys/syssgi.h usability... no
    checking sys/syssgi.h presence... no
    checking for sys/syssgi.h... no
    checking sys/systemcfg.h usability... no
    checking sys/systemcfg.h presence... no
    checking for sys/systemcfg.h... no
    checking sys/time.h usability... yes
    checking sys/time.h presence... yes
    checking for sys/time.h... yes
    checking sys/times.h usability... yes
    checking sys/times.h presence... yes
    checking for sys/times.h... yes
    checking for sys/resource.h... yes
    checking for sys/sysctl.h... yes
    checking for machine/hal_sysinfo.h... no
    checking whether fgetc is declared... yes
    checking whether fscanf is declared... yes
    checking whether optarg is declared... yes
    checking whether ungetc is declared... yes
    checking whether vfprintf is declared... yes
    checking whether sys_errlist is declared... yes
    checking whether sys_nerr is declared... yes
    checking return type of signal handlers... void
    checking for intmax_t... yes
    checking for long double... yes
    checking for long long... yes
    checking for ptrdiff_t... yes
    checking for quad_t... yes
    checking for uint_least32_t... yes
    checking for preprocessor stringizing operator... yes
    checking for working volatile... yes
    checking for C/C++ restrict keyword... restrict
    checking whether <stdarg.h> exists and works... yes
    checking whether gcc __attribute__ ((const)) works... yes
    checking whether gcc __attribute__ ((malloc)) works... yes
    checking whether gcc __attribute__ ((mode (XX))) works... yes
    checking whether gcc __attribute__ ((noreturn)) works... yes
    checking for inline... inline
    checking for cos in -lm... yes
    checking for working alloca.h... yes
    checking for alloca (via gmp-impl.h)... yes
    checking how to allocate temporary memory... alloca
    checking whether byte ordering is bigendian... no
    checking format of `double' floating point... IEEE little endian
    checking for alarm... yes
    checking for attr_get... no
    checking for clock... yes
    checking for clock_gettime... yes
    checking for cputime... no
    checking for getpagesize... yes
    checking for getrusage... yes
    checking for gettimeofday... yes
    checking for getsysinfo... no
    checking for localeconv... yes
    checking for memset... yes
    checking for mmap... yes
    checking for mprotect... yes
    checking for nl_langinfo... yes
    checking for obstack_vprintf... yes
    checking for popen... yes
    checking for processor_info... no
    checking for pstat_getprocessor... no
    checking for raise... yes
    checking for read_real_time... no
    checking for sigaction... yes
    checking for sigaltstack... yes
    checking for sigstack... yes
    checking for syssgi... no
    checking for strchr... yes
    checking for strerror... yes
    checking for strnlen... yes
    checking for strtol... yes
    checking for strtoul... yes
    checking for sysconf... yes
    checking for sysctl... yes
    checking for sysctlbyname... no
    checking for times... yes
    checking for vsnprintf... yes
    checking whether vsnprintf works... probably
    configure: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok
    checking whether sscanf needs writable input... no
    checking for struct pst_processor.psp_iticksperclktick... no
    checking for suitable m4... m4
    checking if m4wrap produces spurious output... no
    checking how to switch to text section... .text
    checking how to switch to data section... .data
    checking for assembler label suffix... :
    checking for assembler global directive... .globl
    checking for assembler global directive attribute... 
    checking if globals are prefixed by underscore... no
    checking how to switch to read-only data section...     .section    .rodata
    checking for assembler .type directive... .type $1,@$2
    checking for assembler .size directive... .size $1,$2
    checking for assembler local label prefix... .L
    checking for assembler byte directive... .byte
    checking how to define a 32-bit word... .long
    checking if .align assembly directive is logarithmic... no
    checking for unsigned short... yes
    checking size of unsigned short... 2
    checking for unsigned... yes
    checking size of unsigned... 4
    checking for unsigned long... yes
    checking size of unsigned long... 8
    checking for mp_limb_t... yes
    checking size of mp_limb_t... 8
    configure: error: Oops, mp_limb_t is 64 bits, but the assembler code
    in this configuration expects 32 bits.
    You appear to have set $CFLAGS, perhaps you also need to tell GMP the
    intended ABI, see "ABI and ISA" in the manual.

How to fix this? I have looked exhaustively but in vain.

Thanks!

解决方案

configure: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org.

That's a clue to review the previous messages, which are:

checking for arm-none-linux-gnueabi-strip... no

checking for strip... strip

It seems your cross-binutils aren't found. Note that configure may also issue this warning for a utility named mt on normal desktop systems, but that one isn't really a problem. The fact that a binutils program wasn't found for the specified host/target system is generally a sign that you won't be able to compile anything as you intend to do.

checking compiler arm-none-linux-gnueabi-gcc -static ... no

further indicates that you don't have the cross-toolchain in your PATH at all because it can't find the C cross-compiler. If you've run make install for everything you compiled and also added the installation's bin directory to your PATH, it should find the tools properly. From the ARM cross-compiler tutorial you linked:

Your done! :) Now go compile a test program with your new toy and see if it works. In a new terminal run:

$ export INSTALLDIR=~/workbench/gcc-4.8.2/arm
$ export PATH=$INSTALLDIR/bin:$PATH
$ export TARGETMACH=arm-none-linux-gnueabi
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=arm-none-linux-gnueabi
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as

Notice the lines with INSTALLDIR and PATH. Additionally, make sure that you could compile a test program:

Now compile your test program:

$ $CC -Wall -Wextra <your test>.c -o <your test>

Check to see if your test program was successfully cross-compiled for ARM:

$ file <your test>
bash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

If you see something similar to the output above, then you have successfully cross-compiled your test program.

这篇关于在交叉编译期间将GMP问题链接到GCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆