Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Docker编译Android的PaddlePaddle库,在build开发镜像时下载Go依赖环境失败 #8555

Closed
yeyupiaoling opened this issue Feb 25, 2018 · 14 comments
Labels
User 用于标记用户问题

Comments

@yeyupiaoling
Copy link
Contributor

使用这些命名创建Docker容器,在最后一条命令时

$ git clone https://github.com/PaddlePaddle/Paddle.git
$ cd Paddle
$ docker build -t username/paddle-android:dev . -f Dockerfile.android

卡在

Step 11/18 : RUN wget -qO- go.tgz https://www.golangtc.com/static/go/1.8.4/go1.8.4.linux-amd64.tar.gz |     tar -xz -C /usr/local &&     mkdir /root/gopath &&     mkdir /root/gopath/bin &&     mkdir /root/gopath/src

之前的下载路径是下面这个,但是因为被墙了,所以才改成上面那个,但是还是卡在这里动不了,然后就死掉了。

https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz

有什么办法处理吗?

@yeyupiaoling
Copy link
Contributor Author

yeyupiaoling commented Feb 26, 2018

自己配置go环境是否可行?

下载源码

wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz

解压源码

tar -xzf go1.8.1.linux-xxx.tar.gz -C /usr/local 

~/.bashrc的最后加上

export GOPATH=/usr/local/go  
export PATH=$GOPATH/bin:$PATH  

使其生效

source ~/.bashr 

再在命令行中输入

export GOROOT=/usr/local/go  
export GOPATH=$PATH:$GOROOT/bin  

检查安装结果

go version

最后注释Dockerfile.android中的安装go语言

# Install Go and glide
#RUN wget -qO- go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
#    tar -xz -C /usr/local && \
#    mkdir /root/gopath && \
#    mkdir /root/gopath/bin && \
#    mkdir /root/gopath/src
#ENV GOROOT=/usr/local/go GOPATH=/root/gopath

@QiJune QiJune added the User 用于标记用户问题 label Feb 26, 2018
@yeyupiaoling
Copy link
Contributor Author

好像自行安装不行,在执行

docker run -it --rm -v $PWD:/paddle -e "ANDROID_ABI=armeabi-v7a" -e "ANDROID_API=21" mypaddle/paddle-android:dev

报错

CMake Error at CMakeLists.txt:22 (project):
  No CMAKE_Go_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "GO_COMPILER" or the CMake cache entry CMAKE_Go_COMPILER to the
  full path to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/paddle/build_android/CMakeFiles/CMakeOutput.log".

@Xreki
Copy link
Contributor

Xreki commented Feb 26, 2018

可尝试使用Paddle官方提供的Android开发镜像,通过运行以下命令:

docker pull paddlepaddle/paddle:latest-dev-android

之前的下载路径是下面这个,但是因为被墙了,所以才改成上面那个,但是还是卡在这里动不了,然后就死掉了。

编译Android版本其实不需要依赖Go,后续我们会Fix这个问题,去掉Go的依赖。

@Xreki Xreki changed the title 使用Docker编译Android的PaddlePaddle库,在build时下载依赖环境失败 使用Docker编译Android的PaddlePaddle库,在build开发镜像时下载Go依赖环境失败 Feb 26, 2018
@yeyupiaoling
Copy link
Contributor Author

yeyupiaoling commented Feb 26, 2018

@Xreki
我有使用过官方提供的,也卡住了如下,网络非常好的,我用的是百度深度学习集群

latest-dev-android: Pulling from paddlepaddle/paddle
8f7c85c2269a: Downloading 40.91 MB/40.91 MB
9e72e494a6dd: Download complete 
3009ec50c887: Download complete 
9d5ffccbec91: Download complete 
e872a2642ce1: Download complete 
570082195a8a: Downloading 13.49 MB/145.3 MB
0cdf10645261: Downloading 47.62 MB/47.62 MB
64027af0c9f9: Download complete 
4fbf912cad9c: Download complete 
885800e8dda3: Downloading 8.378 MB/8.378 MB
00b3792683ff: Downloading 820.6 MB/820.6 MB
read tcp 192.168.16.20:45956->54.230.212.81:443: read: connection reset by peer

有没有像编译源码http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/build_from_source_cn.html#build-options 这样选择不用GO语言的吗?

官方提供的docker容器有国内的吗?

@yeyupiaoling
Copy link
Contributor Author

@Xreki
我用其他链接解决的下载GO语言的问题,但是又出现

/paddle/paddle/scripts/docker/build_android.sh: line 2: $'\r': command not found
: invalid optioncripts/docker/build_android.sh: line 3: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/paddle/paddle/scripts/docker/build_android.sh: line 4: $'\r': command not found
/paddle/paddle/scripts/docker/build_android.sh: line 11: syntax error near unexpected token `else'
'paddle/paddle/scripts/docker/build_android.sh: line 11: `else # armeabi, armeabi-v7a

@Xreki
Copy link
Contributor

Xreki commented Feb 27, 2018

可暂时通过手动改源码的方式来解决这个问题,将

project(paddle CXX C Go)

改成project(paddle C CXX),然后Dockerfile.android中去掉

# Install Go and glide
RUN wget -qO- go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/gopath && \
mkdir /root/gopath/bin && \
mkdir /root/gopath/src
ENV GOROOT=/usr/local/go GOPATH=/root/gopath
# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin

Android实际并不依赖Go代码,我正在想办法去掉这个依赖,:smile:

@Xreki
Copy link
Contributor

Xreki commented Feb 27, 2018

我用其他链接解决的下载GO语言的问题,但是又出现

/paddle/paddle/scripts/docker/build_android.sh: line 2: $'\r': command not found
: invalid optioncripts/docker/build_android.sh: line 3: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/paddle/paddle/scripts/docker/build_android.sh: line 4: $'\r': command not found
/paddle/paddle/scripts/docker/build_android.sh: line 11: syntax error near unexpected token `else'
'paddle/paddle/scripts/docker/build_android.sh: line 11: `else # armeabi, armeabi-v7a

这个错不是构建Docker镜像的错误了啊。你Docker镜像已经成功构建了?
paddle/scripts/docker/build_android.sh你是不是在windows上打开编辑过?

@yeyupiaoling
Copy link
Contributor Author

yeyupiaoling commented Feb 27, 2018

@Xreki
应该是没有的,我一直都是在百度深度学习的集群上处理的,我重新试试
我只是下载到我电脑本地,再压缩上传到服务器的,中途没有编辑过

话说这个服务器clone 的PaddlePaddle速度超慢的
还有官方有没有提供国内的paddlepaddle/paddle:latest-dev-android镜像,我一直都pull不成功

@Xreki
Copy link
Contributor

Xreki commented Feb 27, 2018

还有官方有没有提供国内的paddlepaddle/paddle:latest-dev-android镜像,我一直都pull不成功

目前没有国内的镜像源。 @Yancey1989 我们可以将android开发镜像tag推送到国内镜像源docker.paddlepaddlehub.com/paddle吗?

@yeyupiaoling
Copy link
Contributor Author

我用其他链接解决的下载GO语言的问题,但是又出现

/paddle/paddle/scripts/docker/build_android.sh: line 2: $'\r': command not found
: invalid optioncripts/docker/build_android.sh: line 3: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/paddle/paddle/scripts/docker/build_android.sh: line 4: $'\r': command not found
/paddle/paddle/scripts/docker/build_android.sh: line 11: syntax error near unexpected token `else'
'paddle/paddle/scripts/docker/build_android.sh: line 11: `else # armeabi, armeabi-v7a

这个问题我解决的,果然是Windows的问题,我用git强制覆盖本地就行了

@yeyupiaoling
Copy link
Contributor Author

yeyupiaoling commented Feb 27, 2018

@Xreki

手动改源码的方式来解决这个问题

这个去掉Go语言的问题我也解决了,如果没有问题我就close issue了

@Yancey1989
如果可以,在这里回答一下可以吗?我急着用呢~

@Yancey1989
Copy link
Contributor

目前没有国内的镜像源。 @Yancey1989 我们可以将android开发镜像tag推送到国内镜像源docker.paddlepaddlehub.com/paddle吗?

Done, 可通过 docker pull docker.paddlepaddlehub.com/paddle:latest-dev-android 来从国内镜像源拉取镜像。

@Xreki
Copy link
Contributor

Xreki commented Feb 27, 2018

@Yancey1989 多谢了~

@yeyupiaoling
Copy link
Contributor Author

@Yancey1989 多谢了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User 用于标记用户问题
Projects
None yet
Development

No branches or pull requests

4 participants