ubuntu下openwrt23/24编译固件的报错的问题
Ubuntu 22.04.5 LTS 环境下,编译openwrt15 和openwrt23版本报错提示如下:
checking whether mknod can create fifo without root privileges... configure: error: in `/home/openwrt/openwrt23/openwrt-23.05.5/build_dir/host/tar-1.34': configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check) See `config.log' for more details make[3]: *** [Makefile:36: /home/openwrt/openwrt23/openwrt-23.05.5/build_dir/host/tar-1.34/.configured] Error 1 make[3]: Leaving directory '/home/openwrt/openwrt23/openwrt-23.05.5/tools/tar' time: tools/tar/compile#7.05#2.19#12.26 ERROR: tools/tar failed to build. make[2]: *** [tools/Makefile:226: tools/tar/compile] Error 1 make[2]: Leaving directory '/home/openwrt/openwrt23/openwrt-23.05.5' make[1]: *** [tools/Makefile:222: /home/openwrt/openwrt23/openwrt-23.05.5/staging_dir/host/stamp/.tools_compile_nyyynyynnnyyynynyyyyyyynyyynnynyynnynnyyyyyyyyyyyyyyyyynynnyyyyyyy] Error 2 make[1]: Leaving directory '/home/openwrt/openwrt23/openwrt-23.05.5'
错误原因
这个错误通常发生在以root用户身份运行配置脚本时。许多配置脚本会检查是否以root用户运行,因为以root用户运行可能会带来安全风险。如果配置脚本检测到以root用户运行,它会抛出错误并阻止继续配置。
解决方法
使用OpenWrt时,可以在make命令中添加FORCE_UNSAFE_CONFIGURE=1
:
make FORCE_UNSAFE_CONFIGURE=1