2013-03-19 95 views
0

我想编译Python到DD-WRT(DD-WRT v24-sp2(SVN修订版:14896))上的一个路由器(华硕RT-N16) 。 JFFS2(因此ipkg)和Optware不是选项。我需要做一个直接的交叉编译。我是交叉编译的新手。交叉编译海湾合作委员会的失败(Python)

我想这些方向如下: http://www.cnx-software.com/2011/02/04/cross-compiling-python-for-mips-and-arm-platforms/

我也尝试过这些方向,但得到了同样的错误(这是我刚刚完成做什么): http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.pdf

但我不断收到如下:

[email protected]:~/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 

我的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 

任何建议将不胜感激。我有我正在编译的系统,但除非我在工作中,否则我无法访问路由器(直到下周二才会回到那里)。但是交叉编译器就是这个问题。据我所知,一旦全部编译完成,该文件夹只需要被复制(通过scp)到路由器。谢谢!

〜BB

+2

这看起来很有趣:'mipsel-linux-gcc:command not found'。另外,你肯定路由器有足够的资源来运行Python 2.7吗? – Blender 2013-03-19 19:52:57

+0

我建议做hello.c(即bareminimum c程序)并验证你可以运行mipsel-linux-gcc来产生mips二进制 – Foon 2013-04-17 14:38:50

回答

0

我想知道,如果你有你的桌面上安装mipel-GCC交叉编译器。

由于路由器具有mipsel架构,MIPS架构采用Little Endian(MIPSEL)格式。在编译该体系结构中的python代码之前,您必须安装mipsel-gcc交叉编译器。一旦编译了代码,就可以在路由器上运行代码。

一旦你安装了mipsel,你可以将它添加到你的路径变量和代码将工作。

相关问题