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
496 stars 203 forks source link

编译时报错 #73

Closed onlyJinx closed 5 years ago

onlyJinx commented 5 years ago

我用的是编译polarssl库那个方法,在编译polarssl库时能正常生成文件;然后也复制到ngrok-c下了,所有操作都和教程一样,在执行openwrtbuild.sh报错了,SDK的问题自己Google解决了,这个问题我搞不定,请大家提示一下哪里错了,哈哈 机器ubuntu16,编译给K2路由(mipsle)

openwrtbuild.sh里的CC=mipsel-openwrt-linux-g++我改成SDK里的g++(mipsel-openwrt-linux-uclibc-g++)也不行

ng ng2

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

onlyJinx commented 5 years ago

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

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

ng ng2 ng3

dosgo commented 5 years ago

最重要的错误呢。。

onlyJinx commented 5 years ago

最重要的错误呢。。

我直接贴在下面了,麻烦看一下,已经把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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

那你找找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

dosgo commented 5 years ago

代码是最新的吗

onlyJinx commented 5 years ago

代码是最新的吗

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

dosgo commented 5 years ago

不要1.48,直接git拉------------------ 原始邮件 ------------------ 发件人: "onlyJinx"notifications@github.com 发送时间: 2019年8月12日(星期一) 中午12:36 收件人: "dosgo/ngrok-c"ngrok-c@noreply.github.com; 抄送: "dosgo"dosgo@qq.com;"Comment"comment@noreply.github.com; 主题: 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.

onlyJinx commented 5 years ago

不要1.48,直接git拉------------------ 原始邮件 ------------------ 发件人: "onlyJinx"notifications@github.com 发送时间: 2019年8月12日(星期一) 中午12:36 收件人: "dosgo/ngrok-c"ngrok-c@noreply.github.com; 抄送: "dosgo"dosgo@qq.com;"Comment"comment@noreply.github.com; 主题: 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

dosgo commented 5 years ago

那你就把1.48的拿过来用

onlyJinx commented 5 years ago

那你就把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 functionRemoteSslInit(Sockinfo)': ngrok.cpp:(.text+0x32c): undefined reference to ssl_write' build-mips/ngrok.o: In functionLocalToRemote(Sockinfo, ssl_info)': ngrok.cpp:(.text+0x40c): undefined reference to ssl_write' build-mips/ngrok.o: In functionConnectMain(int, sockaddr_in, ssl_info*)': ngrok.cpp:(.text+0x780): undefined reference to x509_crt_free' ngrok.cpp:(.text+0x788): undefined reference tossl_free' ngrok.cpp:(.text+0x790): undefined reference to ctr_drbg_free' ngrok.cpp:(.text+0x798): undefined reference toentropy_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 tossl_write' ngrok.cpp:(.text+0x1370): undefined reference to ssl_write' build-mips/ngrok.o: In functionRemoteToLocal(ssl_info, Sockinfo)': ngrok.cpp:(.text+0x1484): undefined reference to ssl_read' build-mips/ngrok.o: In functionConnectLocal(ssl_info, Sockinfo)': ngrok.cpp:(.text+0x1888): undefined reference to ssl_read' build-mips/ngrok.o: In functionSendAuth(int, _ssl_context)': ngrok.cpp:(.text._Z8SendAuthiP12_ssl_context[_Z8SendAuthiP12_ssl_context]+0xe0): undefined reference to ssl_write' build-mips/main.o: In functioncheckping()': main.cpp:(.text+0x318): undefined reference to ssl_write' build-mips/main.o: In functionproxy()': main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)' main.cpp:(.text+0x3d0): undefined reference toCheckRegTunnel(int)' main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)' main.cpp:(.text+0x854): undefined reference toUdpRecv(fd_set)' build-mips/main.o: In function main': main.cpp:(.text.startup+0x108): undefined reference toinitUdp()' 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 functionclearsock(Sockinfo)': nonblocking.cpp:(.text+0x30): undefined reference to net_close' nonblocking.cpp:(.text+0x94): undefined reference tossl_close_notify' nonblocking.cpp:(.text+0xa0): undefined reference to x509_crt_free' nonblocking.cpp:(.text+0xa8): undefined reference tossl_free' nonblocking.cpp:(.text+0xb0): undefined reference to ctr_drbg_free' nonblocking.cpp:(.text+0xb8): undefined reference toentropy_free' build-mips/polarsslbio.o: In function ssl_init_info(int*, ssl_info*)': polarsslbio.cpp:(.text+0x2c): undefined reference tox509_crt_init' polarsslbio.cpp:(.text+0x38): undefined reference to entropy_init' polarsslbio.cpp:(.text+0x44): undefined reference toentropy_func' polarsslbio.cpp:(.text+0x54): undefined reference to entropy_func' polarsslbio.cpp:(.text+0x5c): undefined reference toctr_drbg_init' polarsslbio.cpp:(.text+0x6c): undefined reference to ssl_init' polarsslbio.cpp:(.text+0x7c): undefined reference tossl_set_endpoint' polarsslbio.cpp:(.text+0x88): undefined reference to ssl_set_authmode' polarsslbio.cpp:(.text+0xa0): undefined reference tossl_set_ca_chain' polarsslbio.cpp:(.text+0xb4): undefined reference to ssl_set_rng' polarsslbio.cpp:(.text+0xa8): undefined reference toctr_drbg_random' polarsslbio.cpp:(.text+0xb8): undefined reference to ctr_drbg_random' polarsslbio.cpp:(.text+0xbc): undefined reference tonet_recv' polarsslbio.cpp:(.text+0xd0): undefined reference to net_recv' polarsslbio.cpp:(.text+0xc0): undefined reference tonet_send' polarsslbio.cpp:(.text+0xd4): undefined reference to net_send' polarsslbio.cpp:(.text+0xdc): undefined reference tossl_set_bio' polarsslbio.cpp:(.text+0xf4): undefined reference to ssl_set_session' polarsslbio.cpp:(.text+0xfc): undefined reference tossl_handshake' polarsslbio.cpp:(.text+0x158): undefined reference to ssl_handshake' polarsslbio.cpp:(.text+0x168): undefined reference tossl_get_verify_result' polarsslbio.cpp:(.text+0x17c): undefined reference to `ssl_get_session' collect2: error: ld returned 1 exit status

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

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

dosgo commented 5 years ago

啥1.3啊?

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

onlyJinx commented 5 years ago

啥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 functionRemoteSslInit(Sockinfo)':
ngrok.cpp:(.text+0x32c): undefined reference to ssl_write' build-mips/ngrok.o: In functionLocalToRemote(Sockinfo
, ssl_info)':
ngrok.cpp:(.text+0x40c): undefined reference to ssl_write' build-mips/ngrok.o: In functionConnectMain(int
, sockaddr_in, ssl_info*)':
ngrok.cpp:(.text+0x780): undefined reference to x509_crt_free' ngrok.cpp:(.text+0x788): undefined reference tossl_free'
ngrok.cpp:(.text+0x790): undefined reference to ctr_drbg_free' ngrok.cpp:(.text+0x798): undefined reference toentropy_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 tossl_write'
ngrok.cpp:(.text+0x1370): undefined reference to ssl_write' build-mips/ngrok.o: In functionRemoteToLocal(ssl_info
, Sockinfo)':
ngrok.cpp:(.text+0x1484): undefined reference to ssl_read' build-mips/ngrok.o: In functionConnectLocal(ssl_info
, Sockinfo)':
ngrok.cpp:(.text+0x1888): undefined reference to ssl_read' build-mips/ngrok.o: In functionSendAuth(int, _ssl_context
)':
ngrok.cpp:(.text._Z8SendAuthiP12_ssl_context[_Z8SendAuthiP12_ssl_context]+0xe0): undefined reference to ssl_write' build-mips/main.o: In functioncheckping()':
main.cpp:(.text+0x318): undefined reference to ssl_write' build-mips/main.o: In functionproxy()':
main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)' main.cpp:(.text+0x3d0): undefined reference toCheckRegTunnel(int)'
main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)' main.cpp:(.text+0x854): undefined reference toUdpRecv(fd_set)'
build-mips/main.o: In function main': main.cpp:(.text.startup+0x108): undefined reference toinitUdp()'
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 functionclearsock(Sockinfo
)':

dosgo commented 5 years ago

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

dosgo commented 5 years ago

如果有mips字样应该就对,

onlyJinx commented 5 years ago

如果有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

dosgo commented 5 years ago

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

dosgo commented 5 years ago

linux 用readelf -h xx.a吧

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

onlyJinx commented 5 years ago

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

image

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

请问这样改对吗? image

dosgo commented 5 years ago

试试,没错

onlyJinx commented 5 years ago

试试,没错

改完之后是这样的报错 [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 functionx509_profile_check_key.isra.4':
x509_crt.c:(.text+0x21c): undefined reference to mbedtls_pk_get_type' x509_crt.c:(.text+0x2a4): undefined reference tombedtls_pk_get_bitlen'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_info': x509_crt.c:(.text+0x6b0): undefined reference tombedtls_pk_get_name'
x509_crt.c:(.text+0x6d0): undefined reference to mbedtls_pk_get_bitlen' x509_crt.c:(.text+0x7e8): undefined reference tombedtls_oid_get_extended_key_usage'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_verify_restartable': x509_crt.c:(.text+0x126c): undefined reference tombedtls_pk_get_type'
x509_crt.c:(.text+0x14d0): undefined reference to mbedtls_md_info_from_type' x509_crt.c:(.text+0x14e8): undefined reference tombedtls_md'
x509_crt.c:(.text+0x14fc): undefined reference to mbedtls_pk_can_do' x509_crt.c:(.text+0x1518): undefined reference tombedtls_md_get_size'
x509_crt.c:(.text+0x1548): undefined reference to mbedtls_pk_verify_ext' x509_crt.c:(.text+0x16e8): undefined reference tombedtls_md_info_from_type'
x509_crt.c:(.text+0x1700): undefined reference to mbedtls_md' x509_crt.c:(.text+0x1740): undefined reference tombedtls_md_get_size'
x509_crt.c:(.text+0x1770): undefined reference to mbedtls_pk_verify_ext' libmbedx509.a(x509_crt.o): In functionmbedtls_x509_crt_free':
x509_crt.c:(.text+0x1b9c): undefined reference to mbedtls_pk_free' libmbedx509.a(x509_crt.o): In functionmbedtls_x509_crt_parse_der':
x509_crt.c:(.text+0x1dc8): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x1e48): undefined reference tombedtls_asn1_get_tag'
x509_crt.c:(.text+0x1e78): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x1fa4): undefined reference tombedtls_asn1_get_int'
x509_crt.c:(.text+0x204c): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2098): undefined reference tombedtls_asn1_get_tag'
x509_crt.c:(.text+0x20c8): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x211c): undefined reference tombedtls_pk_parse_subpubkey'
x509_crt.c:(.text+0x2358): undefined reference to mbedtls_asn1_get_sequence_of' x509_crt.c:(.text+0x23a8): undefined reference tombedtls_asn1_get_tag'
x509_crt.c:(.text+0x23d0): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2404): undefined reference tombedtls_asn1_get_bool'
x509_crt.c:(.text+0x2428): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2450): undefined reference tombedtls_oid_get_x509_ext_type'
x509_crt.c:(.text+0x2518): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x2568): undefined reference tombedtls_asn1_get_len'
x509_crt.c:(.text+0x2660): undefined reference to mbedtls_asn1_get_bitstring' x509_crt.c:(.text+0x26e4): undefined reference tombedtls_asn1_get_bitstring'
x509_crt.c:(.text+0x2734): undefined reference to mbedtls_asn1_get_tag' x509_crt.c:(.text+0x275c): undefined reference tombedtls_asn1_get_bool'
x509_crt.c:(.text+0x2778): undefined reference to mbedtls_asn1_get_int' x509_crt.c:(.text+0x27b0): undefined reference tombedtls_asn1_get_int'
libmbedx509.a(x509_crt.o): In function mbedtls_x509_crt_parse': x509_crt.c:(.text+0x2880): undefined reference tombedtls_pem_init'
x509_crt.c:(.text+0x28a4): undefined reference to mbedtls_pem_read_buffer' x509_crt.c:(.text+0x28c8): undefined reference tombedtls_pem_free'
x509_crt.c:(.text+0x2970): undefined reference to mbedtls_pem_free' libmbedx509.a(x509_crt.o): In functionmbedtls_x509_crt_parse_file':
x509_crt.c:(.text+0x29d4): undefined reference to mbedtls_pk_load_file' libmbedx509.a(x509_crt.o): In functionx509_get_uid':
x509_crt.c:(.text.unlikely+0x30): undefined reference to mbedtls_asn1_get_tag' build-mips/main.o: In functionproxy()':
main.cpp:(.text+0x3bc): undefined reference to CheckUdpAuth(int)' main.cpp:(.text+0x3d0): undefined reference toCheckRegTunnel(int)'
main.cpp:(.text+0x3e4): undefined reference to CheckUdpPing(int)' main.cpp:(.text+0x854): undefined reference toUdpRecv(fd_set*)'
build-mips/main.o: In function main': main.cpp:(.text.startup+0x108): undefined reference toinitUdp()'
libmbedtls.a(ssl_tls.o): In function ssl_calc_finished_tls_sha256': ssl_tls.c:(.text+0x1a4): undefined reference tombedtls_sha256_init'
ssl_tls.c:(.text+0x1d8): undefined reference to mbedtls_sha256_clone' ssl_tls.c:(.text+0x224): undefined reference tombedtls_sha256_finish_ret'
ssl_tls.c:(.text+0x284): undefined reference to mbedtls_sha256_free' libmbedtls.a(ssl_tls.o): In functionssl_calc_verify_tls_sha256':
ssl_tls.c:(.text+0x30c): undefined reference to mbedtls_sha256_init' ssl_tls.c:(.text+0x340): undefined reference tombedtls_sha256_clone'
ssl_tls.c:(.text+0x34c): undefined reference to mbedtls_sha256_finish_ret' ssl_tls.c:(.text+0x3a0): undefined reference tombedtls_sha256_free'
libmbedtls.a(ssl_tls.o): In function tls_prf_generic': ssl_tls.c:(.text+0x400): undefined reference tombedtls_md_init'
ssl_tls.c:(.text+0x408): undefined reference to mbedtls_md_info_from_type' ssl_tls.c:(.text+0x418): undefined reference tombedtls_md_get_size'
ssl_tls.c:(.text+0x478): undefined reference to mbedtls_md_setup' ssl_tls.c:(.text+0x4c8): undefined reference tombedtls_md_hmac_starts'
ssl_tls.c:(.text+0x4d8): undefined reference to mbedtls_md_hmac_update' ssl_tls.c:(.text+0x4e4): undefined reference tombedtls_md_hmac_finish'
ssl_tls.c:(.text+0x500): undefined reference to mbedtls_md_hmac_reset' ssl_tls.c:(.text+0x510): undefined reference tombedtls_md_hmac_update'
ssl_tls.c:(.text+0x51c): undefined reference to mbedtls_md_hmac_finish' ssl_tls.c:(.text+0x524): undefined reference tombedtls_md_hmac_reset'
ssl_tls.c:(.text+0x534): undefined reference to mbedtls_md_hmac_update' ssl_tls.c:(.text+0x540): undefined reference tombedtls_md_hmac_finish'
ssl_tls.c:(.text+0x594): undefined reference to mbedtls_md_free' libmbedtls.a(ssl_tls.o): In functiontls1_prf':

onlyJinx commented 5 years ago

试试,没错

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

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

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

image

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

dosgo commented 5 years ago

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

onlyJinx commented 5 years ago

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

emmm,睡觉,晚安。。。 image

image

onlyJinx commented 5 years ago

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

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

image

dosgo commented 5 years ago

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