#### 问题一

1、问题描述

使用`root`用户编译，错误提示：

```
Do not use Bitbake as root.
```

2、解决方法

修改文件：

```
openembedded-core/meta/classes/sanity.bbclass
```

修改内容：

```
-    if 0 == os.getuid():
-        raise_sanity_error("Do not use Bitbake as root.", d)
+    #if 0 == os.getuid():
+        #raise_sanity_error("Do not use Bitbake as root.", d)
```

#### 问题二

1、问题描述

根据开发机器工具链存储位置，设置交叉编译工具链。

2、解决方法

修改代码仓：

```
meta-riscv
```

提交`commit ID`:

```
e24b5064086ee9d496cd06f603b2f8f13856e1ba
```

#### 问题三

1、问题描述
`ltp`编译时，提示无法找到`rpc/rpc.h`。

2、解决方法

```
vim  openembedded-core/meta/recipes-extended/ltp/ltp_20200930.bb +80
do_compile_prepend(){
	cp -r ${EXTERNAL_TOOLCHAIN_SYSROOT}/usr/include/rpc ${STAGING_DIR_HOST}/usr/include
}
```

#### 问题四

1、问题描述

`xhost`编译时，提示无法找到`rpc/rpc.h`。

2、解决方法

修改代码仓：

```
openembedded-core
```

提交`commit ID`:

```
499b74d0934f5f088facfe04477a14a22b52e2d5
```

#### 问题五

1、问题描述

`man-db`编译报错如下:

```
configure: error: flex is required when building from revision control
WARNING: /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499:292 exit 1 from 'exit 1'
WARNING: Backtrace (BB generated script): 
        #1: bbfatal_log, /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499, line 292
        #2: oe_runconf, /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499, line 255
        #3: autotools_do_configure, /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499, line 239
        #4: do_configure, /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499, line 151
        #5: main, /home/run/code/riscv_yocto_new/thead-build/ice-xfce/tmp-glibc/work/riscv64-oe-linux/man-db/2.9.3-r0/temp/run.do_configure.90499, line 306

Backtrace (metadata-relative locations):
        #1: bbfatal_log, /home/run/code/riscv_yocto_new/openembedded-core/meta/classes/logging.bbclass, line 72
        #2: oe_runconf, /home/run/code/riscv_yocto_new/openembedded-core/meta/classes/autotools.bbclass, line 96
        #3: autotools_do_configure, /home/run/code/riscv_yocto_new/openembedded-core/meta/classes/autotools.bbclass, line 236
        #4: do_configure, autogenerated, line 2
Currently  1 running tasks (2301 of 2309)  99% |########################################################################################################################################### |
0: man-db-2.9.3-r0 do_configure - 1m7s (pid 90499)
```

2、解决方法

修改代码仓：

```
openembedded-core
```

提交`commit ID`:

```
cb5990111a990dfdb8510b81409cc0f945327e7f
```

#### 问题六

1、问题描述

`gcc`编译报错如下：

```
ERROR: gcc-10.2.0-r0 do_package: QA Issue: gcc: Files/directories were installed but not shipped in any package:
  /usr/bin/riscv64-oe-linux-riscv64-linux-g++
  /usr/bin/riscv64-oe-linux-gcc-10.2.0
  /usr/bin/riscv64-oe-linux-riscv64-linux-gcc-ar
  /usr/bin/riscv64-oe-linux-riscv64-linux-gcc-nm
  /usr/bin/riscv64-oe-linux-riscv64-linux-gcc-ranlib
  /usr/bin/riscv64-oe-linux-riscv64-linux-gcc
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
gcc: 6 installed and not shipped files. [installed-vs-shipped]
ERROR: gcc-10.2.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: Logfile of failure stored in: /home/run/code/riscv_yocto_new/thead-build/ice-base/tmp-glibc/work/riscv64-oe-linux/gcc/10.2.0-r0/temp/log.do_package.56143
ERROR: Task (/home/run/code/riscv_yocto_new/openembedded-core/meta/recipes-devtools/gcc/gcc_10.2.bb:do_package) failed with exit code '1'
```

2、解决方法

修改代码仓：

```
openembedded-core
```

提交`commit ID`:

```
5a3e40720c904174e17a237e652d844cf932f12b
```

#### 问题七

1、问题描述

编译`gstreamer`时，不同`license`导致出错如下：

```
ERROR: Nothing RPROVIDES 'faac' (but /home/run/code/riscv_yocto_new/meta-openembedded/meta-xfce/recipes-core/images/core-image-xfce.bb RDEPENDS on or otherwise requires it)
faac was skipped: because it has a restricted license 'commercial'. Which is not whitelisted in LICENSE_FLAGS_WHITELIST
NOTE: Runtime target 'faac' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['faac']
ERROR: Required build target 'core-image-xfce' has no buildable providers.
Missing or unbuildable dependency chain was: ['core-image-xfce', 'faac']
```

2、解决方法

`thead-build/ice-xfce/conf/local.conf`文件增加：

```
LICENSE_FLAGS_WHITELIST="commercial"
```

#### 问题八

1、问题描述

编译`XFCE`映像时，出错如下：

```
ERROR: Nothing RPROVIDES ‘apte2fsprogs-resize2fs’(but ../meta-openembedded/meta-xfce/recipes-core/images/core-image-xfce.bb RDEPENDS on or otherwise requires it)
```

2、解决方法

`thead-build/ice-xfce/conf/local.conf`文件修改：

```
IMAGE_INSTALL_append = " e2fsprogs-resize2fs "
```

注意`e2fsprogs-resize2fs`前面需要加空格。

#### 问题九

1、问题描述
`GNOME`桌面加入`packagegroup-gnome-desktop.bb`会导致编译的时候`polkit`和`gobject-introspection-data`报错。

2、解决方法

修改代码仓：

```
meta-riscv
```

提交`commit ID`:

```
02a7d446b6422cccd537bbd079c770793384041e
```

#### 问题十（继续跟踪）

1、问题描述

在`core-image-xfce.bb`文件中添加`ffmpeg`和`gstreamer`的各种插件之后，使用如下命令可以播放`mpeg4`的视频。

```
gst-play-1.0 oceans_mpeg4.mp4 --videosink fbdevsink
```

目前无法播放`h264`的视频，因为`ffmpeg`解码的时候会报段错误`Segmentation fault`。

2、解决方法

替换http://ftp.ports.debian.org/debian-ports/pool-riscv64/main/f/ffmpeg/下的`libavcodec.so`及其依赖库，增加`ld-linux-riscv64-lp64d.so.1`，可以解码`h264`.

#### 问题十一

1、问题描述

基于`XFCE`映像，`apt-get update` 提示：

```
gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
```

2、解决方法

在`meta-openembedded/meta-xfce/recipes-core/images/core-image-xfce.bb`文件中增加：

```
IMAGE_INSTALL += " gpgme gnupg"
```

#### 问题十二

1、问题描述

`XFCE`桌面环境下，`apt-get upgrade`后，`ls`命令不可用。
`apt-get update`使用前需要配置：

```
resize2fs /dev/mmcblk0p3
cd /etc/apt
vi source.list  ##增加下面的源
deb http://mirrors.aliyun.com/debian-ports sid main
deb http://mirrors.aliyun.com/debian-ports unreleased main
deb http://mirrors.aliyun.com/thead/debian-riscv64 sid main
cd /etc/apt/trusted.gpg.d/
tftp -g -r thead-repo.gpg 192.168.1.114                   #PC IP, *.gpg 从buildroot版本的debian-rootfs.ext4中获取
tftp -g -r debian-ports-archiv 192.168.1.114
```

2、解决方法

原因：目前更新的`deb`包使用的工具链和现有`Yocto`项目编译的工具链不匹配导致。

方法：使用同一个工具链编译，然后制作源，更新即可。

#### 问题十三

1、问题描述

`apt-get update `提示：

```
"No sandbox user '_apt' on the system, can not drop privileges"
```

2、解决方法

修改代码仓：

```
openembedded-core
```

提交`commit ID`:

```
fdf4b62947c2a22e304dba68ead4943ce2a07ea4
```

#### 问题十四

1、问题描述

```
apt-get install提示下列warning：
dpkg: error processing package xxx 或 assuming package has no files currently installed
```

2、解决方法

使用`buildroot`版本的`/sbin/ldconfig`替换后，相关`warning`消失。

#### 问题十五

1、问题描述

`apt-get install`安装无签名`deb`包时，提示`Error`如下:

```
no Release file
```

2、解决方法

测试时，使用如下命令:

```
apt-get update --allow-insecure-repositories
```

#### 问题十六（需要跟踪）

1、问题描述

`ldconfig`提示非法指令：

```
ldconfig[533]: unhandled signal 4 code 0x1 at 0x000000000002b06c in ldconfig[10000+6b000]
…
Illegal instruction
```

2、解决方法

在系统启动后，使用`buildroot`版本的`/sbin/ldconfig`替换现有版本的`/sbin/ldconfig`，目前怀疑是工具链问题。

#### 问题十七

1、问题描述

`evolution-data-server`配置错误：

```
-- Checking for module 'sqlite3>=3.7.17'
--   Found sqlite3, version 3.33.0
-- Checking for module 'libgdata>=0.15.1'
--   No package 'libgdata' found
CMake Error at cmake/modules/PkgConfigEx.cmake:32 (message):
  Necessary libraries not found or not enough version.  If you want to
  disable Google, please use -DENABLE_GOOGLE=OFF argument to cmake command.
Call Stack (most recent call first):
  CMakeLists.txt:786 (pkg_check_modules_for_option)
```

2、解决方法

修改代码仓：

```
meta-openembedded
```

提交`commit ID`:

```
10a7ec7caa90512b642962ef91dfdce9baf0d152
```

#### 问题十八

1、问题描述

`bitbake core-image-gnome -c populate_sdk`编译报错，信息如下：

```
1. binutils-external-cross-canadian.bb:do_install错误：
| ln: failed to create symbolic link '/home/lqg/al_yocto/temp/riscv_yocto/thead-build/ice-gnome/tmp-glibc/work/x86_64-nativesdk-oesdk-linux/binutils-external-cross-canadian-riscv64/2.32-r0/image/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/riscv64-linux-ld.bfd': File exists
```

2、解决方法

修改代码仓：

```
meta-external-toolchain
```

提交`commit ID`:

```
933f57e865ca0ac56c69adbb984d5e68dc068683
```

#### 问题十九

1、问题描述

`gdb-external-cross-canadian.bb`编译错误，信息如下：

```
ERROR:gdb-external-cross-canadian-riscv64-8.2.50.20190202-git-r0 do_package: QA Issue: gdb-external-cross-canadian-riscv64: Files/directories were installed but not shipped in any package:
  /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/riscv64-linux
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
gdb-external-cross-canadian-riscv64: 1 installed and not shipped files. [installed-vs-shipped]
```

2、解决方法

修改代码仓：

```
meta-external-toolchain
```

提交`commit ID`:

```
933f57e865ca0ac56c69adbb984d5e68dc068683
```

#### 问题二十

1、问题描述

`webkitgtk`编译错误如下：

```
In file included from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-48.cpp:8:
 /home/lqg/al_yocto/temp/riscv_yocto/thead-build/ice-gnome/tmp-glibc/work/riscv64-oe-linux/webkitgtk/2.30.2-r0/webkitgtk-2.30.2/Source/WebCore/platform/network/ResourceResponseBase.cpp: In      member function 'void WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting()':
 /home/lqg/al_yocto/temp/riscv_yocto/thead-build/ice-gnome/tmp-glibc/work/riscv64-oe-linux/webkitgtk/2.30.2-r
```

注：`webkiggtk`编译时间很长，如果编译不过，需要扩大`swap`分区。

2、解决方法

修改代码仓：

```
meta-riscv
```

提交`commit ID`:

```
7d22565122cc58a80bc74cf8937b3b46499c24ce
```