在交叉编译期间将GMP问题链接到GCC

时间:2015-09-26 15:04:21

标签: gcc cross-compiling gmp

How To Build GCC 4.8.2 ARM Cross-Compiler之后,我已成功安装了所有内容。但GMP与GCC的联系并没有在那里完成,我提到了这个tutorial - 如下所示

    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

当我尝试配置时,会发生这种情况:

    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.

如何解决这个问题?我看起来很详尽但是徒劳无功。

谢谢!

1 个答案:

答案 0 :(得分:0)

  

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

这是回顾以前消息的线索,这些消息是:

  

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

     

检查条带...条带

似乎找不到你的跨binutils。请注意,configure也可能会在普通桌面系统上为名为mt的实用程序发出此警告,但这个实际上并不是问题。未找到指定主机/目标系统的binutils程序的事实通常表明您将无法按照您的意图编译任何内容。

  

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

进一步表明您的PATH中没有交叉工具链,因为它无法找到C交叉编译器。如果您为编译的所有内容运行make install并将安装的bin目录添加到PATH,则应该正确找到这些工具。来自ARM cross-compiler tutorial you linked

  

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

$ 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

注意INSTALLDIRPATH的行。另外,确保您可以编译测试程序:

  

现在编译你的测试程序:

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

检查您的测试程序是否已成功交叉编译为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
     

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