简体   繁体   English

交叉编译gcc失败(Python)

[英]Cross-Compiling gcc failure (Python)

I'm trying to compile Python to port over to a router (ASUS RT-N16) with DD-WRT (DD-WRT v24-sp2 (SVN revision: 14896)) on it. 我正在尝试编译Python以将其移植到具有DD-WRT(DD-WRT v24-sp2(SVN版本:14896))的路由器(ASUS RT-N16)。 JFFS2 (and therefore ipkg) and Optware are not options. JFFS2(因此是ipkg)和Optware不是选项。 I need to do a straight cross-compile. 我需要做一个直接的交叉编译。 I'm new to cross-compiling. 我是交叉编译的新手。

I tried following these directions: http://www.cnx-software.com/2011/02/04/cross-compiling-python-for-mips-and-arm-platforms/ 我尝试按照以下指示进行操作: http : //www.cnx-software.com/2011/02/04/cross-compiling-python-for-mips-and-arm-platforms/

I also tried these directions but got the same errors (this is what I JUST finished doing): http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.pdf 我也尝试了这些指示,但是得到了相同的错误(这就是我刚刚完成的操作): http : //www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.pdf

But I keep getting the following: 但是我一直得到以下信息:

majik@ubuntu:~/Desktop/Python-2.7.3$ sudo CC=mipsel-linux-gcc CXX=mipsel-linux-g++ AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib ./configure -host=mipsel-linux -target=mipsel-linux -prefix=/python
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR... 
checking machine type as reported by uname -m... i686
checking for --without-gcc... no
checking for mipsel-linux-gcc... mipsel-linux-gcc
checking whether the C compiler works... no
configure: error: in `/home/majik/Desktop/Python-2.7.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

My config.log contains the following: 我的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 python configure 2.7, which was
generated by GNU Autoconf 2.67.  Invocation command line was

  $ ./configure -host=mipsel-linux -target=mipsel-linux -prefix=/python

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

hostname = ubuntu
uname -m = i686
uname -r = 3.2.0-37-generic-pae
uname -s = Linux
uname -v = #58-Ubuntu SMP Thu Jan 24 15:51:02 UTC 2013

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


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

configure:2756: checking for --enable-universalsdk
configure:2797: result: no
configure:2806: checking for --with-universal-archs
configure:2823: result: 32-bit
configure:2980: checking MACHDEP
configure:3129: result: linux2
configure:3135: checking EXTRAPLATDIR
configure:3150: result: 
configure:3161: checking machine type as reported by uname -m
configure:3164: result: i686
configure:3177: checking for --without-gcc
configure:3221: result: no
configure:3242: checking for mipsel-linux-gcc
configure:3269: result: mipsel-linux-gcc
configure:3538: checking for C compiler version
configure:3547: mipsel-linux-gcc --version >&5
./configure: line 3549: mipsel-linux-gcc: command not found
configure:3558: $? = 127
configure:3547: mipsel-linux-gcc -v >&5
./configure: line 3549: mipsel-linux-gcc: command not found
configure:3558: $? = 127
configure:3547: mipsel-linux-gcc -V >&5
./configure: line 3549: mipsel-linux-gcc: command not found
configure:3558: $? = 127
configure:3547: mipsel-linux-gcc -qversion >&5
./configure: line 3549: mipsel-linux-gcc: command not found
configure:3558: $? = 127
configure:3578: checking whether the C compiler works
configure:3600: mipsel-linux-gcc    conftest.c  >&5
./configure: line 3602: mipsel-linux-gcc: command not found
configure:3604: $? = 127
configure:3642: result: no
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _BSD_TYPES 1
| #define _DARWIN_C_SOURCE 1
| #define _XOPEN_SOURCE 600
| #define _XOPEN_SOURCE_EXTENDED 1
| #define _POSIX_C_SOURCE 200112L
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3647: error: in `/home/majik/Desktop/Python-2.7.3':
configure:3649: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_env_CC_set=set
ac_cv_env_CC_value=mipsel-linux-gcc
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_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=mipsel-linux
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=mipsel-linux
ac_cv_prog_CC=mipsel-linux-gcc

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

AR='mipsel-linux-ar'
ARCH_RUN_32BIT=''
ARFLAGS=''
BASECFLAGS=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='mipsel-linux-gcc'
CCSHARED=''
CFLAGS=''
CFLAGSFORSHARED=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=' '\''-host=mipsel-linux'\'' '\''-target=mipsel-linux'\'' '\''-prefix=/python'\'' '\''host_alias=mipsel-linux'\'' '\''target_alias=mipsel-linux'\'' '\''CC=mipsel-linux-gcc'\'''
CPP=''
CPPFLAGS=''
CXX='mipsel-linux-g++'
DEFS=''
DLINCLDIR=''
DLLLIBRARY=''
DYNLOADFILE=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXTRAMACHDEPPATH=''
EXTRAPLATDIR=''
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''
FRAMEWORKINSTALLAPPSPREFIX=''
FRAMEWORKINSTALLFIRST=''
FRAMEWORKINSTALLLAST=''
FRAMEWORKUNIXTOOLSPREFIX='/python'
GNULD=''
GREP=''
HAS_HG=''
HAVE_GETHOSTBYNAME=''
HAVE_GETHOSTBYNAME_R=''
HAVE_GETHOSTBYNAME_R_3_ARG=''
HAVE_GETHOSTBYNAME_R_5_ARG=''
HAVE_GETHOSTBYNAME_R_6_ARG=''
HGBRANCH=''
HGTAG=''
HGVERSION=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTSONAME=''
LDCXXSHARED=''
LDFLAGS=''
LDLAST=''
LDLIBRARY=''
LDLIBRARYDIR=''
LDSHARED=''
LIBC=''
LIBFFI_INCLUDEDIR=''
LIBM=''
LIBOBJS=''
LIBRARY=''
LIBS=''
LIBTOOL_CRUFT=''
LINKCC=''
LINKFORSHARED=''
LIPO_32BIT_FLAGS=''
LN=''
LTLIBOBJS=''
MACHDEP='linux2'
MACHDEP_OBJS=''
MAINCC=''
OBJEXT=''
OPT=''
OTHER_LIBTOOL_OPT=''
PACKAGE_BUGREPORT='http://bugs.python.org/'
PACKAGE_NAME='python'
PACKAGE_STRING='python 2.7'
PACKAGE_TARNAME='python'
PACKAGE_URL=''
PACKAGE_VERSION='2.7'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PYTHONFRAMEWORK=''
PYTHONFRAMEWORKDIR='no-framework'
PYTHONFRAMEWORKIDENTIFIER='org.python.python'
PYTHONFRAMEWORKINSTALLDIR=''
PYTHONFRAMEWORKPREFIX=''
RANLIB='mipsel-linux-ranlib'
RUNSHARED=''
SGI_ABI=''
SHELL='/bin/bash'
SHLIBS=''
SIGNAL_OBJS=''
SO=''
SOVERSION='1.0'
SRCDIRS=''
SVNVERSION=''
THREADHEADERS=''
THREADOBJ=''
TRUE=''
UNICODE_OBJS=''
UNIVERSALSDK=''
UNIVERSAL_ARCH_FLAGS=''
USE_SIGNAL_MODULE=''
USE_THREAD_MODULE=''
VERSION='2.7'
ac_ct_CC=''
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias='mipsel-linux'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/python'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias='mipsel-linux'

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

/* confdefs.h */
#define _GNU_SOURCE 1
#define _NETBSD_SOURCE 1
#define __BSD_VISIBLE 1
#define _BSD_TYPES 1
#define _DARWIN_C_SOURCE 1
#define _XOPEN_SOURCE 600
#define _XOPEN_SOURCE_EXTENDED 1
#define _POSIX_C_SOURCE 200112L

configure: exit 77

Any suggestions would be greatly appreciated. 任何建议将不胜感激。 I have the system that I'm trying to compile on, but I do not have access to the router unless I'm at work (won't be back there until next Tuesday). 我拥有要在其上进行编译的系统,但除非上班了,否则我将无法访问路由器(直到下周二才会回到那里)。 But It's the cross-compiler that's the problem. 但是问题是交叉编译器。 From what I understand, once it's all compiled, the folder just needs to be copied (via scp) to the router. 据我了解,一旦全部编译完毕,只需要将文件夹复制(通过scp)到路由器。 Thanks! 谢谢!

~BB 〜BB

I would like to know if you have install mipel-gcc cross compiler on your desktop. 我想知道您是否在桌面上安装了mipel-gcc交叉编译器。

Since routers have mipsel architecture, MIPS architecture with Little Endian (MIPSEL) format. 由于路由器具有mipsel架构,因此具有Little Endian(MIPSEL)格式的MIPS架构。 You have to install mipsel-gcc cross compiler before compiling the python code in that architecture. 您必须先安装mipsel-gcc交叉编译器,然后才能在该体系结构中编译python代码。 Once you have compiler the code, you can run the code on your router. 编译代码后,即可在路由器上运行代码。

Once you have installed mipsel, you can add it to you path variables and the code will work. 一旦安装了mipsel,就可以将其添加到路径变量中,并且代码将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM