Git Product home page Git Product logo

Comments (72)

dosgo avatar dosgo commented on September 3, 2024

这个不是很简单,找不到头文件,直接把polarssl头文件复制到你sdk的include目录

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

这个不是很简单,找不到头文件,直接把polarssl头文件复制到你sdk的include目录

早上好~
请问是把mbedtls-2.16.2里的全部文件复制到SDK的include里去吗?谢谢。。
ng

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

如果是meddtls得把config.h的常量打开来

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

如果是meddtls得把config.h的常量打开来

大大有QQ交流群之类的吗?或者个人QQ之类的,加一下,哈哈,怕泄露的话那加我的925198583

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

如果是meddtls得把config.h的常量打开来

常量我打开了,meddtls的编译完后生成三个文件(libmbedcrypto.a libmbedtls.a libmbedx509.a )所以应该算2.0的吧,所以我都是按照2.0的教程操作的,所有不步骤都正常,就执行openwrtbuild.sh时报错了

ng
ng2
ng3

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

最重要的错误呢。。

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

最重要的错误呢。。

我直接贴在下面了,麻烦看一下,已经把mbedtls-2.16.2/include里的文件都复制到SDK里的include了

root@instance-1:~/ngrok-c# ./openwrtbuild.sh
mkdir: cannot create directory ‘build-mips’: File exists
In file included from sslbio.h:8:0,
from global.h:7,
from config.h:23,
from sendmsg.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from global.h:7,
from config.h:23,
from main.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from global.h:7,
from config.h:23,
from nonblocking.h:3,
from nonblocking.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from global.h:7,
from config.h:23,
from polarsslbio.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from global.h:7,
from global.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from global.h:7,
from config.h:23,
from ngrok.cpp:1:
polarsslbio.h:24:26: fatal error: polarssl/net.h: No such file or directory
#include <polarssl/net.h>
^
compilation terminated.
mipsel-openwrt-linux-g++: error: build-mips/main.o: No such file or directory
mipsel-openwrt-linux-g++: error: build-mips/sendmsg.o: No such file or directory
mipsel-openwrt-linux-g++: error: build-mips/nonblocking.o: No such file or directory
mipsel-openwrt-linux-g++: error: build-mips/global.o: No such file or directory
mipsel-openwrt-linux-g++: error: build-mips/ngrok.o: No such file or directory
mipsel-openwrt-linux-g++: error: build-mips/polarsslbio.o: No such file or directory

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

那你找找sdk include有没有polarssl文件夹,没有的话就不用我说了吧

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

那你找找sdk include有没有polarssl文件夹,没有的话就不用我说了吧

sdk/include没有,在sdk/usr/include倒是找到一个polarssl,我把它复制到skd/include下去重新运行openwrtbuild.sh也是报错(复制ngrok-c/polarssl的也一样报错)
搜索polarssl结果如下
root@instance-1:~/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/incl
ude# find / -name polarssl
/root/ngrok-c/polarssl
/root/op/staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/include/polarssl

root@instance-1:~/ngrok-c# ./openwrtbuild.sh
mkdir: cannot create directory ‘build-mips’: File exists
ngrok.cpp: In function 'int ConnectMain(int*, sockaddr_in, ssl_info**)':
ngrok.cpp:564:44: error: 'ClientId' was not declared in this scope
SendAuth(*mainsock,&(*mainsslinfo)->ssl, *ClientId, authtoken,password_c);
^
ngrok.cpp:564:54: error: 'authtoken' was not declared in this scope
SendAuth(*mainsock,&(*mainsslinfo)->ssl, *ClientId, authtoken,password_c);
^
ngrok.cpp:564:64: error: 'password_c' was not declared in this scope
SendAuth(*mainsock,&(*mainsslinfo)->ssl, *ClientId, authtoken,password_c);
^
mipsel-openwrt-linux-g++: error: build-mips/ngrok.o: No such file or directory

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

代码是最新的吗

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

代码是最新的吗

对,ngrok是release里的v1.48,mbed是官网最新的2.16.2
image
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

不要1.48,直接git拉------------------ 原始邮件 ------------------ 发件人: "onlyJinx"[email protected] 发送时间: 2019年8月12日(星期一) 中午12:36 收件人: "dosgo/ngrok-c"[email protected]; 抄送: "dosgo"[email protected];"Comment"[email protected]; 主题: Re: [dosgo/ngrok-c] 编译时报错 (#73) 代码是最新的吗 对,ngrok是release里的v1.48,mbed是官网最新的2.16.2 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

可是直接git clone的话就没有教程里的openwrtbuild.sh,只有一个V2的
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

那你就把1.48的拿过来用

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

那你就把1.48的拿过来用

大佬,polarssl库编译成功,我把polarssl里面的include/polarssl还有include/mbedtls 文件夹都复制到SDK/include了,常量config.h也修改了,代码是直接git clone的了,执行openwrtbuild.sh时报下面的错误,请再提示提示哪里有问题。。

image

[root@localhost include]# cd ~/ngrok-c/
[root@localhost ngrok-c]# ./openwrtbuild.sh
mkdir: cannot create directory ‘build-mips’: File exists
build-mips/main.o: In function proxy()': main.cpp:(.text+0x4c0): warning: gethostbyname is obsolescent, use getnameinfo() instead. build-mips/ngrok.o: In function RemoteSslInit(Sockinfo*)':
ngrok.cpp:(.text+0x32c): undefined reference to ssl_write' build-mips/ngrok.o: In function LocalToRemote(Sockinfo*, ssl_info*)':
ngrok.cpp:(.text+0x40c): undefined reference to ssl_write' build-mips/ngrok.o: In function ConnectMain(int*, sockaddr_in, ssl_info**)':
ngrok.cpp:(.text+0x780): undefined reference to x509_crt_free' ngrok.cpp:(.text+0x788): undefined reference to ssl_free'
ngrok.cpp:(.text+0x790): undefined reference to ctr_drbg_free' ngrok.cpp:(.text+0x798): undefined reference to entropy_free'
build-mips/ngrok.o: In function CmdSock(int*, Sockinfo*, sockaddr_in)': ngrok.cpp:(.text+0xf20): undefined reference to ssl_read'
ngrok.cpp:(.text+0x1290): undefined reference to ssl_write' ngrok.cpp:(.text+0x1370): undefined reference to ssl_write'
build-mips/ngrok.o: In function RemoteToLocal(ssl_info*, Sockinfo*)': ngrok.cpp:(.text+0x1484): undefined reference to ssl_read'
build-mips/ngrok.o: In function ConnectLocal(ssl_info*, Sockinfo*)': ngrok.cpp:(.text+0x1888): undefined reference to ssl_read'
build-mips/ngrok.o: In function SendAuth(int, _ssl_context*)': ngrok.cpp:(.text._Z8SendAuthiP12_ssl_context[_Z8SendAuthiP12_ssl_context]+0xe0): undefined reference to ssl_write'
build-mips/main.o: In function checkping()': main.cpp:(.text+0x318): undefined reference to ssl_write'
build-mips/main.o: In function proxy()': main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)'
main.cpp:(.text+0x3d0): undefined reference to CheckRegTunnel(int)' main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)'
main.cpp:(.text+0x854): undefined reference to UdpRecv(fd_set*)' build-mips/main.o: In function main':
main.cpp:(.text.startup+0x108): undefined reference to initUdp()' build-mips/sendmsg.o: In function SendReqTunnel(int, _ssl_context*, TunnelInfo*)':
sendmsg.cpp:(.text+0x1dc): undefined reference to ssl_write' build-mips/nonblocking.o: In function clearsock(Sockinfo*)':
nonblocking.cpp:(.text+0x30): undefined reference to net_close' nonblocking.cpp:(.text+0x94): undefined reference to ssl_close_notify'
nonblocking.cpp:(.text+0xa0): undefined reference to x509_crt_free' nonblocking.cpp:(.text+0xa8): undefined reference to ssl_free'
nonblocking.cpp:(.text+0xb0): undefined reference to ctr_drbg_free' nonblocking.cpp:(.text+0xb8): undefined reference to entropy_free'
build-mips/polarsslbio.o: In function ssl_init_info(int*, ssl_info*)': polarsslbio.cpp:(.text+0x2c): undefined reference to x509_crt_init'
polarsslbio.cpp:(.text+0x38): undefined reference to entropy_init' polarsslbio.cpp:(.text+0x44): undefined reference to entropy_func'
polarsslbio.cpp:(.text+0x54): undefined reference to entropy_func' polarsslbio.cpp:(.text+0x5c): undefined reference to ctr_drbg_init'
polarsslbio.cpp:(.text+0x6c): undefined reference to ssl_init' polarsslbio.cpp:(.text+0x7c): undefined reference to ssl_set_endpoint'
polarsslbio.cpp:(.text+0x88): undefined reference to ssl_set_authmode' polarsslbio.cpp:(.text+0xa0): undefined reference to ssl_set_ca_chain'
polarsslbio.cpp:(.text+0xb4): undefined reference to ssl_set_rng' polarsslbio.cpp:(.text+0xa8): undefined reference to ctr_drbg_random'
polarsslbio.cpp:(.text+0xb8): undefined reference to ctr_drbg_random' polarsslbio.cpp:(.text+0xbc): undefined reference to net_recv'
polarsslbio.cpp:(.text+0xd0): undefined reference to net_recv' polarsslbio.cpp:(.text+0xc0): undefined reference to net_send'
polarsslbio.cpp:(.text+0xd4): undefined reference to net_send' polarsslbio.cpp:(.text+0xdc): undefined reference to ssl_set_bio'
polarsslbio.cpp:(.text+0xf4): undefined reference to ssl_set_session' polarsslbio.cpp:(.text+0xfc): undefined reference to ssl_handshake'
polarsslbio.cpp:(.text+0x158): undefined reference to ssl_handshake' polarsslbio.cpp:(.text+0x168): undefined reference to ssl_get_verify_result'
polarsslbio.cpp:(.text+0x17c): undefined reference to `ssl_get_session'
collect2: error: ld returned 1 exit status

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

链接的时候要加上polarssl编译出来的.a库

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

还有polarssl不要新版本,新版本是没用的

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

链接的时候要加上polarssl编译出来的.a库

还有polarssl不要新版本,新版本是没用的

额,那我用1.3的试试,谢谢回复。。

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

啥1.3啊?

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

我说的是polarssl库不要最新版本的。。ngrok源码要最新的,

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

我说的是polarssl库不要最新版本的。。ngrok源码要最新的,

我说的是polarss,保守一点下载2.14的
image

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

啥1.3啊?

我去看了调用静态库的文章,看完学了-L和-l参数,然后应该是我不会用,我不知道怎么同时调用三个.a文件。。。。。求教怎么改

image

[root@localhost ngrok-c]# ./openwrtbuild.sh
mkdir: cannot create directory ‘build-mips’: File exists
build-mips/main.o: In function proxy()': main.cpp:(.text+0x4c0): warning: gethostbyname is obsolescent, use getnameinfo() instead. build-mips/ngrok.o: In function RemoteSslInit(Sockinfo*)':
ngrok.cpp:(.text+0x32c): undefined reference to ssl_write' build-mips/ngrok.o: In function LocalToRemote(Sockinfo*, ssl_info*)':
ngrok.cpp:(.text+0x40c): undefined reference to ssl_write' build-mips/ngrok.o: In function ConnectMain(int*, sockaddr_in, ssl_info**)':
ngrok.cpp:(.text+0x780): undefined reference to x509_crt_free' ngrok.cpp:(.text+0x788): undefined reference to ssl_free'
ngrok.cpp:(.text+0x790): undefined reference to ctr_drbg_free' ngrok.cpp:(.text+0x798): undefined reference to entropy_free'
build-mips/ngrok.o: In function CmdSock(int*, Sockinfo*, sockaddr_in)': ngrok.cpp:(.text+0xf20): undefined reference to ssl_read'
ngrok.cpp:(.text+0x1290): undefined reference to ssl_write' ngrok.cpp:(.text+0x1370): undefined reference to ssl_write'
build-mips/ngrok.o: In function RemoteToLocal(ssl_info*, Sockinfo*)': ngrok.cpp:(.text+0x1484): undefined reference to ssl_read'
build-mips/ngrok.o: In function ConnectLocal(ssl_info*, Sockinfo*)': ngrok.cpp:(.text+0x1888): undefined reference to ssl_read'
build-mips/ngrok.o: In function SendAuth(int, _ssl_context*)': ngrok.cpp:(.text._Z8SendAuthiP12_ssl_context[_Z8SendAuthiP12_ssl_context]+0xe0): undefined reference to ssl_write'
build-mips/main.o: In function checkping()': main.cpp:(.text+0x318): undefined reference to ssl_write'
build-mips/main.o: In function proxy()': main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)'
main.cpp:(.text+0x3d0): undefined reference to CheckRegTunnel(int)' main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)'
main.cpp:(.text+0x854): undefined reference to UdpRecv(fd_set*)' build-mips/main.o: In function main':
main.cpp:(.text.startup+0x108): undefined reference to initUdp()' build-mips/sendmsg.o: In function SendReqTunnel(int, _ssl_context*, TunnelInfo*)':
sendmsg.cpp:(.text+0x1dc): undefined reference to ssl_write' build-mips/nonblocking.o: In function clearsock(Sockinfo*)':

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

这个命令应该没问题,.a文件有问题,可能你是编译的linux用的.a文件,而不是用SDK编译的.a文件,记得编译polarssl的时候得吧CC 等编译器换成sdk的gcc g++等。。这样编译出来的才是交叉的.a文件,你可以执行lipo -info xx.a查看下文件的指令集

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

如果有mips字样应该就对,

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

如果有mips字样应该就对,

应该是交叉编译的才对,这是buildlib.sh内容
#this build polarssl
export PATH=$PATH:'/root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
export STAGING_DIR="/root/op/staging_dir"
make clean
make CC=mipsel-openwrt-linux-uclibc-gcc CXX=mipsel-openwrt-linux-uclibc-g++ AR=mipsel-openwrt-linux-uclibc-ar RANLIB=mipsel-openwrt-linux-uclibc-ranlib

我机器换Centos7所以找不到你说的那个指令
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

如果上步操作显示是mips的.a文件,nm --defined-only xx.a命令看下这3个文件是否有x509_crt_free,ctr_drbg_free这些符号表,如果没有,可能是版本问题,我之前用的polarssl版本是1.4X的好像,后面2.0我都没测试过了。。

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

linux 用readelf -h xx.a吧

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

没有linux实现不了的东西,哈哈,从内核到外层全是开源的。。唯一比较烂的就是gui

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

没有linux实现不了的东西,哈哈,从内核到外层全是开源的。。唯一比较烂的就是gui

这个readelf还要手动编译。。查出来了,不过有点多,我复制一小部分给你看下(我路由器mipsle)
image

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

没有linux实现不了的东西,哈哈,从内核到外层全是开源的。。唯一比较烂的就是gui

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

那就是了,只有mebdtls开头的,所以你得吧config.h里面的ismbedtls打开来

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

那就是了,只有mebdtls开头的,所以你得吧config.h里面的ismbedtls打开来

config.h的配置应该没错,我按照教程改的
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

image
编译文件错了,看到这个没有,是以这里的为准。。

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

-DISMBEDTLS 有这个config.h就不生效了

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

image
编译文件错了,看到这个没有,是以这里的为准。。

是CC的内容错了吗?我改成SDK里的那个g++,YH的话教程没有提到要修改

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

那个教程落后了,懒得更新,之前的脚本是没有这个参数的

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

那个教程落后了,懒得更新,之前的脚本是没有这个参数的

请问这样改对吗?
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

试试,没错

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

试试,没错

改完之后是这样的报错
[root@localhost ngrok-c]# ./openwrtbuild.sh
mkdir: cannot create directory ‘build-mips’: File exists
build-mips/main.o: In function proxy()': main.cpp:(.text+0x4c0): warning: gethostbyname is obsolescent, use getnameinfo() instead. libmbedx509.a(x509_crt.o): In function x509_profile_check_key.isra.4':
x509_crt.c:(.text+0x21c): undefined reference to mbedtls_pk_get_type' x509_crt.c:(.text+0x2a4): undefined reference to mbedtls_pk_get_bitlen'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_info': x509_crt.c:(.text+0x6b0): undefined reference to mbedtls_pk_get_name'
x509_crt.c:(.text+0x6d0): undefined reference to mbedtls_pk_get_bitlen' x509_crt.c:(.text+0x7e8): undefined reference to mbedtls_oid_get_extended_key_usage'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_verify_restartable': x509_crt.c:(.text+0x126c): undefined reference to mbedtls_pk_get_type'
x509_crt.c:(.text+0x14d0): undefined reference to mbedtls_md_info_from_type' x509_crt.c:(.text+0x14e8): undefined reference to mbedtls_md'
x509_crt.c:(.text+0x14fc): undefined reference to mbedtls_pk_can_do' x509_crt.c:(.text+0x1518): undefined reference to mbedtls_md_get_size'
x509_crt.c:(.text+0x1548): undefined reference to mbedtls_pk_verify_ext' x509_crt.c:(.text+0x16e8): undefined reference to mbedtls_md_info_from_type'
x509_crt.c:(.text+0x1700): undefined reference to mbedtls_md' x509_crt.c:(.text+0x1740): undefined reference to mbedtls_md_get_size'
x509_crt.c:(.text+0x1770): undefined reference to mbedtls_pk_verify_ext' libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_free':
x509_crt.c:(.text+0x1b9c): undefined reference to mbedtls_pk_free' libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_parse_der':
x509_crt.c:(.text+0x1dc8): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x1e48): undefined reference to mbedtls_asn1_get_tag'
x509_crt.c:(.text+0x1e78): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x1fa4): undefined reference to mbedtls_asn1_get_int'
x509_crt.c:(.text+0x204c): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2098): undefined reference to mbedtls_asn1_get_tag'
x509_crt.c:(.text+0x20c8): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x211c): undefined reference to mbedtls_pk_parse_subpubkey'
x509_crt.c:(.text+0x2358): undefined reference to mbedtls_asn1_get_sequence_of' x509_crt.c:(.text+0x23a8): undefined reference to mbedtls_asn1_get_tag'
x509_crt.c:(.text+0x23d0): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2404): undefined reference to mbedtls_asn1_get_bool'
x509_crt.c:(.text+0x2428): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2450): undefined reference to mbedtls_oid_get_x509_ext_type'
x509_crt.c:(.text+0x2518): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2568): undefined reference to mbedtls_asn1_get_len'
x509_crt.c:(.text+0x2660): undefined reference to mbedtls_asn1_get_bitstring' x509_crt.c:(.text+0x26e4): undefined reference to mbedtls_asn1_get_bitstring'
x509_crt.c:(.text+0x2734): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x275c): undefined reference to mbedtls_asn1_get_bool'
x509_crt.c:(.text+0x2778): undefined reference to mbedtls_asn1_get_int' x509_crt.c:(.text+0x27b0): undefined reference to mbedtls_asn1_get_int'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_parse': x509_crt.c:(.text+0x2880): undefined reference to mbedtls_pem_init'
x509_crt.c:(.text+0x28a4): undefined reference to mbedtls_pem_read_buffer' x509_crt.c:(.text+0x28c8): undefined reference to mbedtls_pem_free'
x509_crt.c:(.text+0x2970): undefined reference to mbedtls_pem_free' libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_parse_file':
x509_crt.c:(.text+0x29d4): undefined reference to mbedtls_pk_load_file' libmbedx509.a(x509_crt.o): In function x509_get_uid':
x509_crt.c:(.text.unlikely+0x30): undefined reference to mbedtls_asn1_get_tag' build-mips/main.o: In function proxy()':
main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)' main.cpp:(.text+0x3d0): undefined reference to CheckRegTunnel(int)'
main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)' main.cpp:(.text+0x854): undefined reference to UdpRecv(fd_set*)'
build-mips/main.o: In function main': main.cpp:(.text.startup+0x108): undefined reference to initUdp()'
libmbedtls.a(ssl_tls.o): In function ssl_calc_finished_tls_sha256': ssl_tls.c:(.text+0x1a4): undefined reference to mbedtls_sha256_init'
ssl_tls.c:(.text+0x1d8): undefined reference to mbedtls_sha256_clone' ssl_tls.c:(.text+0x224): undefined reference to mbedtls_sha256_finish_ret'
ssl_tls.c:(.text+0x284): undefined reference to mbedtls_sha256_free' libmbedtls.a(ssl_tls.o): In function ssl_calc_verify_tls_sha256':
ssl_tls.c:(.text+0x30c): undefined reference to mbedtls_sha256_init' ssl_tls.c:(.text+0x340): undefined reference to mbedtls_sha256_clone'
ssl_tls.c:(.text+0x34c): undefined reference to mbedtls_sha256_finish_ret' ssl_tls.c:(.text+0x3a0): undefined reference to mbedtls_sha256_free'
libmbedtls.a(ssl_tls.o): In function tls_prf_generic': ssl_tls.c:(.text+0x400): undefined reference to mbedtls_md_init'
ssl_tls.c:(.text+0x408): undefined reference to mbedtls_md_info_from_type' ssl_tls.c:(.text+0x418): undefined reference to mbedtls_md_get_size'
ssl_tls.c:(.text+0x478): undefined reference to mbedtls_md_setup' ssl_tls.c:(.text+0x4c8): undefined reference to mbedtls_md_hmac_starts'
ssl_tls.c:(.text+0x4d8): undefined reference to mbedtls_md_hmac_update' ssl_tls.c:(.text+0x4e4): undefined reference to mbedtls_md_hmac_finish'
ssl_tls.c:(.text+0x500): undefined reference to mbedtls_md_hmac_reset' ssl_tls.c:(.text+0x510): undefined reference to mbedtls_md_hmac_update'
ssl_tls.c:(.text+0x51c): undefined reference to mbedtls_md_hmac_finish' ssl_tls.c:(.text+0x524): undefined reference to mbedtls_md_hmac_reset'
ssl_tls.c:(.text+0x534): undefined reference to mbedtls_md_hmac_update' ssl_tls.c:(.text+0x540): undefined reference to mbedtls_md_hmac_finish'
ssl_tls.c:(.text+0x594): undefined reference to mbedtls_md_free' libmbedtls.a(ssl_tls.o): In function tls1_prf':

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

试试,没错

是不是我引用.a文件的方式有问题
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

image
最后几个.a文件换下位置看下

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

哪个.a文件提示缺少,就放哪个到最后

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

哪个.a文件提示缺少,就放哪个到最后

改了位置之后报错好像没有那么多了
image

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

image
这里参照sendmsg.cpp 把udp.cpp也加上。。依葫芦画瓢

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

整个文件,有sendmsg字样的,都得加上相同的叫udp这样的

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

你应该大概能看懂吧,少了个udp.cpp没有编译导致的

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

你已经踩完所有坑了,明天一定能编译好,实在不行就睡觉吧。。。

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

你已经踩完所有坑了,明天一定能编译好,实在不行就睡觉吧。。。

emmm,睡觉,晚安。。。
image

image

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

你已经踩完所有坑了,明天一定能编译好,实在不行就睡觉吧。。。

改漏了一点,但好像没有upd.o这个文件,先睡觉吧,幸苦了,哈哈
image

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

你上面那行写成upd了。。应该是udp

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

你上面那行写成upd了。。应该是udp

哈哈
image
image

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

你上面那行写成upd了。。应该是udp

早上好,我按照Google的结果将base64.h #include到udp.cpp里后好像有新的进展了

image

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

这哪是新进展,改回去,然后把base64.c参照udp.cpp加一份编译

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

这哪是新进展,改回去,然后把base64.c参照udp.cpp加一份编译

我把udp.cpp改回去了,然后将openwrtbuild.sh加base64进去,不过应该是我加错了(看截图),我ngrok-c里base64的文件只有base64.c还有base64.h

image
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

最后一行又不贴出来

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

最后一行又不贴出来

抱歉,马上贴
image

#!/bin/sh
export PATH=$PATH:'/root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
export STAGING_DIR="/root/op/staging_dir"
DIR=build-mips
mkdir $DIR
rm -rf $DIR/main.o
rm -rf $DIR/cJSON.o
rm -rf $DIR/sendmsg.o
rm -rf $DIR/udp.o
rm -rf $DIR/polarsslbio.o
rm -rf $DIR/nonblocking.o
rm -rf $DIR/ngrokc

CC=mipsel-openwrt-linux-uclibc-g++
YH="-Wall -fexceptions -DOPENSSL=0 -DISMBEDTLS=1 -O2"
$CC $YH -c $1 sendmsg.cpp -o $DIR/sendmsg.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 udp.cpp -o $DIR/udp.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 base64.c -o $DIR/base64.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 cJSON.c -o $DIR/cJSON.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 main.cpp -o $DIR/main.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 nonblocking.cpp -o $DIR/nonblocking.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 polarsslbio.cpp -o $DIR/polarsslbio.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 global.cpp -o $DIR/global.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC $YH -c $1 ngrok.cpp -o $DIR/ngrok.o -L/root/ngrok-c -lmbedtls -lmbedx509 -lmbedcrypto
$CC -s $DIR/main.o $DIR/cJSON.o $DIR/sendmsg.o $DIR/udp.o $DIR/nonblocking.o $DIR/global.o $DIR/ngrok.o $DIR/polarsslbio.o libmbedtls.a libmbedx509.a libmbedcrypto.a -o $DIR/ngrokc

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

你都知道最后一行要加udp.o,为啥不加base64.o?

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

你都知道最后一行要加udp.o,为啥不加base64.o?

这是我加完之后的
image
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

成功了啊,这只是警告,可以忽略,要是有error就是失败了

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

成功了啊,这只是警告,可以忽略,要是有error就是失败了

这样可以直接用了对吧,和原版(golang)的server端可以连接上吗?
image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

我建议你把这个脚本提交到到github吧,顺便修改一下编译教程。也算是

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

我建议你把这个脚本提交到到github吧,顺便修改一下编译教程。也算是

好,我测试一下客户端,稍后再提交上去,感谢帮忙~~

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

我建议你把这个脚本提交到到github吧,顺便修改一下编译教程。也算是

大哥,就差临门一脚了,找不到库文件,这个文件我可以在编译机器centos7找到,但是想复制到路由器时我的路由器好像没有lib64这个文件夹;所以我把它放到ngrokc同目录下,但报错了,请再指点一下。。
image

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

openwrt 有个叫libstdcpp.ipk的包安装就好了。。

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

这个教程说过了吧

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

openwrt 有个叫libstdcpp.ipk的包安装就好了。。

对不起,我眼瞎了,只关注着第二步的教程。哈哈

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

image如果你编译polarssl版本是不用安装这个的

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

image如果你编译polarssl版本是不用安装这个的

我到最后才发现我的路由刷的说老毛子固件,刚刷了openwrt来测试ngrokc,哈哈

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

image如果你编译polarssl版本是不用安装这个的

我编译的是polarssl的,但运行时的确报错了,编译过程缺了什么嘛
image

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

image如果你编译polarssl版本是不用安装这个的

大哥,我按照这个帖子5#操作后可以使用了,真鸡儿开心,哈哈
https://forum.archive.openwrt.org/viewtopic.php?id=5446

image

from ngrok-c.

dosgo avatar dosgo commented on September 3, 2024

懒得理你,你看看我在前面是不是跟你说过,你自己搞混淆了,记成libopenssl了。。

from ngrok-c.

onlyJinx avatar onlyJinx commented on September 3, 2024

懒得理你,你看看我在前面是不是跟你说过,你自己搞混淆了,记成libopenssl了。。

哈哈,毕竟我都没玩过Linux,一路Google过来的,谢啦!

from ngrok-c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.