wsl编译openwrt时mklibs报错的解决方案

首次编译报错:

  File "./lede/staging_dir/host/bin/mklibs", line 60
    print string.join(msg)
               ^
SyntaxError: invalid syntax
package/Makefile:65: recipe for target 'package/install' failed
make[2]: *** [package/install] Error 1
make[2]: Leaving directory './lede'
package/Makefile:108: recipe for target './lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_install' failed
make[1]: *** [./lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory './lede'
./lede/include/toplevel.mk:225: recipe for target 'world' failed
make: *** [world] Error 2

是由于调用了python3所致。修改./lede/staging_dir/host/bin/mklibs的第一行为

#!/usr/bin/python

即可。

重新编译后又报错:

I: Using /lib/ld-musl-mipsel-sf.so.1 as dynamic linker.
warning: ./lede/staging_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/libhistory.so.8.0 may need rpath, but --root not specified
warning: ./lede/staging_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/libreadline.so.8.0 may need rpath, but --root not specified
I: library reduction pass 1
Traceback (most recent call last):
  File "./lede/staging_dir/host/bin/mklibs", line 511, in <module>
    for symbol in provided_symbols(lib):
  File "./lede/staging_dir/host/bin/mklibs", line 209, in provided_symbols
    raise Exception("Cannot find lib" + obj)
Exception: Cannot find lib/lib/ld-musl-mipsel-sf.so.1
package/Makefile:65: recipe for target 'package/install' failed
make[2]: *** [package/install] Error 1
make[2]: Leaving directory './lede'
package/Makefile:108: recipe for target './lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_install' failed
make[1]: *** [./lede/staging_dir/target-mipsel_24kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory './lede'
./lede/include/toplevel.mk:225: recipe for target 'world' failed
make: *** [world] Error 2

是由于编译所用有关工具在windows下返回值有误,导致make误以为出错而终止。使用:

make -j1 -i V=s

从而跳过失败位置,继续编译成功。
另外推测还有一种可能是WSL的环境变量设置有误,具体修复可参考wsl ubuntu使用openwrt稳定版固件编译lean

你可能感兴趣的:(lede,linux,makefile,openwrt,路由器,ubuntu)