Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL子系统编译buildroot填坑 #34

Open
Meekdai opened this issue Nov 7, 2023 · 0 comments
Open

WSL子系统编译buildroot填坑 #34

Meekdai opened this issue Nov 7, 2023 · 0 comments
Labels

Comments

@Meekdai
Copy link
Owner

Meekdai commented Nov 7, 2023

之前一直用Windows的子系统WSL用来编译micropython的固件,速度很快而且文件交互起来也很方便。buildroot体积比较大,之前一直都是在Githubcodespaces上编译,但是codespaces有存储大小限制,所以这里记录一下在WSL中编译buildroot遇到的一些坑。

填坑

  1. 报错 build/elf/librtld.os:raise.c:(.text+0x18bf4): more undefined references to 'rtld_errno' follow
    这个错误是WSL对于挂载的文件,也就是在/mnt/下的所有内容都不区分大小写导致的,所以需要把编译的路径放到/opt下即可。
$ getfattr -n system.wsl_case_sensitive /mnt/d
getfattr: Removing leading '/' from absolute path names
# file: mnt/d
system.wsl_case_sensitive="0"

$ getfattr -n system.wsl_case_sensitive /opt
getfattr: Removing leading '/' from absolute path names
# file: opt
system.wsl_case_sensitive="1"

参考链接1:glibc build errors with undefined references in files under elf/
参考链接2:Linker error

  1. 报错 fakeroot
fakeroot, while creating message channels: Function not implemented
This may be due to a lack of SYSV IPC support.
fakeroot: error while starting the `faked' daemon.
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
make: *** [fs/common.mk:87: /opt/buildroot/buildroot-2018.08.2/output/build/buildroot-fs/rootfs.common.tar] Error 1

据微软开发人员解释,目前WSL仅仅支持SYSV的信号量,消息队列还没有被实现(fakeroot需要SYSV的消息队列)。所以解决方案是使用fakeroot-tcp替换fakeroot

sudo apt-get install -y fakeroot
sudo cp -f /usr/bin/fakeroot-tcp output/host/usr/bin/fakeroot

如果是编译luckfox-pico项目,目前的V1.2版本需要修改文件luckfox-pico\sysdrv\tools\pc\mtd-utils\mkfs_ubi.sh,把两处的which fakeroot修改为which fakeroot-tcp,具体如下。

if which fakeroot-tcp; then
	FAKEROOT_TOOL="`which fakeroot-tcp`"
	echo "chown -h -R 0:0 $ROOTFS_SRC_DIR" >> $ROOTFS_IMAGE_FAKEROOT_UBI
else
	msg_warn "Install fakeroot First."
	msg_warn "   sudo apt-get install fakeroot"
	FAKEROOT_TOOL="NO_FOUND"
fi

参考链接1:Sysvipc message queues and fakeroot
参考链接2:Win10 WSL系统下编译buildroot报错不支持SYSV IPC,导致fakeroot无法正常工作

  1. How to remove Windows paths from WSL path
echo $PATH
$ sudo vi /etc/wsl.conf

[interop]
appendWindowsPath = false

修改后重启WSL,即可删除Windows上的环境变量

WSL指令

重启WSL
Restart-Service LxssManager

转换 WSL 版本2
wsl --set-version ubuntu-20.04 2

列出可用的 Linux 发行版本
wsl --list --online

列出已安装的 Linux 发行版本
wsl --list --verbose

关机
wsl --shutdown

注销或卸载 Linux 发行版
wsl --unregister <DistributionName>

安装指定 Linux 发行版
wsl --install --distribution Ubuntu-22.04

运行指定 Linux 发行版
wsl --distribution Ubuntu-22.04

设置默认 Linux 发行版
wsl --set-default Ubuntu-22.04

参考链接1:WSL 的基本命令

@Meekdai Meekdai added the 软件 label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant