为什么在交叉编译Cortex M4的GSL库时出现此错误

时间:2019-05-02 10:06:29

标签: c arm embedded cross-compiling cortex-m

我想交叉编译用于cortex m4处理器的gsl库,并在lpc xpresso IDE中使用它来对我的电路板进行编程。我尝试在Linux终端上使用以下命令:

./configure --host=arm-none-eabi --build=x86_64-pc-linux-gnu --target=arm-none-eabi

终端上的输出是:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-none-eabi-strip... arm-none-eabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a sed that does not truncate output... /bin/sed
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-none-eabi
checking for arm-none-eabi-gcc... arm-none-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/shreyas/Desktop/gsl-2.5':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log文件中的输出为:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by gsl configure 2.5, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --host=arm-none-eabi --build=x86_64-pc-linux-gnu --target=arm-none-eabi

## --------- ##
## Platform. ##
## --------- ##

hostname = shreyas-VirtualBox
uname -m = x86_64
uname -r = 4.15.0-48-generic
uname -s = Linux
uname -v = #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: S{HOME}/opt/npm/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
PATH: /home/shreyas/Desktop/gcc-arm-none-eabi-8-2018-q4-major/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2381: checking for a BSD-compatible install
configure:2449: result: /usr/bin/install -c
configure:2460: checking whether build environment is sane
configure:2515: result: yes
configure:2574: checking for arm-none-eabi-strip
configure:2590: found /usr/bin/arm-none-eabi-strip
configure:2601: result: arm-none-eabi-strip
configure:2666: checking for a thread-safe mkdir -p
configure:2705: result: /bin/mkdir -p
configure:2712: checking for gawk
configure:2728: found /usr/bin/gawk
configure:2739: result: gawk
configure:2750: checking whether make sets $(MAKE)
configure:2772: result: yes
configure:2801: checking whether make supports nested variables
configure:2818: result: yes
configure:2905: checking whether to enable maintainer-specific portions of Makefiles
configure:2914: result: no
configure:2952: checking for a sed that does not truncate output
configure:3016: result: /bin/sed
configure:3028: checking whether make sets $(MAKE)
configure:3050: result: yes
configure:3064: checking build system type
configure:3078: result: x86_64-pc-linux-gnu
configure:3098: checking host system type
configure:3111: result: arm-none-eabi
configure:3146: checking for arm-none-eabi-gcc
configure:3162: found /usr/bin/arm-none-eabi-gcc
configure:3173: result: arm-none-eabi-gcc
configure:3442: checking for C compiler version
configure:3451: arm-none-eabi-gcc --version >&5
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3462: $? = 0
configure:3451: arm-none-eabi-gcc -v >&5
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/6.3.1/lto-wrapper
Target: arm-none-eabi
Configured with: ../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/lib/include' --mandir='/usr/lib/share/man' --infodir='/usr/lib/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir='/usr/lib/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man --enable-languages=c,c++,lto --enable-multilib --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --build=x86_64-linux-gnu --target=arm-none-eabi --with-system-zlib --with-gnu-as --with-gnu-ld --with-pkgversion=15:6.3.1+svn253039-1build1 --without-included-gettext --prefix=/usr/lib --infodir=/usr/share/doc/gcc-arm-none-eabi/info --htmldir=/usr/share/doc/gcc-arm-none-eabi/html --pdfdir=/usr/share/doc/gcc-arm-none-eabi/pdf --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --disable-libstdc++-v3 --host=x86_64-linux-gnu --with-headers=no --without-newlib --with-multilib-list=rmprofile CFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' CPPFLAGS='-Wdate-time -D_FORTIFY_SOURCE=2' CXXFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' FCFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' FFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' GCJFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' LDFLAGS='-Wl,-Bsymbolic-functions -Wl,-z,relro' OBJCFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' OBJCXXFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 AR_FOR_TARGET=arm-none-eabi-ar AS_FOR_TARGET=arm-none-eabi-as LD_FOR_TARGET=arm-none-eabi-ld NM_FOR_TARGET=arm-none-eabi-nm OBJDUMP_FOR_TARGET=arm-none-eabi-objdump RANLIB_FOR_TARGET=arm-none-eabi-ranlib READELF_FOR_TARGET=arm-none-eabi-readelf STRIP_FOR_TARGET=arm-none-eabi-strip
Thread model: single
gcc version 6.3.1 20170620 (15:6.3.1+svn253039-1build1) 
configure:3462: $? = 0
configure:3451: arm-none-eabi-gcc -V >&5
arm-none-eabi-gcc: error: unrecognized command line option '-V'
arm-none-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3462: $? = 1
configure:3451: arm-none-eabi-gcc -qversion >&5
arm-none-eabi-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
arm-none-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3462: $? = 1
configure:3482: checking whether the C compiler works
configure:3504: arm-none-eabi-gcc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb   conftest.c  >&5
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/build/newlib-8gJlYR/newlib-2.4.0.20160527/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
collect2: error: ld returned 1 exit status
configure:3508: $? = 1
configure:3546: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gsl"
| #define PACKAGE_TARNAME "gsl"
| #define PACKAGE_VERSION "2.5"
| #define PACKAGE_STRING "gsl 2.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "gsl"
| #define VERSION "2.5"
| #define RELEASED /**/
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3551: error: in `/home/shreyas/Desktop/gsl-2.5':
configure:3553: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-pc-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-pc-linux-gnu
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=arm-none-eabi
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=arm-none-eabi
ac_cv_host=arm-none-eabi
ac_cv_path_SED=/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=arm-none-eabi-gcc
ac_cv_prog_STRIP=arm-none-eabi-strip
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /home/shreyas/Desktop/gsl-2.5/missing aclocal-1.13'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AS=''
AUTOCONF='${SHELL} /home/shreyas/Desktop/gsl-2.5/missing autoconf'
AUTOHEADER='${SHELL} /home/shreyas/Desktop/gsl-2.5/missing autoheader'
AUTOMAKE='${SHELL} /home/shreyas/Desktop/gsl-2.5/missing automake-1.13'
AWK='gawk'
CC='arm-none-eabi-gcc'
CCDEPMODE=''
CFLAGS='-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb'
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
GSLCBLAS_LDFLAGS=''
GSL_CFLAGS=''
GSL_LDFLAGS=''
GSL_LIBADD=''
GSL_LIBM=''
GSL_LIBS=''
GSL_LT_CBLAS_VERSION='0:0:0'
GSL_LT_VERSION='24:0:1'
GSL_MAJOR_VERSION='2'
GSL_MINOR_VERSION='5'
HAVE_AIX_IEEE_INTERFACE=''
HAVE_DARWIN86_IEEE_INTERFACE=''
HAVE_DARWIN_IEEE_INTERFACE=''
HAVE_FREEBSD_IEEE_INTERFACE=''
HAVE_GNUM68K_IEEE_INTERFACE=''
HAVE_GNUPPC_IEEE_INTERFACE=''
HAVE_GNUSPARC_IEEE_INTERFACE=''
HAVE_GNUX86_IEEE_INTERFACE=''
HAVE_HPUX11_IEEE_INTERFACE=''
HAVE_HPUX_IEEE_INTERFACE=''
HAVE_IRIX_IEEE_INTERFACE=''
HAVE_NETBSD_IEEE_INTERFACE=''
HAVE_OPENBSD_IEEE_INTERFACE=''
HAVE_OS2EMX_IEEE_INTERFACE=''
HAVE_SOLARIS_IEEE_INTERFACE=''
HAVE_SUNOS4_IEEE_INTERFACE=''
HAVE_TRU64_IEEE_INTERFACE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBM=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${SHELL} /home/shreyas/Desktop/gsl-2.5/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/bin/mkdir -p'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='gsl'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='gsl'
PACKAGE_STRING='gsl 2.5'
PACKAGE_TARNAME='gsl'
PACKAGE_URL=''
PACKAGE_VERSION='2.5'
PATH_SEPARATOR=':'
RANLIB=''
SED='/bin/sed'
SET_MAKE=''
SHELL='/bin/bash'
STRIP='arm-none-eabi-strip'
VERSION='2.5'
ac_ct_AR=''
ac_ct_CC=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-pc-linux-gnu'
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='arm-none-eabi'
host_alias='arm-none-eabi'
host_cpu='arm'
host_os='eabi'
host_vendor='none'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/shreyas/Desktop/gsl-2.5/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias='arm-none-eabi'

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "gsl"
#define PACKAGE_TARNAME "gsl"
#define PACKAGE_VERSION "2.5"
#define PACKAGE_STRING "gsl 2.5"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "gsl"
#define VERSION "2.5"
#define RELEASED /**/

configure: exit 77

日志的相关部分似乎是这样的:

configure:3482: checking whether the C compiler works
configure:3504: arm-none-eabi-gcc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb   conftest.c  >&5
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/build/newlib-8gJlYR/newlib-2.4.0.20160527/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
collect2: error: ld returned 1 exit status

如果有人可以帮助我,那真是太好了。

0 个答案:

没有答案