sunsili 发表于 2023-6-6 22:17:02

【openwrt】openwrt编译错误解决经验总结

本帖最后由 sunsili 于 2023-6-6 22:22 编辑

【openwrt】openwrt编译错误解决经验总结

前言
openwrt开发环境搭建请参阅:【openwrt学习笔记一】从搭建编译环境到编译openwrt全过程-谷动谷力 (sunsili.com)

直接多线程编译
make -j10
   ERROR: package/feeds/packages/glib2 failed to build.
    ERROR: package/feeds/packages/gnutls failed to build.

不出错话,这样最好最快,编译日志少。

单线程编译
出错话,编译日志信息太少
改用:
makeV=s(单线程,多线程简单出错,不知道哪里出错了)
编译会出现
库(模块)下载失败

例:
curl: (28) Connection timed out after 20001 milliseconds
Download failed.
+ curl -f --connect-timeout 20 --retry 5 --location --insecure https://sources.cdn.openwrt.org/gnutls-3.7.1.tar.xz


下载gnutls-3.7.1.tar.xz失败
手动下载
参看GnuTLS-3.7.1 (linuxfromscratch.org)

cd dl
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.1.tar.xz

警告当错误不能通过
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_chartables.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_chartables.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_chartables.c.o -MF glib/pcre/libpcre.a.p/pcre_chartables.c.o.d -o glib/pcre/libpcre.a.p/pcre_chartables.c.o -c ../glib/pcre/pcre_chartables.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_chartables.c:25:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_config.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_config.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_config.c.o -MF glib/pcre/libpcre.a.p/pcre_config.c.o.d -o glib/pcre/libpcre.a.p/pcre_config.c.o -c ../glib/pcre/pcre_config.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_config.c:49:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_fullinfo.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_fullinfo.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_fullinfo.c.o -MF glib/pcre/libpcre.a.p/pcre_fullinfo.c.o.d -o glib/pcre/libpcre.a.p/pcre_fullinfo.c.o -c ../glib/pcre/pcre_fullinfo.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_fullinfo.c:47:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
echo "libwolfssl" >> /home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/pkginfo/wolfssl.default.install
Compiling C object glib/pcre/libpcre.a.p/pcre_jit_compile.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_jit_compile.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_jit_compile.c.o -MF glib/pcre/libpcre.a.p/pcre_jit_compile.c.o.d -o glib/pcre/libpcre.a.p/pcre_jit_compile.c.o -c ../glib/pcre/pcre_jit_compile.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_jit_compile.c:45:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
make: Leaving directory '/home/fan/openwrt_21.02.0_mt76x8_jotale_source/package/libs/wolfssl'
time: package/libs/wolfssl/compile#0.27#0.05#0.38
Compiling C object glib/pcre/libpcre.a.p/pcre_newline.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_newline.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_newline.c.o -MF glib/pcre/libpcre.a.p/pcre_newline.c.o.d -o glib/pcre/libpcre.a.p/pcre_newline.c.o -c ../glib/pcre/pcre_newline.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_newline.c:52:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_ord2utf8.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_ord2utf8.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_ord2utf8.c.o -MF glib/pcre/libpcre.a.p/pcre_ord2utf8.c.o.d -o glib/pcre/libpcre.a.p/pcre_ord2utf8.c.o -c ../glib/pcre/pcre_ord2utf8.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_ord2utf8.c:46:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_globals.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_globals.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_globals.c.o -MF glib/pcre/libpcre.a.p/pcre_globals.c.o.d -o glib/pcre/libpcre.a.p/pcre_globals.c.o -c ../glib/pcre/pcre_globals.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_globals.c:57:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_string_utils.c.o
FAILED: glib/pcre/libpcre.a.p/pcre_string_utils.c.o
mipsel-openwrt-linux-musl-gcc -Iglib/pcre/libpcre.a.p -Iglib/pcre -I../glib/pcre -I. -I.. -Iglib -I../glib -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libiconv-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/target-mipsel_24kc_musl/usr/lib/libintl-stub/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -Os -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/home/fan/openwrt_21.02.0_mt76x8_jotale_source/build_dir/target-mipsel_24kc_musl/glib-2.66.4=glib-2.66.4 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -ffunction-sections -fdata-sections -fPIC '-DG_LOG_DOMAIN="GLib-GRegex"' -DHAVE_MEMMOVE -DSUPPORT_UCP -DSUPPORT_UTF -DSUPPORT_UTF8 -DNEWLINE=-1 -DMATCH_LIMIT=10000000 -DMATCH_LIMIT_RECURSION=8192 -DMAX_NAME_SIZE=32 -DMAX_NAME_COUNT=10000 -DMAX_DUPLENGTH=30000 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DPCRE_STATIC -UBSR_ANYCRLF -UEBCDIC -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/pcre/libpcre.a.p/pcre_string_utils.c.o -MF glib/pcre/libpcre.a.p/pcre_string_utils.c.o.d -o glib/pcre/libpcre.a.p/pcre_string_utils.c.o -c ../glib/pcre/pcre_string_utils.c
In file included from ../glib/pcre/pcre_internal.h:110,
               from ../glib/pcre/pcre_string_utils.c:47:
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'snprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:101:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
^~~~~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h: In function 'sprintf':
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:110:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
   ^~~
/home/fan/openwrt_21.02.0_mt76x8_jotale_source/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h:114:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
   ^~~
cc1: some warnings being treated as errors
Compiling C object glib/pcre/libpcre.a.p/pcre_get.c.o


上面编译日志看
都是stdio.h(依日志找路径/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify/stdio.h)
--some warnings being treated as errors
解决方法:
在stdio.h 文件里添加
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic pop


toplevel.mk出错
最新版本
toplevel.mk 规则(语法)出错。
建议从旧复制过去替换掉,就能编译过去了。

WSL编译出错
            
这是错误代码

sed -i "s/Installed-Time: .*/Installed-Time: 1644866161/" /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/status

rm -rf /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/boot /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/tmp/* /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/info/*.postinst* /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/lists/* /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/var/lock/*.lock

find /home/dejavu/lede/build_dir/target-mipsel_24kc_musl/root-ramips/ -mindepth 1 -execdir touch -hcd "@1644866161" "{}" +

find: The relative path 'Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find.Please remove that entry from $PATH

make: *** Error 1

make: Leaving directory '/home/dejavu/lede'

make: *** Error 2

make: Leaving directory '/home/dejavu/lede'

make: *** Error 2

      
linux子系统会自动添加 Win系统的 PATH路径,WSL编译命令:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make -j10 V=s
或用vmware里虚拟机就没这个错误了

文件权限问题
"\home\user\openwrt-sdk\package\argserver": Permission denied
如果从Windows系统更改了文件,并且保存了,编译的时候就会出现编译的权限问题,可以更改文件权限

chmod -R 777 package\argserver #更改目录权限,并迭代

前执行make clean && make down


编译时出现以下错误:
checking whether mknod can create fifo without root privileges... configure: error: in/tmp/lede/build_dir/host/tar-1.29': 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
Makefile:30: recipe for target '/tmp/lede/build_dir/host/tar-1.29/.configured' failed
make: *** Error 1
make: Leaving directory '/tmp/lede/tools/tar'
tools/Makefile:150: recipe for target 'tools/tar/compile' failed
make: *** Error 2
make: Leaving directory '/tmp/lede'
tools/Makefile:148: recipe for target '/tmp/lede/staging_dir/target-mips_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnnyyyyyyyyyyyyyyyyyyyynnyynynyyyynny' failed
make: *** Error 2
make: Leaving directory '/tmp/lede'
/tmp/lede/include/toplevel.mk:207: recipe for target 'world' failed
make: *** Error 2
因为整个项目是从GitHub上克隆下来的,文件属主不是你,你需要为整个文件夹添加你的权限
sudo chown -R $USER(用户名) openwrt(源码目录)
或者
sudo export FORCE_UNSAFE_CONFIGURE=1
然后就可以编译了。
编译版本问题
编译过程中 出现ld returned 1 exit status的问题解决方案
话说我出现这个错误是在编译安装osrm这个软件中出现的,预编译通过,make的时候出这个报错,ld returned 1 exit status。第一反应是动态链接库的问题,但百度一番后并没有发现任何有效的结果。

这个就很让人郁闷了,怎么办?突然想起这个版本的osrm是对gcc的版本有要求的,而我使用的gcc是偷懒方式安装的devtooset版本gcc6.3.1版本,并利用其自带脚本激活了gcc6,中间关闭了一次shell窗口,。此时,gcc -v输出为4.8.5,可见make的时候并没有使用gcc 6版本,因此,再次激活gcc6,重新编译 make &&make install,编译顺序通过。

如果报错ld returned 1 exit status,那么一般是gcc编译器在捣鬼,在使用的编译器版本和源码编译所需的gcc编译器版本有差距,首先,查询编译工作需要的gcc编译器版本,然后使用适当的编译器编译,问题一般都会迎刃而解的。

总结
成功路上总会有很绊脚石,当冲破乌云,直挂云帆,扶遥直上,发现之前挫折,也是那么的美好。
你编译openwrt还有哪些问题,欢迎评论区留言,我们如果知道会回答的。


谷谷小师妹 发表于 2023-12-2 20:08:10

编译openwrt出错笔记:
【openwrt】编译OpenWRT 出错m4和findutils库 freadahead.c文件错误-谷动谷力 (sunsili.com)
【openwrt】openwrt CC 编译错误 Error: invalid instruction suffix for `p...-谷动谷力 (sunsili.com)
【openwrt】编译OpenWRT 出错unsquashfs undefined reference to makedev解...-谷动谷力 (sunsili.com)
【openwrt】编译OpenWRT15.05(Chaos Calmer)u-boot-2014.10 rsa-sign出错-谷动谷力 (sunsili.com)
【openwrt】openwrt内核编译libustream-openssl出错 解决-谷动谷力 (sunsili.com)
【openwrt】openwrt编译错误解决经验总结-谷动谷力 (sunsili.com)
【openwrt】openwrt CC 编译时出现automake解压错误-谷动谷力 (sunsili.com)

页: [1]
查看完整版本: 【openwrt】openwrt编译错误解决经验总结