javascript – 使用emscripten生成python.cc.js

我正在阅读这里的emscripten教程 – https://github.com/kripken/emscripten/wiki/Tutorial以及在本地机器上查看源代码中的一些演示项目.

到目前为止,我已经下载了源代码并正确设置了我的.emscripten设置文件.

我正在寻找一个参考来找出:为了创建/输出“python.cc.js”和“python.html”,需要什么系列的emcc命令?感谢之前尝试过emscripten的开发人员的任何提示.

这是我的.emscripten文件:

EMSCRIPTEN_ROOT = os.path.expanduser('~/Dev/emscripten') # this helps projects using emscripten find it

# LLVM_ROOT = os.path.expanduser('~/Dev/llvm-3.0/cbuild/bin')
LLVM_ROOT = os.path.expanduser('/opt/local/bin')

# See below for notes on which JS engine(s) you need
NODE_JS = 'node'
SPIDERMONKEY_ENGINE = [os.path.expanduser('~/Dev/mozilla-central/js/src/js'), '-m', '-n']
V8_ENGINE = os.path.expanduser('~/Dev/v8/d8')

CLOSURE_COMPILER = os.path.expanduser('~/work/closure-compiler/compiler.jar') # optional (needed for the benchmarks)

TEMP_DIR = '/tmp'


########################################################################################################


# Pick the JS engine to use for running the compiler. This engine must exist, or
# nothing can be compiled.
#
# Recommendation: If you already have node installed, use that. Otherwise, build v8 or
#                 spidermonkey from source. Any of these three is fine, as long as it's
#                 a recent version (especially for v8 and spidermonkey).

COMPILER_ENGINE = NODE_JS
#COMPILER_ENGINE = V8_ENGINE
#COMPILER_ENGINE = SPIDERMONKEY_ENGINE


# All JS engines to use when running the automatic tests. Not all the engines in this list
# must exist (if they don't, they will be skipped in the test runner).
#
# Recommendation: If you already have node installed, use that. If you can, also build
#                 spidermonkey from source as well to get more test coverage (node can't
#                 run all the tests due to node issue 1669). v8 is currently not recommended
#                 here because of v8 issue 1822.

JS_ENGINES = [NODE_JS, SPIDERMONKEY_ENGINE]

这是我正在运行的emconfigure ./configure命令:

calvins-MacBook ttys000 Sun Feb 05 11:47:32 |~/community/Python-2.7.2|
calvin$emconfigure ./configure
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... /Users/calvin/work/emscripten/emcc
checking whether the C compiler works... no
configure: error: in `/Users/calvin/community/Python-2.7.2':
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.68.  Invocation command line was

  $./configure 

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

hostname = calvins-MacBook.local
uname -m = x86_64
uname -r = 11.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64

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

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
Kernel configured for up to 2 processors.
2 processors are physically available.
2 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1
Primary memory available: 4.00 gigabytes
Default processor set: 146 tasks, 635 threads, 2 processors
Load average: 1.21, Mach factor: 0.99
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: ~/work/emscripten
PATH: ~/node_modules/.bin
PATH: /opt/local/apache2/bin
PATH: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /opt/local/lib/postgresql90/bin
PATH: /opt/local/bin
PATH: /usr/bin
PATH: ~/node_modules/.bin
PATH: /opt/local/apache2/bin
PATH: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /opt/local/lib/postgresql90/bin
PATH: /opt/local/bin
PATH: /usr/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/X11/bin


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

configure:2764: checking for --enable-universalsdk
configure:2805: result: no
configure:2814: checking for --with-universal-archs
configure:2831: result: 32-bit
configure:2988: checking MACHDEP
configure:3136: result: darwin
configure:3142: checking EXTRAPLATDIR
configure:3157: result: $(PLATMACDIRS)
configure:3168: checking machine type as reported by uname -m
configure:3171: result: x86_64
configure:3184: checking for --without-gcc
configure:3228: result: no
configure:3289: checking for gcc
configure:3316: result: /Users/calvin/work/emscripten/emcc
configure:3545: checking for C compiler version
configure:3554: /Users/calvin/work/emscripten/emcc --version >&5
emcc (Emscripten GCC-like replacement) 2.0
Copyright (C) 2011 the Emscripten authors.
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3565: $? = 0
configure:3554: /Users/calvin/work/emscripten/emcc -v >&5
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix
clang: warning: argument unused during compilation: '-nostdinc'
clang: warning: argument unused during compilation: '-nostdinc++'
clang: warning: argument unused during compilation: '-Xclang -nobuiltininc'
clang: warning: argument unused during compilation: '-Xclang -nostdinc++'
clang: warning: argument unused during compilation: '-Xclang -nostdsysteminc'
clang: warning: argument unused during compilation: '-Xclang -isystem/Users/calvin/work/emscripten/system/include'
clang: warning: argument unused during compilation: '-Xclang -isystem/Users/calvin/work/emscripten/system/include/bsd'
... rest of stderr output deleted ...
configure:3565: $? = 0
configure:3554: /Users/calvin/work/emscripten/emcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3565: $? = 1
configure:3554: /Users/calvin/work/emscripten/emcc -qversion >&5
clang: error: no input files
configure:3565: $? = 1
configure:3585: checking whether the C compiler works
configure:3607: /Users/calvin/work/emscripten/emcc    conftest.c  >&5
error: unknown argument: '-nostdsysteminc'
configure:3611: $? = 1
configure:3649: 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
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3654: error: in `/Users/calvin/community/Python-2.7.2':
configure:3656: 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=/Users/calvin/work/emscripten/emcc
ac_cv_env_CFLAGS_set=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=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_ac_ct_CC=/Users/calvin/work/emscripten/emcc

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

AR='/Users/calvin/work/emscripten/emar'
ARCH_RUN_32BIT=''
ARFLAGS=''
BASECFLAGS=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='/Users/calvin/work/emscripten/emcc'
CCSHARED=''
CFLAGS=''
CFLAGSFORSHARED=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=' '\''CC=/Users/calvin/work/emscripten/emcc'\'' '\''CFLAGS='\'''
CPP=''
CPPFLAGS=''
CXX='/Users/calvin/work/emscripten/em++'
DEFS=''
DLINCLDIR=''
DLLLIBRARY=''
DYNLOADFILE=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXTRAMACHDEPPATH='$(PLATMACPATH)'
EXTRAPLATDIR='$(PLATMACDIRS)'
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''
FRAMEWORKINSTALLAPPSPREFIX=''
FRAMEWORKINSTALLFIRST=''
FRAMEWORKINSTALLLAST=''
FRAMEWORKUNIXTOOLSPREFIX='/usr/local'
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='darwin'
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='/Users/calvin/work/emscripten/emranlib'
RUNSHARED=''
SGI_ABI=''
SHELL='/bin/sh'
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='/Users/calvin/work/emscripten/emcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
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='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## 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

configure: exit 77

解决方法:

有关编译项目的信息,请参阅Emscripten wiki页面,

http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html

还有一个项目将Python编译为Emscripten,empythoned,

https://github.com/replit/empythoned

我不确定它是最新的.

上一篇:XLA优化实例


下一篇:c – 有人可以向我解释为什么在LLVM的以下代码中使用相同的操作数进行不等式测试?