用最新版的openwrt官方源码编译时候报错
cqmylx opened this issue · 6 comments
Describe the bug
一周前编译还一点问题没有。今天拉取了最新的源码报错“shadowsocks-libev failed to build”,信息如下:
checking for mbedtls_cipher_setup in -lmbedcrypto... yes
configure: error: MBEDTLS_CIPHER_MODE_CFB required
make[3]: *** [Makefile:130: /workdir/openwrt/build_dir/target-x86_64_musl/shadowsocks-libev-3.3.5/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1
checking whether mbedtls supports Cipher Feedback mode or not... make[3]: Leaving directory '/workdir/openwrt/feeds/packages/net/shadowsocks-libev'
time: package/feeds/packages/shadowsocks-libev/compile#13.88#0.58#15.27
ERROR: package/feeds/packages/shadowsocks-libev failed to build.
make[2]: *** [package/Makefile:129: package/feeds/packages/shadowsocks-libev/compile] Error 1
make[2]: Leaving directory '/workdir/openwrt'
make[1]: *** [package/Makefile:123: /workdir/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/workdir/openwrt'
make: *** [/workdir/openwrt/include/toplevel.mk:233: world] Error 2
ImmortalWrt version
云编译未知
ImmortalWrt release
云编译未知
ImmortalWrt target/subtarget
云编译未知
Device
云编译未知
Image kind
Official downloaded image
Steps to reproduce
No response
Actual behaviour
No response
Expected behaviour
No response
Additional info
No response
Diffconfig
No response
Terms
- I am reporting an issue for ImmortalWrt, not an unsupported fork.
可以试着把编译文件全删了再编译试试
试试这个补丁,可以编译通过。
101-fix-mbedtls3.6-build.patch
:
--- a/m4/mbedtls.m4
+++ b/m4/mbedtls.m4
@@ -31,7 +31,7 @@ AC_DEFUN([ss_MBEDTLS],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
-#include <mbedtls/config.h>
+#include <mbedtls/mbedtls_config.h>
]],
[[
#ifndef MBEDTLS_CIPHER_MODE_CFB
@@ -48,7 +48,7 @@ AC_DEFUN([ss_MBEDTLS],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
-#include <mbedtls/config.h>
+#include <mbedtls/mbedtls_config.h>
]],
[[
#ifndef MBEDTLS_ARC4_C
@@ -64,7 +64,7 @@ AC_DEFUN([ss_MBEDTLS],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
-#include <mbedtls/config.h>
+#include <mbedtls/mbedtls_config.h>
]],
[[
#ifndef MBEDTLS_BLOWFISH_C
@@ -80,7 +80,7 @@ AC_DEFUN([ss_MBEDTLS],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
-#include <mbedtls/config.h>
+#include <mbedtls/mbedtls_config.h>
]],
[[
#ifndef MBEDTLS_CAMELLIA_C
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -104,7 +104,7 @@ crypto_md5(const unsigned char *d
md = m;
}
#if MBEDTLS_VERSION_NUMBER >= 0x02070000
- if (mbedtls_md5_ret(d, n, md) != 0)
+ if (mbedtls_md5(d, n, md) != 0)
FATAL("Failed to calculate MD5");
#else
mbedtls_md5(d, n, md);
--- a/src/aead.c
+++ b/src/aead.c
@@ -178,8 +178,8 @@ aead_cipher_encrypt(cipher_ctx_t *cipher_ctx,
case AES192GCM:
case AES128GCM:
- err = mbedtls_cipher_auth_encrypt(cipher_ctx->evp, n, nlen, ad, adlen,
- m, mlen, c, clen, c + mlen, tlen);
+ err = mbedtls_cipher_auth_encrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen,
+ m, mlen, c, *clen, clen, tlen);
*clen += tlen;
break;
case CHACHA20POLY1305IETF:
@@ -226,8 +226,8 @@ aead_cipher_decrypt(cipher_ctx_t *cipher_ctx,
// Otherwise, just use the mbedTLS one with crappy AES-NI.
case AES192GCM:
case AES128GCM:
- err = mbedtls_cipher_auth_decrypt(cipher_ctx->evp, n, nlen, ad, adlen,
- m, mlen - tlen, p, plen, m + mlen - tlen, tlen);
+ err = mbedtls_cipher_auth_decrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen,
+ m, mlen - tlen, p, *plen, plen - tlen, tlen);
break;
case CHACHA20POLY1305IETF:
err = crypto_aead_chacha20poly1305_ietf_decrypt(p, &long_plen, NULL, m, mlen,
@@ -724,9 +724,9 @@ aead_key_init(int method, const char
if (method >= CHACHA20POLY1305IETF) {
cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t));
cipher->info = cipher_info;
- cipher->info->base = NULL;
- cipher->info->key_bitlen = supported_aead_ciphers_key_size[method] * 8;
- cipher->info->iv_size = supported_aead_ciphers_nonce_size[method];
+ cipher->info->private_base_idx = 0;
+ cipher->info->private_key_bitlen = supported_aead_ciphers_key_size[method] * 8;
+ cipher->info->private_iv_size = supported_aead_ciphers_nonce_size[method];
} else {
cipher->info = (cipher_kt_t *)aead_get_cipher_type(method);
}
--- a/src/stream.c
+++ b/src/stream.c
@@ -174,7 +174,7 @@ cipher_nonce_size(const cipher_t *cipher)
if (cipher == NULL) {
return 0;
}
- return cipher->info->iv_size;
+ return cipher->info->private_iv_size;
}
int
@@ -192,7 +192,7 @@ cipher_key_size(const cipher_t *cipher)
return 0;
}
/* From Version 1.2.7 released 2013-04-13 Default Blowfish keysize is now 128-bits */
- return cipher->info->key_bitlen / 8;
+ return cipher->info->private_key_bitlen / 8;
}
const cipher_kt_t *
@@ -645,9 +645,9 @@ stream_key_init(int method, const char
if (method == SALSA20 || method == CHACHA20 || method == CHACHA20IETF) {
cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t));
cipher->info = cipher_info;
- cipher->info->base = NULL;
- cipher->info->key_bitlen = supported_stream_ciphers_key_size[method] * 8;
- cipher->info->iv_size = supported_stream_ciphers_nonce_size[method];
+ cipher->info->private_base_idx = 0;
+ cipher->info->private_key_bitlen = supported_stream_ciphers_key_size[method] * 8;
+ cipher->info->private_iv_size = supported_stream_ciphers_nonce_size[method];
} else {
cipher->info = (cipher_kt_t *)stream_get_cipher_type(method);
}
试试这个补丁,可以编译通过。
101-fix-mbedtls3.6-build.patch
:--- a/m4/mbedtls.m4 +++ b/m4/mbedtls.m4 @@ -31,7 +31,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_CIPHER_MODE_CFB @@ -48,7 +48,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_ARC4_C @@ -64,7 +64,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_BLOWFISH_C @@ -80,7 +80,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_CAMELLIA_C --- a/src/crypto.c +++ b/src/crypto.c @@ -104,7 +104,7 @@ crypto_md5(const unsigned char *d md = m; } #if MBEDTLS_VERSION_NUMBER >= 0x02070000 - if (mbedtls_md5_ret(d, n, md) != 0) + if (mbedtls_md5(d, n, md) != 0) FATAL("Failed to calculate MD5"); #else mbedtls_md5(d, n, md); --- a/src/aead.c +++ b/src/aead.c @@ -178,8 +178,8 @@ aead_cipher_encrypt(cipher_ctx_t *cipher_ctx, case AES192GCM: case AES128GCM: - err = mbedtls_cipher_auth_encrypt(cipher_ctx->evp, n, nlen, ad, adlen, - m, mlen, c, clen, c + mlen, tlen); + err = mbedtls_cipher_auth_encrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen, + m, mlen, c, *clen, clen, tlen); *clen += tlen; break; case CHACHA20POLY1305IETF: @@ -226,8 +226,8 @@ aead_cipher_decrypt(cipher_ctx_t *cipher_ctx, // Otherwise, just use the mbedTLS one with crappy AES-NI. case AES192GCM: case AES128GCM: - err = mbedtls_cipher_auth_decrypt(cipher_ctx->evp, n, nlen, ad, adlen, - m, mlen - tlen, p, plen, m + mlen - tlen, tlen); + err = mbedtls_cipher_auth_decrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen, + m, mlen - tlen, p, *plen, plen - tlen, tlen); break; case CHACHA20POLY1305IETF: err = crypto_aead_chacha20poly1305_ietf_decrypt(p, &long_plen, NULL, m, mlen, @@ -724,9 +724,9 @@ aead_key_init(int method, const char if (method >= CHACHA20POLY1305IETF) { cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t)); cipher->info = cipher_info; - cipher->info->base = NULL; - cipher->info->key_bitlen = supported_aead_ciphers_key_size[method] * 8; - cipher->info->iv_size = supported_aead_ciphers_nonce_size[method]; + cipher->info->private_base_idx = 0; + cipher->info->private_key_bitlen = supported_aead_ciphers_key_size[method] * 8; + cipher->info->private_iv_size = supported_aead_ciphers_nonce_size[method]; } else { cipher->info = (cipher_kt_t *)aead_get_cipher_type(method); } --- a/src/stream.c +++ b/src/stream.c @@ -174,7 +174,7 @@ cipher_nonce_size(const cipher_t *cipher) if (cipher == NULL) { return 0; } - return cipher->info->iv_size; + return cipher->info->private_iv_size; } int @@ -192,7 +192,7 @@ cipher_key_size(const cipher_t *cipher) return 0; } /* From Version 1.2.7 released 2013-04-13 Default Blowfish keysize is now 128-bits */ - return cipher->info->key_bitlen / 8; + return cipher->info->private_key_bitlen / 8; } const cipher_kt_t * @@ -645,9 +645,9 @@ stream_key_init(int method, const char if (method == SALSA20 || method == CHACHA20 || method == CHACHA20IETF) { cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t)); cipher->info = cipher_info; - cipher->info->base = NULL; - cipher->info->key_bitlen = supported_stream_ciphers_key_size[method] * 8; - cipher->info->iv_size = supported_stream_ciphers_nonce_size[method]; + cipher->info->private_base_idx = 0; + cipher->info->private_key_bitlen = supported_stream_ciphers_key_size[method] * 8; + cipher->info->private_iv_size = supported_stream_ciphers_nonce_size[method]; } else { cipher->info = (cipher_kt_t *)stream_get_cipher_type(method); }
大佬,请问一下,我这样操作是否准确
我在openwrt文件夹下建立了patches文件夹
在patches文件夹下新建了101-fix-mbedtls3.6-build.patch文件,文件内容就是引用的这些
然后在openwrt文件夹下继续使用make -j1 V=s命令编译,但仍然报错
checking for mbedtls_cipher_setup in -lmbedcrypto... yes
checking whether mbedtls supports Cipher Feedback mode or not... configure: error: MBEDTLS_CIPHER_MODE_CFB required
make[3]: *** [Makefile:130: /home/kid/openwrt/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-libev-3.3.5/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1
make[3]: Leaving directory '/home/kid/openwrt/feeds/packages/net/shadowsocks-libev'
time: package/feeds/packages/shadowsocks-libev/compile#20.99#4.38#25.73
ERROR: package/feeds/packages/shadowsocks-libev failed to build.
make[2]: *** [package/Makefile:129: package/feeds/packages/shadowsocks-libev/compile] Error 1
make[2]: Leaving directory '/home/kid/openwrt'
make[1]: *** [package/Makefile:123: /home/kid/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/kid/openwrt'
make: *** [/home/kid/openwrt/include/toplevel.mk:233:world] 错误 2
试试这个补丁,可以编译通过。
101-fix-mbedtls3.6-build.patch
:--- a/m4/mbedtls.m4 +++ b/m4/mbedtls.m4 @@ -31,7 +31,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_CIPHER_MODE_CFB @@ -48,7 +48,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_ARC4_C @@ -64,7 +64,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_BLOWFISH_C @@ -80,7 +80,7 @@ AC_DEFUN([ss_MBEDTLS], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ -#include <mbedtls/config.h> +#include <mbedtls/mbedtls_config.h> ]], [[ #ifndef MBEDTLS_CAMELLIA_C --- a/src/crypto.c +++ b/src/crypto.c @@ -104,7 +104,7 @@ crypto_md5(const unsigned char *d md = m; } #if MBEDTLS_VERSION_NUMBER >= 0x02070000 - if (mbedtls_md5_ret(d, n, md) != 0) + if (mbedtls_md5(d, n, md) != 0) FATAL("Failed to calculate MD5"); #else mbedtls_md5(d, n, md); --- a/src/aead.c +++ b/src/aead.c @@ -178,8 +178,8 @@ aead_cipher_encrypt(cipher_ctx_t *cipher_ctx, case AES192GCM: case AES128GCM: - err = mbedtls_cipher_auth_encrypt(cipher_ctx->evp, n, nlen, ad, adlen, - m, mlen, c, clen, c + mlen, tlen); + err = mbedtls_cipher_auth_encrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen, + m, mlen, c, *clen, clen, tlen); *clen += tlen; break; case CHACHA20POLY1305IETF: @@ -226,8 +226,8 @@ aead_cipher_decrypt(cipher_ctx_t *cipher_ctx, // Otherwise, just use the mbedTLS one with crappy AES-NI. case AES192GCM: case AES128GCM: - err = mbedtls_cipher_auth_decrypt(cipher_ctx->evp, n, nlen, ad, adlen, - m, mlen - tlen, p, plen, m + mlen - tlen, tlen); + err = mbedtls_cipher_auth_decrypt_ext(cipher_ctx->evp, n, nlen, ad, adlen, + m, mlen - tlen, p, *plen, plen - tlen, tlen); break; case CHACHA20POLY1305IETF: err = crypto_aead_chacha20poly1305_ietf_decrypt(p, &long_plen, NULL, m, mlen, @@ -724,9 +724,9 @@ aead_key_init(int method, const char if (method >= CHACHA20POLY1305IETF) { cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t)); cipher->info = cipher_info; - cipher->info->base = NULL; - cipher->info->key_bitlen = supported_aead_ciphers_key_size[method] * 8; - cipher->info->iv_size = supported_aead_ciphers_nonce_size[method]; + cipher->info->private_base_idx = 0; + cipher->info->private_key_bitlen = supported_aead_ciphers_key_size[method] * 8; + cipher->info->private_iv_size = supported_aead_ciphers_nonce_size[method]; } else { cipher->info = (cipher_kt_t *)aead_get_cipher_type(method); } --- a/src/stream.c +++ b/src/stream.c @@ -174,7 +174,7 @@ cipher_nonce_size(const cipher_t *cipher) if (cipher == NULL) { return 0; } - return cipher->info->iv_size; + return cipher->info->private_iv_size; } int @@ -192,7 +192,7 @@ cipher_key_size(const cipher_t *cipher) return 0; } /* From Version 1.2.7 released 2013-04-13 Default Blowfish keysize is now 128-bits */ - return cipher->info->key_bitlen / 8; + return cipher->info->private_key_bitlen / 8; } const cipher_kt_t * @@ -645,9 +645,9 @@ stream_key_init(int method, const char if (method == SALSA20 || method == CHACHA20 || method == CHACHA20IETF) { cipher_kt_t *cipher_info = (cipher_kt_t *)ss_malloc(sizeof(cipher_kt_t)); cipher->info = cipher_info; - cipher->info->base = NULL; - cipher->info->key_bitlen = supported_stream_ciphers_key_size[method] * 8; - cipher->info->iv_size = supported_stream_ciphers_nonce_size[method]; + cipher->info->private_base_idx = 0; + cipher->info->private_key_bitlen = supported_stream_ciphers_key_size[method] * 8; + cipher->info->private_iv_size = supported_stream_ciphers_nonce_size[method]; } else { cipher->info = (cipher_kt_t *)stream_get_cipher_type(method); }
大佬,请问一下,我这样操作是否准确 我在openwrt文件夹下建立了patches文件夹 在patches文件夹下新建了101-fix-mbedtls3.6-build.patch文件,文件内容就是引用的这些
然后在openwrt文件夹下继续使用make -j1 V=s命令编译,但仍然报错
checking for mbedtls_cipher_setup in -lmbedcrypto... yes checking whether mbedtls supports Cipher Feedback mode or not... configure: error: MBEDTLS_CIPHER_MODE_CFB required make[3]: *** [Makefile:130: /home/kid/openwrt/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-libev-3.3.5/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1 make[3]: Leaving directory '/home/kid/openwrt/feeds/packages/net/shadowsocks-libev' time: package/feeds/packages/shadowsocks-libev/compile#20.99#4.38#25.73 ERROR: package/feeds/packages/shadowsocks-libev failed to build. make[2]: *** [package/Makefile:129: package/feeds/packages/shadowsocks-libev/compile] Error 1 make[2]: Leaving directory '/home/kid/openwrt' make[1]: *** [package/Makefile:123: /home/kid/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/kid/openwrt' make: *** [/home/kid/openwrt/include/toplevel.mk:233:world] 错误 2
我也是同样的问题,试了这个补丁也是不能通过。
如果你解决了,感谢告知下结果
这个包已被弃用,不会再维护。将于最近删除。