dosgo / ngrok-c

ngrok client for c language,Due to the use of GO ngrok language development, porting to embedded devices some inconvenience, such as openwrt, so use C language rewrite a client. Very mini, the need to support polarssl library.
MIT License
497 stars 202 forks source link

Compilation error: mbedtls/ssl.h not found #61

Closed narshben closed 6 years ago

narshben commented 6 years ago

I try to compile the ngrok-c client for my WNDR3800 Router which runs openwrt CC(14.07). I was using the VPS which runs Ubuntu 14.04 for the work. I followed every step you mentioned and still get the error information....Could you please help sort it out? Many thanks.

In file included from sslbio.h:8:0, from nonblocking.h:21, from sendmsg.h:4, from sendmsg.cpp:11: polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory

include <mbedtls/ssl.h>

                     ^

compilation terminated. In file included from sslbio.h:8:0, from nonblocking.h:21, from sendmsg.h:4, from ngrok.h:6, from main.cpp:33: polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory

include <mbedtls/ssl.h>

                     ^

compilation terminated. In file included from sslbio.h:8:0, from nonblocking.h:21, from nonblocking.cpp:1: polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory

include <mbedtls/ssl.h>

                     ^

compilation terminated. In file included from polarsslbio.cpp:4:0: polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory

include <mbedtls/ssl.h>

                     ^

compilation terminated. In file included from sslbio.h:8:0, from nonblocking.h:21, from sendmsg.h:4, from ngrok.h:6, from ngrok.cpp:13: polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory

include <mbedtls/ssl.h>

                     ^

compilation terminated. mips-openwrt-linux-g++: error: build-mips/main.o: No such file or directory mips-openwrt-linux-g++: error: build-mips/sendmsg.o: No such file or directory mips-openwrt-linux-g++: error: build-mips/nonblocking.o: No such file or directory mips-openwrt-linux-g++: error: build-mips/ngrok.o: No such file or directory mips-openwrt-linux-g++: error: build-mips/polarsslbio.o: No such file or directory mips-openwrt-linux-g++: error: libmbedtls.a: No such file or directory mips-openwrt-linux-g++: error: libmbedx509.a: No such file or directory mips-openwrt-linux-g++: error: libmbedcrypto.a: No such file or directory

GuodongQi commented 6 years ago

调试了大半天,终于解决了:

要把ngrok-c-master文件夹下的mbedtls文件夹移动到/home/xxxxxx/staging_dir/toolchain-mips_24kc_gcc-xxx_musl/include/ 文件夹下,

不过运行后 可能会提示错误 polarsslbio.h:63:14: error: 'MBEDTLS_ERR_NET_CONN_RESET' was not declared in this scope

此时需要修改ngrok-c-master/polarsslbio.h

if ISMBEDTLS

include <mbedtls/ssl.h>

include <mbedtls/net.h>

include <mbedtls/debug.h>

include <mbedtls/entropy.h>

include <mbedtls/ctr_drbg.h>

include <mbedtls/error.h>

include <mbedtls/certs.h>

#include <mbedtls/net_sockets.h> //增加这个include 。至于net_sockets.h文件,随处都可以下载,// // 下载完成后移动到staging_dir/toolchain-mips_24kc_gcc- // xxx_musl/include/mbedtls/

typedef mbedtls_entropy_context entropy_context; typedef mbedtls_ctr_drbg_context ctr_drbg_context; typedef mbedtls_ssl_context ssl_context; typedef mbedtls_ssl_session ssl_session; typedef mbedtls_x509_crt x509_crt; typedef mbedtls_x509_crt x509_crt;

else

至于 mips-openwrt-linux-g++: error: libmbedtls.a: No such file or directory mips-openwrt-linux-g++: error: libmbedx509.a: No such file or directory mips-openwrt-linux-g++: error: libmbedcrypto.a: No such file or directory 按照readme : 二.1 : 如果一切顺利的话,就会在library目录下生成,2.0版本(libmbedtls.a libmbedcrypto.a libmbedx5.9.a)1.3版本(libpolarssl.a..... 将它们移动到ngrok-c-master中即可

dosgo commented 6 years ago

。。。。缺少的当然要移动到include