简体   繁体   English

从Ubuntu上的源安装pyV8时出错

[英]Error installing pyV8 from source on ubuntu

when trying to install PyV8 in ubuntu, and type the command: 尝试在ubuntu中安装PyV8时,键入以下命令:

python setup.py build

then it display this error: 然后显示此错误:

error: command 'c++' failed with exit status 1

anybody have solution about this? 有人对此有解决方案吗?

Here is what I have in my Dockerfile. 这是我在Dockerfile中的内容。 The following is tested and runs in production on top of Debian Stretch. 以下内容已在Debian Stretch上进行了测试并在生产中运行。 I recommend using exactly the PyV8 / V8 setup that I'm using - I've spent at least a week to figure out which combination doesn't lead to memory leaks. 我建议完全使用我使用的PyV8 / V8设置-我已经花了至少一周的时间来弄清楚哪种组合不会导致内存泄漏。 I also recommend reading through the discussion and the JSContext fix here and here . 我还建议在此处此处通读讨论内容和JSContext修复程序。

In short, support for PyV8 is almost non-existent - either you use it just as a toy, or you follow exactly this recipe, or you spend a significant amount of time and effort to fork the repo and make it better. 简而言之,几乎不存在对PyV8的支持-您只是将其作为玩具使用,或者完全按照此食谱操作,或者花费大量时间和精力来整理仓库并使其更好。 If starting fresh, I recommend using Node-JS instead and communicate through some IPC method with Python. 如果重新开始,我建议改用Node-JS,并通过某些IPC方法与Python进行通信。

ENV MY_HOME /home/forge
ENV MY_LIB $FORGE_HOME/lib

# preparing dependencies for V8 and PyV8
ENV V8_HOME $MY_LIB/v8
RUN apt-get update && \
    apt-get install -y libboost-thread-dev \
        libboost-all-dev \
        libboost-dev \
        libboost-python-dev \
        autoconf \
        libtool \
        systemtap \
        scons

# compiling an older version of boost, required for this version of V8
RUN mkdir -p $MY_LIB/boost && cd $MY_LIB/boost && \
        wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz && tar -xvzf boost_1_54_0.tar.gz && cd $MY_LIB/boost/boost_1_54_0 && \
        ./bootstrap.sh && \
        ./b2 install --prefix=/usr/local --with-python --with-thread && \
        ldconfig && \
        ldconfig /usr/local/lib

# preparing gcc 4.9 - anything newer will lead to errors with the V8 codebase
ENV CC "gcc-4.9"
ENV CPP "gcc-4.9 -E"
ENV CXX "g++-4.9"
ENV PATH_BEFORE_V8 "${MY_HOME}/bin:${PATH}"
ENV PATH "${MY_HOME}/bin:${PATH}"
RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
    echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
    apt-get update && \
    apt-get install -y gcc-4.9 g++-4.9 && \
    mkdir -p ${MY_HOME}/bin && cd ${MY_HOME}/bin && \
    ln -s /usr/bin/${CC} ${MY_HOME}/bin/gcc && \
    ln -s /usr/bin/${CC} ${MY_HOME}/bin/x86_64-linux-gnu-gcc && \
    ln -s /usr/bin/${CXX} ${MY_HOME}/bin/g++ && \
    ln -s /usr/bin/${CXX} ${MY_HOME}/bin/x86_64-linux-gnu-g++

# compiling a specific version of V8 and PyV8, since older combos lead to memory leaks
RUN git clone https://github.com/muellermichel/V8_r10452.git $V8_HOME && \
    git clone https://github.com/muellermichel/PyV8_r429.git $MY_LIB/pyv8 && \
    cd $MY_LIB/pyv8 && python setup.py build && python setup.py install

# cleaning up
RUN PATH=${PATH_BEFORE_V8} && \
    head -n -2 /etc/apt/sources.list > ${MY_HOME}/sources.list.temp && \
    mv ${MY_HOME}/sources.list.temp /etc/apt/sources.list && \
    apt-get update
ENV PATH "${PATH_BEFORE_V8}"
ENV CC ""
ENV CPP ""
ENV CXX ""

older version that depends on the now defunct googlecode and was made for Ubuntu 12.04: 较旧的版本(取决于现已失效的googlecode)是为Ubuntu 12.04制作的:

export MY_LIB_FOLDER=[PUT-YOUR-DESIRED-INSTALL-PATH-HERE]

apt-get install -y libboost-thread-dev
apt-get install -y libboost-all-dev
apt-get install -y libboost-dev
apt-get install -y libboost-python-dev
apt-get install -y git-core autoconf libtool systemtap
apt-get install -y subversion

apt-get install -y wget
mkdir -p $MY_LIB_FOLDER/boost && cd $MY_LIB_FOLDER/boost && wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz && tar -xvzf boost_1_54_0.tar.gz
cd $MY_LIB_FOLDER/boost/boost_1_54_0 && ./bootstrap.sh && ./b2 install --prefix=/usr/local --with-python --with-thread && ldconfig && ldconfig /usr/local/lib
svn checkout -r10452 http://v8.googlecode.com/svn/trunk/ $MY_LIB_FOLDER/v8
export V8_HOME=$MY_LIB_FOLDER/v8
svn checkout -r429 http://pyv8.googlecode.com/svn/trunk/ $MY_LIB_FOLDER/pyv8
git clone https://github.com/taguchimail/pyv8-linux-x64.git $MY_LIB_FOLDER/pyv8-taguchimail && cd $MY_LIB_FOLDER/pyv8-taguchimail && git checkout origin/stable
apt-get install -y scons
cd $MY_LIB_FOLDER/pyv8 && patch -p0 < $MY_LIB_FOLDER/pyv8-taguchimail/patches/pyv8.patch && python setup.py build && python setup.py install 

Had the same problem and this worked for me: 有同样的问题,这对我有用:

export LIB=~
apt-get install -y curl libboost-thread-dev libboost-all-dev libboost-dev libboost-python-dev git-core autoconf libtool
svn checkout -r19632 http://v8.googlecode.com/svn/trunk/ $LIB/v8
export V8_HOME=$LIB/v8
svn checkout http://pyv8.googlecode.com/svn/trunk/ $LIB/pyv8 && cd $LIB/pyv8 && python setup.py build && python setup.py install

Solution found in comments here - https://code.google.com/p/pyv8/wiki/HowToBuild 在此处的评论中找到解决方案-https: //code.google.com/p/pyv8/wiki/HowToBuild

I'm using a Debian based distro. 我正在使用基于Debian的发行版。 Here's how I installed PyV8 (you'll need to have git installed): 这是我安装PyV8的方式(您需要安装git):

cd /usr/share 光盘/ usr / share

sudo git clone https://github.com/emmetio/pyv8-binaries.git sudo git clone https://github.com/emmetio/pyv8-binaries.git

cd pyv8-binaries/ cd pyv8-binaries /

sudo unzip pyv8-linux64.zip sudo解压缩pyv8-linux64.zip

sudo cp -a PyV8.py _PyV8.so /usr/bin 须藤cp -a PyV​​8.py _PyV8.so / usr / bin

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

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