1# 环境搭建和编译<a name="ZH-CN_TOPIC_0000001174215863"></a> 2 3- [环境配置](#section922419503415) 4- [代码编译](#section1166711064317) 5 6## 环境配置<a name="section922419503415"></a> 7 8Ubuntu版本要求18.04或20.04,详细环境搭建参考: 9 10[搭建Ubuntu环境](https://developer.huawei.com/consumer/cn/training/course/video/C101639988048536240) 11[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) 12 13## 代码编译<a name="section1166711064317"></a> 14 151. 首次编译: 16 17 ``` 18 ./build.sh --product-name hispark_taurus_standard 19 ``` 20 212. 首次编译后增量编译方舟运行时: 22 23 编译x64版本: 24 ``` 25 ./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages --build-target ark_ts2abc_build # arm平台和host端运行工具 26 ``` 27 28 编译arm64版本: 29 ``` 30 ./build.sh --product-name hispark_taurus_standard --gn-args use_musl=true --target-cpu arm64 --build-target ark_js_vm 31 ``` 32 33 编译arm32版本: 34 ``` 35 ./build.sh --product-name hispark_taurus_standard --build-target ark_js_runtime 36 ``` 37 383. 首次编译后增量编译方舟前端: 39 40 ``` 41 ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build 42 ``` 43 44**说明**:上述编译命令为release版本,且执行路径为项目根目录。编译debug版本需增加编译选项:--gn-args is_debug=true。 45 46方舟相关的二进制文件在如下路径: 47 48``` 49out/hispark_taurus/arkcompiler/runtime_core/ 50out/hispark_taurus/arkcompiler/ets_frontend/ 51out/hispark_taurus/arkcompiler/ets_runtime/ 52out/hispark_taurus/clang_x64/arkcompiler/runtime_core/ 53out/hispark_taurus/clang_x64/arkcompiler/ets_frontend/ 54out/hispark_taurus/clang_x64/arkcompiler/ets_runtime 55``` 56 57