记录ubuntu 14.04编译鸿蒙OS

源码下载

配置git

git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store

下载repo和源码

repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c git lfs pull

安装nodejs npm

提示python版本过低,安装管理多个python版本

1.查看python有哪些版本使用命令

whereis python

如果安装Python3以上之后,使用pip命令出现了问题,提示说找不到ssl模块 首先安装openssl sudo apt-get install openssl sudo apt-get install libssl-dev

编译安装3.6.2 wget获取安装包: wget http://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz 解压安装包: tar -xvzf Python-3.6.2.tgz 检查安装平台属性,系统是否有编译时所需要额库,以及库的版本是否满足编译需要,添加ssl支持 ./configure --with-ssl 编译源码 make -j3

成功编译之后,安装 sudo make install

2.这么多版本如何切换呢

使用 sudo update-alternatives --install <link> <name> <path> <priority>

link:指向/etc/alternatives/<name>的符号引用

name:这个链接组的名称

path:这个命令对应的可执行文件的实际路径

priority:优先级,在auto模式下,数字较大的选项有较高的优先级

例如

sudo update-alternatives --install /usr/local/bin/python python /usr/local/bin/python3.6 2

添加完后

sudo update-alternatives --list python 查看结果

sudo update-alternatives --config python 来选择python版本

./build/prebuilts_download.sh下载工具的链

如果此时编译会提示编译器版本低,14.04 自带的gcc-4.8版本较低需要升级

相关场景:在做某个操作时提示“/lib64/libstdc++.so.6: version `GLIBCXX_3.4.22 not found” gcc官方下载网址: 下载gcc源码包 安装过程:此过程比较长

tar -jxvf gcc-6.1.0.tar.bz2 cd gcc-6.1.0 ./contrib/download_prerequisites mkdir build cd build ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib make -j3 sudo make install

升级完成后,系统还是使用旧版本的gcc,需要再进行以下操作:

否则编译./build.sh --product-name Hi3516DV300提示依赖GLIBCXX_3.4.21

centos 是如下操作

cp /usr/local/lib64/libstdc++.so.6.0.22 /lib64 cd /lib64 rm -rf libstdc++.so.6 ln -s libstdc++.so.6.0.22 libstdc++.so.6

此时执行如下命令就行可以看到GLIBCXX_3.4.22了:

strings /lib64/libstdc++.so.6 | grep GLIBC

ubuntu是如下操作

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC

重建软链接

sudo rm -r /usr/lib/x86_64-linux-gnu/libstdc++.so.6

sudo ln -s /usr/local/lib64/libstdc++.so.6.0.22 libstdc++.so.6

这步要sure 对,否则会找不到c++库影响系统

经验分享 程序员 微信小程序 职场和发展