C 编译器无法在 Linux 系统上创建可执行文件

标签 c linux compiler-errors embedded

我使用的是 National Instruments 硬件 cRIO 9068,机器上安装了 Linux-Realtime。据我了解,它是一种使用 opkg 包管理器的嵌入式 Linux。在这种情况下,我需要一些 opkg 上没有的软件。

我一直在尝试编译 freeTDS 和 unixODBC 驱动程序的源代码,以便在 Linux 系统中使用以与 Microsoft SQL Server 通信。但是,当按照典型的 ./configure 进行设置时,我得到了 unixODBC 的这些错误:

checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gawk... (cached) awk
checking for bison... bison -y
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/admin/sqlFiles/unixODBC-2.3.2':
configure: error: C compiler cannot create executables
See `config.log' for more details

配置日志:

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

It was created by unixODBC configure 2.3.2-pre, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  $ ./configure 

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

hostname = NI-cRIO-9068-193EAD1
uname -m = armv7l
uname -r = 3.2.35-rt52-2.0.0f0
uname -s = Linux
uname -v = #1 SMP PREEMPT RT Tue Jun 3 20:49:19 CDT 2014

/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: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/natinst/bin


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

configure:2623: checking for a BSD-compatible install
configure:2691: result: ./install-sh -c
configure:2702: checking whether build environment is sane
configure:2752: result: yes
configure:2893: checking for a thread-safe mkdir -p
configure:2932: result: ./install-sh -c -d
configure:2945: checking for gawk
configure:2975: result: no
configure:2945: checking for mawk
configure:2975: result: no
configure:2945: checking for nawk
configure:2975: result: no
configure:2945: checking for awk
configure:2961: found /usr/bin/awk
configure:2972: result: awk
configure:2983: checking whether make sets $(MAKE)
configure:3005: result: yes
configure:3090: checking for gawk
configure:3117: result: awk
configure:3132: checking for bison
configure:3148: found /usr/bin/bison
configure:3159: result: bison -y
configure:3183: checking for style of include used by make
configure:3211: result: GNU
configure:3282: checking for gcc
configure:3298: found /usr/bin/gcc
configure:3309: result: gcc
configure:3538: checking for C compiler version
configure:3547: gcc --version >&5
gcc (GCC) 4.7.2
Copyright (C) 2012 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:3558: $? = 0
configure:3547: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/gcc/arm-nilrt-linux-gnueabi/4.7.2/lto-wrapper
Target: arm-nilrt-linux-gnueabi
Configured with: /home/labview_rt/dev/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/zynq/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/work-shared/gcc-4.7.2-r20/gcc-4.7.2/configure --build=x86_64-linux --host=arm-nilrt-linux-gnueabi --target=arm-nilrt-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/gcc --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/labview_rt/dev/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/zynq/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/sysroots/xilinx-zynq --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-nilrt-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-sysroot=/ --with-build-sysroot=/home/labview_rt/dev/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/zynq/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/sysroots/xilinx-zynq --with-native-system-header-dir=/home/labview_rt/dev/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/zynq/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/sysroots/xilinx-zynq/usr/include --with-gxx-include-dir=/usr/include/c++/ --enable-nls
Thread model: posix
gcc version 4.7.2 (GCC) 
configure:3558: $? = 0
configure:3547: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3558: $? = 1
configure:3547: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3558: $? = 1
configure:3578: checking whether the C compiler works
configure:3600: gcc    conftest.c  >&5
/usr/lib/gcc/arm-nilrt-linux-gnueabi/4.7.2/../../../../arm-nilrt-linux-gnueabi/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/gcc/arm-nilrt-linux-gnueabi/4.7.2/../../../../arm-nilrt-linux-gnueabi/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
configure:3604: $? = 1
configure:3642: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "unixODBC"
| #define PACKAGE_TARNAME "unixodbc"
| #define PACKAGE_VERSION "2.3.2-pre"
| #define PACKAGE_STRING "unixODBC 2.3.2-pre"
| #define PACKAGE_BUGREPORT "nick@unixodbc.org "
| #define PACKAGE_URL ""
| #define PACKAGE "unixODBC"
| #define VERSION "2.3.2"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3647: error: in `/home/admin/sqlFiles/unixODBC-2.3.2':
configure:3649: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
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_YACC_set=
ac_cv_env_YACC_value=
ac_cv_env_YFLAGS_set=
ac_cv_env_YFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_AWK=awk
ac_cv_prog_YACC='bison -y'
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes

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

ACLOCAL='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/missing --run aclocal-1.11'
ALLOCA=''
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AR=''
ARGZ_H=''
AS=''
AUTOCONF='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/missing --run autoconf'
AUTOHEADER='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/missing --run autoheader'
AUTOMAKE='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/missing --run automake-1.11'
AWK='awk'
BIN_PREFIX=''
CC='gcc'
CCDEPMODE=''
CFLAGS=''
CONVENIENCE_LTDL_FALSE=''
CONVENIENCE_LTDL_TRUE=''
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFLIB_PATH=''
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DRIVERC_FALSE=''
DRIVERC_TRUE=''
DRIVERS_FALSE=''
DRIVERS_TRUE=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEC_PREFIX=''
EXEEXT=''
FGREP=''
GREP=''
HAVE_FLEX_FALSE=''
HAVE_FLEX_TRUE=''
ICONV_CHAR_ENCODING=''
ICONV_UNICODE_ENCODING=''
INCLTDL=''
INCLUDE_PREFIX=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_LTDL_FALSE=''
INSTALL_LTDL_TRUE=''
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LEX=''
LEXLIB=''
LEX_OUTPUT_ROOT=''
LFLAGS=''
LIBADD_CRYPT=''
LIBADD_DL=''
LIBADD_DLD_LINK=''
LIBADD_DLOPEN=''
LIBADD_POW=''
LIBADD_SHL_LOAD=''
LIBICONV=''
LIBLTDL=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIB_PREFIX=''
LIB_VERSION=''
LIPO=''
LN_S=''
LTDLDEPS=''
LTDLINCL=''
LTDLOPEN=''
LTLIBOBJS=''
LT_CONFIG_H=''
LT_DLLOADERS=''
LT_DLPREOPEN=''
MAKEINFO='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/missing --run makeinfo'
MANIFEST_TOOL=''
MKDIR_P='./install-sh -c -d'
MSQL_FALSE=''
MSQL_TRUE=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='unixODBC'
PACKAGE_BUGREPORT='nick@unixodbc.org '
PACKAGE_NAME='unixODBC'
PACKAGE_STRING='unixODBC 2.3.2-pre'
PACKAGE_TARNAME='unixodbc'
PACKAGE_URL=''
PACKAGE_VERSION='2.3.2-pre'
PATH_SEPARATOR=':'
PREFIX=''
PTH_CFLAGS=''
PTH_CPPFLAGS=''
PTH_LDFLAGS=''
PTH_LIBS=''
QNX_FALSE=''
QNX_TRUE=''
RANLIB=''
READLINE=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
SHLIBEXT=''
STRIP=''
SYSTEM_FILE_PATH=''
SYSTEM_LIB_PATH=''
VERSION='2.3.2'
WITHLT_FALSE=''
WITHLT_TRUE=''
YACC='bison -y'
YFLAGS=''
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/admin/sqlFiles/unixODBC-2.3.2/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
ltdl_LIBOBJS=''
ltdl_LTLIBOBJS=''
mandir='${datarootdir}/man'
mkdir_p='$(top_builddir)/./install-sh -c -d'
msql_headers=''
msql_libraries=''
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sys_symbol_underscore=''
sysconfdir='${prefix}/etc'
target_alias=''

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

/* confdefs.h */
#define PACKAGE_NAME "unixODBC"
#define PACKAGE_TARNAME "unixodbc"
#define PACKAGE_VERSION "2.3.2-pre"
#define PACKAGE_STRING "unixODBC 2.3.2-pre"
#define PACKAGE_BUGREPORT "nick@unixodbc.org "
#define PACKAGE_URL ""
#define PACKAGE "unixODBC"
#define VERSION "2.3.2"

configure: exit 77

一直卡在这个问题上有一段时间了,希望这个网站上的好心人能帮助我解决我的问题。

谢谢, 亚当

最佳答案

您正在为一个非常不寻常的平台编译代码。尽管自动工具会尽力做好配置软件的工作,但在这种情况下,您的系统和工具链太奇特了。

不幸的是,您只能靠自己解决这个问题。最好的办法是在普通的 Linux 计算机上生成 Makefile,然后将其用作平台端口的开始。

关于C 编译器无法在 Linux 系统上创建可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26552885/

相关文章:

c - 增量运算符给出段错误?

c - Rust ffi + wasm (yew -> cargo 网络启动) -> fatal error : 'math.h' file not found

linux - 我无法使用最新的 rpi-3.18.0 内核启动并启用设备树?

c - 如果没有头文件,如何调用像 time() 这样的 C 函数?

linux - 如何在启动期间设置 gsettings?

c - 获取 linux/bin/ss 工具的源代码

c++ - 编译器说变量不是类的成员

C++ 帮助解决编译器错误

java - WEKA源代码编译有错误

c - ICC 编译器 - 错误 : parallel loop condition does not test loop control variable