-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix compile on raspberry pi #1835
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有两个关于文档建议:
- 这个是关于编译的文档,是不是应该放在
getstarted/build_and_install
目录下 - 文档的用词是不是需要更书面化一些,然后,所有arm相关的编译文档都可以放在一个文件里面吧
|
||
这里考虑的是交叉编译方式,即在Linux-X86环境下构建raspberry pi下可运行的paddle。 | ||
|
||
## 下载较差编译环境 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: 较差 -> 交叉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getstarted目前定位是新手入门,这个文档放新手入门不是很合适。
所有arm相关的编译文档都可以放在一个文件里面吧
这个是可以的,后续有新的嵌入式相关的文档后,可以新增一个目录,将这个文档一并移过去。
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raspberry pi => Raspberry Pi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paddle => PaddlePaddle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle | |||
|
|||
这里考虑的是交叉编译方式,即在Linux-X86环境下构建raspberry pi下可运行的paddle。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X86 => x86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
|
||
## 编译第三方库 | ||
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库,不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库
==>
cmake会自动下载PaddlePaddle依赖的第三方库。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
|
||
## 编译第三方库 | ||
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库,不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。
为什么最好?和依赖cmake去下载和编译OpenBLAS和protobuf有什么区别?我理解这个工作应该是让在Raspberry
Pi上编译和在其他平台编译的用户体验尽量一致。如果可以依赖cmake去下载所有依赖,貌似更合理?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在交叉编译方式下,直接依赖cmake去下载和编译中间会断掉,不能一次cmake & make成功。比如,编译protobuf时编译出来的protoc
是arm版本的,在后续用到protoc的地方编译过程就崩溃了,需要用一个x86版本的protoc去替换掉,然后再继续make。
如果,直接在Pi编译,应该是直接cmake & make就可以了,不过编译耗时会比较长。
## 编译第三方库 | ||
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库,不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。 | ||
|
||
### 编译openblas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openblas => OpenBLAS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -26,7 +26,7 @@ FILE(GLOB PY_PADDLE_PYTHON_FILES ${PROJ_ROOT}/paddle/py_paddle/*.py) | |||
SET_SOURCE_FILES_PROPERTIES(Paddle.i PROPERTIES CPLUSPLUS ON) | |||
|
|||
SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}) | |||
SET(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Wall") | |||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wall") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
赞这个文档和code两全的PR!有一些建议都是针对文档写作的。 |
刚刚按照文档走了一下流程,在编译OpenBLAS和protobuf时出现了两个错误。
不过到这个时候, protobuf:
protobuf的编译依赖zlib。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照大家的约定,响应了reviwers的comemnts之后,应该至少写一个“Done”。这是对reviwers工作的尊重。
对 #1835 (review) 这批comments的响应都没有回复。
注意:这样编译出来的`libprotobuf.a`和`protoc`都是ARM版本的,而我们需要的是一个x86-64版本的`protoc`,所以需要用host gcc再编译一遍protobuf然后使用其中的`protoc`。 | ||
|
||
|
||
## 编译Paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paddle ==> PaddlePaddle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
抱歉,之前没有对comemnts回复,下次一定注意。
注意:这样编译出来的`libprotobuf.a`和`protoc`都是ARM版本的,而我们需要的是一个x86-64版本的`protoc`,所以需要用host gcc再编译一遍protobuf然后使用其中的`protoc`。 | ||
|
||
|
||
## 编译Paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,45 @@ | |||
# 如何构建raspberry pi下运行的paddle | |||
|
|||
这里考虑的是交叉编译方式,即在Linux-X86环境下构建raspberry pi下可运行的paddle。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
这里考虑的是交叉编译方式,即在Linux-X86环境下构建raspberry pi下可运行的paddle。 | ||
|
||
## 下载较差编译环境 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
|
||
## 编译第三方库 | ||
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库,不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
## 编译第三方库 | ||
Paddle在cmake会在编译paddle的时候自动编译依赖的第三方库,不过openblas和protobuf最好还是在编译paddle之前先编译好,这样可以保证编译paddle的时候更加顺畅。 | ||
|
||
### 编译openblas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Xreki #1835 (comment)
这两个问题,是否在 #1973 里面已经解决了?另外,应该基于 #1973 从新写一下这个文档是吗?
#1973 可以可以自动编译第三方库了(host、target的protobuf,opneblas),但是需要一些cmake配置告诉cmake正在交叉编译。cmake默认是配置了CMAKE_SYSTEM_NAME这个变量,就认为是在交叉编译。Android配置
在这个PR里改是不是不太合适? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,那这个PR就先这样,后续Build相关工作可以继续优化。
@wangkuiyi comemnts已经都回复了,请review一下。
No description provided.