When i compile the shadowsocks for my openwrt route
It give me an error:
configure: error: mbed TLS libraries not found.
how to solve it?
As the error said, you need mbed TLS library compiled first.
Nope.
check https://github.com/wongsyrone/lede-1/blob/master/package/libs/mbedtls/patches/999-tweak-config-for-shadowsocks.patch and apply this to your codebase
in case I change the patch later:
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -322,7 +322,7 @@
*
* Enable Cipher Feedback mode (CFB) for symmetric ciphers.
*/
-//#define MBEDTLS_CIPHER_MODE_CFB
+#define MBEDTLS_CIPHER_MODE_CFB
/**
* \def MBEDTLS_CIPHER_MODE_CTR
@@ -1246,7 +1246,7 @@
*
* Uncomment this to enable pthread mutexes.
*/
-//#define MBEDTLS_THREADING_PTHREAD
+#define MBEDTLS_THREADING_PTHREAD
/**
* \def MBEDTLS_VERSION_FEATURES
@@ -1460,7 +1460,7 @@
* MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
* MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
*/
-//#define MBEDTLS_ARC4_C
+#define MBEDTLS_ARC4_C
/**
* \def MBEDTLS_ASN1_PARSE_C
@@ -1525,7 +1525,7 @@
*
* Module: library/blowfish.c
*/
-//#define MBEDTLS_BLOWFISH_C
+#define MBEDTLS_BLOWFISH_C
/**
* \def MBEDTLS_CAMELLIA_C
@@ -1580,7 +1580,7 @@
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
*/
-//#define MBEDTLS_CAMELLIA_C
+#define MBEDTLS_CAMELLIA_C
/**
* \def MBEDTLS_CCM_C
@@ -2261,7 +2261,7 @@
*
* Enable this layer to allow use of mutexes within mbed TLS
*/
-//#define MBEDTLS_THREADING_C
+#define MBEDTLS_THREADING_C
/**
* \def MBEDTLS_TIMING_C
The root cause is some ciphers are disabled by default, just re-enable them to pass the configure stage.
Which file should i modify?
You can simply put the patch above into package/libs/mbedtls/patches or edit the patch exists via quilt yourself.
额,请教下:
我这边提示的是“MBEDTLS_CIPHER_MODE_CFB required”,但是我这里没有大神所说的目录“package/libs/mbedtls/patches ”。
我只在m4/mbedtls.m4 看到了相关语句:
“AC_MSG_CHECKING([whether mbedtls supports Cipher Feedback mode or not])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
]],
[[
]]
)],
[AC_MSG_RESULT([ok])],
[AC_MSG_ERROR([MBEDTLS_CIPHER_MODE_CFB required])]
)
”
那我应该怎么修改呢。。。
你需要重新编译mbedtls,默认OP的patch会关闭cfb,这样大部分加密都不可用了
如果不会自己修改,复制 https://github.com/wongsyrone/lede-1/tree/master/package/libs/mbedtls 到 SDK的package目录里面,重新编译。那个补丁的意思是重新打开cfb, rc4, blowfish, camellia以及默认开启多线程支持,使用libpthread,musl的话是在libc里面,旧uclibc是单独的一个库。
Thanks for your detailed reply.
i just copyed https://github.com/wongsyrone/lede-1/tree/master/package/libs/mbedtls to SDK's package and typed “make V=99 package/mbedtls/compile” , and no errors.
then i re-compiled the shadowsocks-libev by "make V=99 package/shadowsocks-libev/openwrt/compile", but the console showed the same error "MBEDTLS_CIPHER_MODE_CFB required"
well, is there something i did wrong?
PS:今天被教育了,github是一个全球平台,我用中文询问回答,这样别国的人在遇到相同的问题,就没法直接获得答案,还要耽误大家的时间,我以后把答案改成英文。
应该是copy到feeds/base/package/libs/mbedtls吧,我直接拷贝到SDK目录下的package不可以。
wget https://tls.mbed.org/download/mbedtls-2.4.0-gpl.tgz
tar -zxvf mbedtls-2.4.0-gpl.tgz
cd mbedtls-2.4.0
make
make install
安装mbedtls-devel 或 libmbedtls-devel 或 libmbedtls-deve即可
Turns out the default package repositories for Ubuntu 16.04 contains the package libmbedtls-dev, which seems to resolve this dependency.
Most helpful comment
安装mbedtls-devel 或 libmbedtls-devel 或 libmbedtls-deve即可