Want to build openthread for linux - c++

I want to build openthread for Linux (POSIX) and using the library, I want to develop a CoAP client application.
Right now I have disabled UDP_FORWARD in Makefile-posix and enabled OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1 in src/core/config/platform.h file.
My build is failing with the following error:
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
My ultimate goal is to use openthread library and develop a Coap Client application. Can anybody help me on this?

Enabling OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE requires an implementation of the otPlatUdp* APIs.
For Linux, you can look to the POSIX app https://github.com/openthread/openthread/tree/master/src/posix.

Related

Trying to install qt-pods on windows

Im trying to install qt-pods on windows.
I downloaded the qt-pods package from github to my pc.
then i went into the folder and tried to run qmake && make.
the qmake succeed with no errors (i did it also alone for checking) but the 'make' threw me the following errors:
...a lot of errors like this...
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.text$_ZN10PodManagerD0Ev[_ZN10PodManagerD0Ev]+0x14): undefined reference to `__imp__ZN7QObjectD2Ev'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.text.startup+0x3): undefined reference to `__imp__ZN7QObject16staticMetaObjectE'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x38): undefined reference to `QObject::event(QEvent*)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x40): undefined reference to `QObject::eventFilter(QObject*, QEvent*)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x48): undefined reference to `QObject::timerEvent(QTimerEvent*)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x50): undefined reference to `QObject::childEvent(QChildEvent*)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x58): undefined reference to `QObject::customEvent(QEvent*)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x60): undefined reference to `QObject::connectNotify(QMetaMethod const&)'
F:\Users\matan_000\Documents\Programming\c++-libraries\qt-pods\qt-pods-core\release/libqt-pods-core.a(moc_podmanager.o):moc_podmanager.cpp:(.rdata$_ZTV10PodManager[_ZTV10PodManager]+0x68): undefined reference to `QObject::disconnectNotify(QMetaMethod const&)'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile.Release:87: release\qt-pods-gui.exe] Error 1
make[2]: Leaving directory 'F:/Users/matan_000/Documents/Programming/c++-libraries/qt-pods/qt-pods-gui'
make[1]: *** [Makefile:36: release] Error 2
make[1]: Leaving directory 'F:/Users/matan_000/Documents/Programming/c++-libraries/qt-pods/qt-pods-gui'
make: *** [Makefile:95: sub-qt-pods-gui-make_first] Error 2
and a lot of errors like this before...
Im almost hopeless...
I will be happy to help! thank you! :)

undefined reference error while installing OpenCV not compiling

I tried to find the same case as mine, but I couldn't. Most of them here are about undefined reference error during compiling their own code, but in my case this error occurred while installing OpenCV.
I referred to this page :
http://milq.github.io/install-opencv-ubuntu-debian/
I use armv7l and debian-scratch 9.3.
I tried to install OpenCV 3.4.0
I have this error :
[ 31%] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/akaze.cpp.o
//usr/lib/libgdal.so.20: undefined reference to `XML_SetUserData'
//usr/lib/libgdal.so.20: undefined reference to `XML_SetUnknownEncodingHandler'
//usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0: undefined reference to `FT_Set_Char_Size'
//usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5: undefined reference to `glGenerateMipmap'
//usr/lib/arm-linux-gnueabihf/libQt5Gui.so.5: undefined reference to `glUniform2fv'
//usr/lib/arm-linux-gnueabihf/libbluray.so.1: undefined reference to `FT_GlyphSlot_Embolden'
...
//usr/lib/arm-linux-gnueabihf/libavcodec.so.57: undefined reference to `deflateReset'
/usr/bin/ld: ../../bin/opencv_annotation: hidden symbol `atexit' in /usr/lib/arm-linux-gnueabihf/libc_nonshared.a(atexit.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:100: recipe for target 'bin/opencv_annotation' failed
make[2]: *** [bin/opencv_annotation] Error 1
CMakeFiles/Makefile2:4690: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed
make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I found out it's from a linking library error, but as I'm a beginner of Linux, it couldn't help me.
I hope this question is clear.

Normaliz undefined reference to `boost::system::system_category()'

I'm trying to install the library Normaliz having dependencies like CocoALib, SCIP. I've made its dependencies according to their guidances. However, I get the error while make of Normaliz on both Ubuntu and Mac OSX,
[ 81%] Linking CXX executable normaliz
libnormaliz/libnormaliz.so.3.4.0: undefined reference to `boost::system::system_category()'
libnormaliz/libnormaliz.so.3.4.0: undefined reference to `boost::system::generic_category()'
collect2: error: ld returned 1 exit status
CMakeFiles/normaliz.dir/build.make:99: recipe for target 'normaliz' failed
make[2]: *** [normaliz] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/normaliz.dir/all' failed
make[1]: *** [CMakeFiles/normaliz.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I really fed up with it since two weeks! How can it be overcome?
Even if it is boost linkage problem, how can it be linked? There is no option for it. That kinda headaches cause apathy to open-source at least for young programmers like me.

How to fix undefined reference to `__imp_WSACleanup' (Boost.Asio) in CLion

My C++ project includes Boost and WebSocket++ libs. I read other topics I need to add -lws2_32 to gcc command, but I've CLion and I don't know how to fix it.
Console:
CMakeFiles\WsServer.dir/objects.a(main.cpp.obj): In function `boost::asio::detail::winsock_init_base::startup(boost::asio::detail::winsock_init_base::data&, unsigned char, unsigned char)':
C:/MinGW/include/boost/asio/detail/impl/winsock_init.ipp:39: undefined reference to `__imp_WSAStartup'
CMakeFiles\WsServer.dir/objects.a(main.cpp.obj): In function `boost::asio::detail::winsock_init_base::cleanup(boost::asio::detail::winsock_init_base::data&)':
C:/MinGW/include/boost/asio/detail/impl/winsock_init.ipp:56: undefined reference to `__imp_WSACleanup'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\WsServer.dir\build.make:99: WsServer.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:67: CMakeFiles/WsServer.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:79: CMakeFiles/WsServer.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: WsServer] Error 2
What I should do?
You can pass ws2_32 via target_link_libraries in your CMakeLists.txt, e.g.:
if(MINGW)
target_link_libraries(YourTargetName ws2_32)
endif()

Attempting to install FBLuaLib

FbLuaLib: https://github.com/facebook/fblualib
To install FBLuaLib, I need to install thpp: https://github.com/facebook/thpp
I can build folly, fbthrift just fine, but when I run ./build.sh for thpp I get the following error message:
Linking CXX executable tensor_serialization_test
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so: undefined reference to `virtual thunk to folly::AsyncSSLSocket::closeNow()'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so: undefined reference to `virtual thunk to
folly::AsyncSSLSocket::getRawBytesWritten() const'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so: undefined reference to `virtual thunk to
folly::AsyncSSLSocket::setEorTracking(bool)'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so:
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so: undefined reference to `virtual thunk to
folly::AsyncSSLSocket::performRead(void*, unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libthriftcpp2.so
collect2: error: ld returned 1 exit status
test/CMakeFiles/tensor_serialization_test.dir/build.make:95: recipe for
target 'test/tensor_serialization_test' failed
make[2]: *** [test/tensor_serialization_test] Error 1
CMakeFiles/Makefile2:240: recipe for target 'test/CMakeFiles
/tensor_serialization_test.dir/all' failed
make[1]: *** [test/CMakeFiles/tensor_serialization_test.dir/all] Error 2
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2