0

我正在尝试编译 Python 以移植到带有 DD-WRT(DD-WRT v24-sp2(SVN 修订版:14896))的路由器(ASUS RT-N16)。JFFS2(因此 ipkg)和 Optware 不是选项。我需要做一个直接的交叉编译。我是交叉编译的新手。

我尝试遵循这些指示: 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

但我不断收到以下信息:

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

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

4

1 回答 1

0

我想知道您是否在桌面上安装了 mipel-gcc 交叉编译器。

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

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

于 2013-04-17T14:30:13.333 回答