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

Add cross-compiling toolchain files for Android and Raspberry Pi. #1973

Merged
merged 20 commits into from
May 15, 2017

Conversation

Xreki
Copy link
Contributor

@Xreki Xreki commented May 3, 2017

  • 增加了交叉编译Android、Raspberry Pi的cmake toolchain文件,自动地设置编译器、编译参数。
  • 自动地编译host protobuf和target protobuf,OpenBLAS。

相关PR:#1698#1835

Copy link
Contributor

@hedaoyuan hedaoyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can use raspberry_pi.cmake compiler raspberry pi version. But if use the make j command, the compilation process may be interrupted due to the error.

#
# Also you can set CMAKE_C/CXX_COMPILER yourself, through cmake arguments.

IF(NOT RPI)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不需要判断吧,include(raspberry_pi.cmake)前已经判断了。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

每个toolchain file最开始都做了双重判断。留着保险一些吧。

@Xreki
Copy link
Contributor Author

Xreki commented May 4, 2017

@hedaoyuan Thank you for your try. I have reproduced the compiling error. It is because of the misuse of LIST(APPEND variable ...). Variables can not be modified in function using LIST(APPEND variable ... PARENT_SCOPE) like SET(variable ... PARENT_SCOPE). Thus the dependencies of protobuf_host and protobuf actually were not appended to external_project_dependencies. It is fixed in the latest commit and was tested using make -j12.

SET(COMMON_ARGS CC=${CMAKE_C_COMPILER} NO_LAPACK=1 NO_SHARED=1)

IF(ANDROID)
SET(OPENBLAS_COMMIT "b5c96fcfcdc82945502a2303116a64d89985daf5")
Copy link
Contributor

@gangliao gangliao May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用这个commit是什么原因呢 支持android?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenBLAS为支持softfp新开的一个分支arm_soft_fp_abi,主分支只支持hardfp,Android上运行有些问题。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

明白了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我加个注释说明一下吧~

ENDIF()
ENDIF()

# prefix and suffix on different os
IF(WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@gangliao gangliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xreki
Copy link
Contributor Author

Xreki commented May 15, 2017

@hedaoyuan 建议写一个如何编写交叉编译toolchain文件的设计文档,该文档将和如何交叉编译ARM版Paddle的使用文档一起,在下一个PR中提交。

@Xreki Xreki merged commit d76640c into PaddlePaddle:develop May 15, 2017
@Xreki Xreki added the Android label Sep 30, 2017
@Xreki Xreki deleted the cmake_protobuf branch November 14, 2018 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants