安装编译所需的程序包。 安装命令:
-
安装方式一:使用脚本,在当前工程目录执行
./build/build_scripts/env_setup.sh -
安装方式二:apt-get和pip3 install命令安装
apt-get update -y apt-get install -y # 如果是ubuntu20.04系统请直接安装python3.9,如果是ubuntu18.04请改为安装python3.8 apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.9 python3-pip git zip unzip curl wget gcc g++ ruby dosfstools mtools default-jre default-jdk scons python3-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev apt-get install -y grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5 libncurses5-dev libncursesw5 libstdc++6 gcc-arm-none-eabi vim ssh locales doxygen apt-get install -y libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev # python需要安装以下模块,repo文件在上一章节约束与限制的源码获取中得到。 chmod +x /usr/bin/repo pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple requests setuptools pymongo kconfiglib pycryptodome ecdsa ohos-build pyyaml prompt_toolkit==1.0.14 redis json2html yagmail python-jenkins pip3 install esdk-obs-python --trusted-host pypi.org pip3 install six --upgrade --ignore-installed six #还需要安装llvm,hc-gen,gcc_riscv32,Ninja,node-v14.15.4-linux-x64,GN,如果用户使用的shell环境不是bash或者zsh的配置,则需要配置以下环境变量: # export PATH=/home/tools/llvm/bin:$PATH # export PATH=/home/tools/hc-gen:$PATH # export PATH=/home/tools/gcc_riscv32/bin:$PATH # export PATH=/home/tools/ninja:$PATH # export PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH # export PATH=/home/tools/gn:$PATH # export PATH=~/.local/bin:$PATH注意:上述安装ohos-build的过程中会安装编译工具hb,但有时会出现hb安装不成功的情况,若安装不成功,则按照hb安装重新安装。
[OHOS ERROR] [1067/12148] ACTION //arkcompiler/ets_frontend/es2panda:gen_keywords_headers(//build/toolchain/linux:clang_x64)
[OHOS ERROR] FAILED: clang_x64/obj/arkcompiler/ets_frontend/es2panda/gen/keywordsMap.h
[OHOS ERROR] /usr/bin/env ../../arkcompiler/ets_frontend/es2panda/scripts/gen_keywords.sh -g /home/xxf/ohos/arkcompiler/ets_frontend/es2panda/lexer/scripts/keywords.rb -t ../../arkcompiler/ets_frontend/es2panda/lexer/templates/keywordsMap.h.erb -o keywordsMap.h -d /home/xxf/ohos/out/sdk/clang_x64/obj/arkcompiler/ets_frontend/es2panda/gen
[OHOS ERROR] ../../arkcompiler/ets_frontend/es2panda/scripts/gen_keywords.sh: line 46: ruby: command not found
安装 ruby
sudo apt-get install ruby
[OHOS ERROR] /usr/bin/env: ‘/usr/bin/bison’: No such file or directory
安装 bison
sudo apt-get install bison
[OHOS ERROR] /usr/bin/env: ‘/usr/bin/flex’: No such file or directory
安装 flex
sudo apt-get install flex