本文主要记录在WSL环境下搭建XR806开发环境的过程中遇到的一些问题,如果后续大家有遇到类似问题可以参考;有部分地方的解决方法不一定是最好的,有些步骤也不一定是必要的,经过多次尝试和资料查询才最终解决,因此没有特地去复现问题并尝试最终有效的那一个或者几个操作。最开始我用的是virtualbox+ubuntu,后来搞出很多问题,无意中在群里面看到有大佬在说WSL,第一次听说有这东西,于是赶紧上网查了一下,然后在网络的前辈们的指导下装好了WSL以及ubuntu,这个过程中还升级了windows的版本,差点被一个贴子带偏重装系统,还好没这么干,下面是我装好WSL和ubuntu后在搭建XR806开发环境的过程中遇到的一些典型问题,本文仅供参考。
1、repo init命令出现fork_flow错误,如下:
jackie@USER-20200124ZG:~$ repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify
Downloading Repo source from http://mirrors.tuna.tsinghua.edu.cn/git/git-repo/
remote: Enumerating objects: 7113, done.
remote: Counting objects: 100% (7113/7113), done.
remote: Compressing objects: 100% (3728/3728), done.
remote: Total 7113 (delta 4590), reused 5464 (delta 3311)s s
Receiving objects: 100% (7113/7113), 3.09 MiB | 1.76 MiB/s, done.
Resolving deltas: 100% (4590/4590), done.
repo: warning: verification of repo code has been disabled;
repo will not be able to verify the integrity of itself.
repo: error: unable to resolve "fork_flow"
fatal: cloning the git-repo repository failed, will remove '.repo/repo'
解决措施:切换到root权限执行,命令“sudo su”,然后再输入密码就行了,如果需要再切回原用户目录使用命令“su <用户名>”。
2、同步源码错误
error: Unable to fully sync the tree.
error: Downloading network changes failed.
Try re-running with "-j1 --fail-fast" to exit at the first error.
解决措施:增加--fail-fast,然后就没有错误了,具体意思不太清楚,是在网上的某个贴子里看到的
robot@ubuntu:~/aosp81$ repo sync -j1 --fail-fast
Fetching: 26% (156/592) platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
3、repo forall -c 'git lfs pull' 错误
root@USER-20200124ZG:/home/jackie/xr806_openharmony# repo forall -c 'git lfs pull'
git: 'lfs' is not a git command. See 'git --help'.
The most similar command is
log
git: 'lfs' is not a git command. See 'git --help'.
The most similar command is
log
git: 'lfs' is not a git command. See 'git --help'.
解决措施:可以参考github - git: 'lfs' is not a git command unclear - Stack Overflow安装一个工具
root@USER-20200124ZG:/home/jackie/xr806_openharmony# curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
Detected operating system as Ubuntu/bionic.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
root@USER-20200124ZG:/home/jackie/xr806_openharmony# sudo apt-get install git-lfs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
git-lfs
0 upgraded, 1 newly installed, 0 to remove and 161 not upgraded.
Need to get 6526 kB of archives.
After this operation, 14.7 MB of additional disk space will be used.
Get:1 https://packagecloud.io/github/git-lfs/ubuntu bionic/main amd64 git-lfs amd64 3.0.2 [6526 kB]
Fetched 6526 kB in 24s (268 kB/s)
Selecting previously unselected package git-lfs.
(Reading database ... 35599 files and directories currently installed.)
Preparing to unpack .../git-lfs_3.0.2_amd64.deb ...
Unpacking git-lfs (3.0.2) ...
Setting up git-lfs (3.0.2) ...
Git LFS initialized.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@USER-20200124ZG:/home/jackie/xr806_openharmony#
4、安装必要的文件和库的时候出现错误 Unable to locate package libc6-dev-amd64
root@USER-20200124ZG:/home/jackie/xr806_openharmony# sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi cpio device-tree-compiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'zlib-bin' for glob 'zlib*'
Note, selecting 'zlib-gst' for glob 'zlib*'
Note, selecting 'zlib1g' for glob 'zlib*'
Note, selecting 'zlib1' for glob 'zlib*'
Note, selecting 'zlibc' for glob 'zlib*'
Note, selecting 'zlib1g-dbg' for glob 'zlib*'
Note, selecting 'zlib1g-dev' for glob 'zlib*'
Note, selecting 'zlib1-dev' for glob 'zlib*'
E: Unable to locate package libc6-dev-amd64
解决措施:
1、直接去掉libc6-dev-amd64,不安装这个,目前跑了几个例程,暂时没发现有什么影响;
2、看到有同学说去掉后面的-amd64就可以了,我没试过,如果有遇到这个问题的同学可以试试看;
5、llvm安装错误
jackie@USER-20200124ZG:~/llvm$ tar -zxvf llvm.tar -C ~/
tar (child): llvm.tar: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
jackie@USER-20200124ZG:~/llvm$ tar -zvf llvm-linux-9.0.0-36191.tar -C ./
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.
解决措施:更换了解压命令
root@USER-20200124ZG:/home/jackie/llvm# tar -xvf llvm-linux-9.0.0-36191.tar
llvm/
llvm/lib/
llvm/lib/libLLVM.so
llvm/lib/libclang.so.9
llvm/lib/libclang-cpp.so.9
6、make menuconfig报错
jackie@USER-20200124ZG:~/xr806_openharmony/device/xradio/xr806/xr_skylark$ sudo make menuconfig
make[1]: Entering directory '/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark/tools/config'
HOSTLD build/mconf.o
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
chmod: cannot access 'mconf': No such file or directory
Makefile:27: recipe for target 'mconf' failed
make[1]: *** [mconf] Error 1
make[1]: Leaving directory '/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark/tools/config'
/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark
tools/config/mconf ./Kconfig
make: tools/config/mconf: Command not found
Makefile:124: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 127
解决措施:安装libncurses5-dev
jackie@USER-20200124ZG:~/xr806_openharmony/device/xradio/xr806/xr_skylark$ sudo apt install libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libtinfo-dev
Suggested packages:
ncurses-doc
The following NEW packages will be installed:
libncurses5-dev libtinfo-dev
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
Need to get 256 kB of archives.
After this operation, 1422 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libtinfo-dev amd64 6.1-1ubuntu1.18.04 [81.3 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libncurses5-dev amd64 6.1-1ubuntu1.18.04 [174 kB]
Fetched 256 kB in 1s (181 kB/s)
Selecting previously unselected package libtinfo-dev:amd64.
(Reading database ... 56605 files and directories currently installed.)
Preparing to unpack .../libtinfo-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libtinfo-dev:amd64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libncurses5-dev:amd64.
Preparing to unpack .../libncurses5-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up libtinfo-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
jackie@USER-20200124ZG:~/xr806_openharmony/device/xradio/xr806/xr_skylark$ sudo make menuconfig
make[1]: Entering directory '/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark/tools/config'
HOSTLD build/mconf.o
make[1]: Leaving directory '/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark/tools/config'
/home/jackie/xr806_openharmony/device/xradio/xr806/xr_skylark
tools/config/mconf ./Kconfig
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
python config.py
7、关于代码下载
XR806代码的device和vendor两部分可以用git clone命令直接下载,比repo好用
8、关于vscode连接远程库进行开发
可以参考以下链接,写的很详细:https://aijishu.com/a/1060000...
9、关于window和ubuntu文件交互
在ubuntu下可以用cd命令访问到Windows下的盘符,这样直接可以用cp命令进行文件传输,windows的盘符挂载到了 /mnt/,如下操作是将编译出的img文件拷贝到windows的d盘根目录下;你也可以cd到/mnt/下用ls命令查看盘符
# cp xr_system.img /mnt/d/
在这个过程中还遇到了各种各样的小问题,最后通过网上查资料解决了,没有一一记录,这个过程是比较煎熬的,但是我想说不管怎样,不要放弃,每天都去弄一下,查资料、论坛求助、微信、qq群求助都可以,问题总会解决的;经过这一段的折腾,环境算是可以运行了,万里长征走完了第一步,接下来要好好琢磨做点应用了。