试着给Newifi3 D2编译LEDE固件,图省事在WSL 1的Ubuntu 18.04跑,结果踩了几个坑。
make
过程中提示sleep: cannot read realtime clock: Invalid argument
参阅 https://github.com/microsoft/WSL/issues/4898#issuecomment-586512514 ,其中给出的原因是WSL 1的
glibc
没有为nanosleep 6函数实现CLOCK_REALTIME
系统调用:An example of the WSL team continuing to service WSL 1 for now is a patch for issue 4989 384. Issue 4989 arises from a patch in glibc 2.31 49 that implements a nanosleep() library call in a more UNIX-like manner 26 based on CLOCK_REALTIME. Emulating UNIX system clocks on an NT kernel is tricky. WSL 1 implemented the most popular clock-based system calls, but not all of them, and did not build CLOCK_REALTIME support into nanosleep 6. But because this is such a fundamental change in glibc the WSL team is very graciously implementing support for CLOCK_REALTIME in nanosleep in WSL 1 and will be backporting it in updates to existing builds. This is a challenging task that will take some time. In contrast, other more obscure system clock calls, like the one raised in issue 4973 106, will likely not see implementation in WSL 1.
我选择了添加PPA的workaround,添加完之后似乎还不work。
之后找到了 https://github.com/microsoft/WSL/issues/4898#issuecomment-624450947 ,这位提供了直接下载deb包安装
glibc
的方式:I solved it by downloading and manually installing the patched package:
Other files from the same repository can be found here: https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+build/19152555
It's still [@rafaeldtinoco](https://github.com/rafaeldtinoco) 's PPA after all but saves some mess adding APT repositories or so.
1
2wget "https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+build/19152555/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb"
sudo dpkg -i libc6_2.31-0ubuntu8+lp1871129~1_amd64.debThanks Rafael and Christian!
make
过程中提示find: The relative path 'Files' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find. Please remove that entry from $PATH
WSL与Windows共享
PATH
环境变量,make
工具在Windows的PATH
中寻找不到所需文件所以报错。在WSL中执行source /etc/environment
,将WSL的环境变量重置为Ubuntu的默认值即可。