0

我想为 Linux (POSIX) 构建 openthread 并使用该库,我想开发一个 CoAP 客户端应用程序。

现在我已经在文件中禁用UDP_FORWARD并启用Makefile-posixOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1src/core/config/platform.h

我的构建失败并出现以下错误:

Making all in apps Making all in cli   CC       ot_cli_ftd-main.o   C
C       ot_cli_mtd-main.o   CCLD     ot-cli-mtd   CCLD     ot-cli-ftd
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Open(void (*)(void*, otMessage*,
otMessageInfo const*), void*)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:84:
undefined reference to `otPlatUdpSocket'
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Bind(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:107:
undefined reference to `otPlatUdpBind'
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Close()':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:141:
undefined reference to `otPlatUdpClose'
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::SendTo(ot::Message&,
ot::Ip6::MessageInfo const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:193:
undefined reference to `otPlatUdpSend'
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Bind(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:114:
undefined reference to `otPlatUdpBind'
../../../src/core/libopenthread-mtd.a(libopenthread_mtd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Connect(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:130:
undefined reference to `otPlatUdpConnect' collect2: error: ld returned
1 exit status Makefile:1284: recipe for target 'ot-cli-mtd' failed
make[5]: *** [ot-cli-mtd] Error 1 make[5]: *** Waiting for unfinished
jobs....
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Open(void (*)(void*, otMessage*,
otMessageInfo const*), void*)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:84:
undefined reference to `otPlatUdpSocket'
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Bind(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:107:
undefined reference to `otPlatUdpBind'
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Close()':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:141:
undefined reference to `otPlatUdpClose'
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::SendTo(ot::Message&,
ot::Ip6::MessageInfo const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:193:
undefined reference to `otPlatUdpSend'
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Bind(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:114:
undefined reference to `otPlatUdpBind'
../../../src/core/libopenthread-ftd.a(libopenthread_ftd_a-udp6.o): In
function `ot::Ip6::UdpSocket::Connect(ot::Ip6::SockAddr const&)':
/home/projects/KNX/openthread/examples/../src/core/net/udp6.cpp:130:
undefined reference to `otPlatUdpConnect' collect2: error: ld returned
1 exit status Makefile:1280: recipe for target 'ot-cli-ftd' failed
make[5]: *** [ot-cli-ftd] Error 1 Makefile:442: recipe for target
'all-recursive' failed make[4]: *** [all-recursive] Error 1
Makefile:444: recipe for target 'all-recursive' failed make[3]: ***
[all-recursive] Error 1 Makefile:601: recipe for target
'all-recursive' failed make[2]: *** [all-recursive] Error 1
Makefile:527: recipe for target 'all' failed make[1]: *** [all] Error
2 examples/Makefile-posix:295: recipe for target
'do-build-x86_64-unknown-linux-gnu' failed make: ***
[do-build-x86_64-unknown-linux-gnu] Error 2

我的最终目标是使用 openthread 库并开发 Coap Client 应用程序。有人可以帮我吗?

4

1 回答 1

0

启用OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE需要实现otPlatUdp*API。

对于 Linux,您可以查看 POSIX 应用程序https://github.com/openthread/openthread/tree/master/src/posix

于 2019-11-27T18:37:42.290 回答