I am trying to port the Zenoh Protocol to RIOT-OS. I got it working using RIOT's native emulator, but failed to compile the code for a Board.

The problem lies when I am building the git repo's using CMAKE. When I compile it using the gcc and g++ compilers for linux, everything works perfectly.

However when I compile the repos using arm-none-eabi-gcc, the build fails. The repo ZHe gives the following error "fatal error: netinet/in.h: No such file or directory".... #include netinet/in.h>

The repo Zenoh-C gives the following error:

-- Looking for pthread_create - not found"...."Could NOT find Threads (missing: Threads_FOUND)

Zenoh-C Repo Error

-- Check for working C compiler: /bin/arm-none-eabi-gcc

-- Check for working C compiler: /bin/arm-none-eabi-gcc -- works

.....
-- Check for working CXX compiler: /bin/arm-none-eabi-g++

-- Check for working CXX compiler: /bin/arm-none-eabi-g++ -- works
...

-- Configuring on/for Generic

-- Looking for pthread.h

-- Looking for pthread.h - found

-- Looking for pthread_create

-- Looking for pthread_create - not found

-- Check if compiler accepts -pthread

-- Check if compiler accepts -pthread - no
...

CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.13/Modules/FindThreads.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:70 (find_package)

-- Configuring incomplete, errors occurred!

**//ZHe Repo Error**

/home/brenton/Downloads/zhe-master/example/platform/platform-udp.h:4:10: fatal error: netinet/in.h: No such file or directory
 #include netinet/in.h>

compilation terminated.
1

There are 1 best solutions below

0
On

Disclaimer: I am new to RIOT-OS.

The arm-none-eabi toolchain is supposed to be target bare-metal environments.
That means your target environment may not have a pthread library, nor TCP/IP related header files. The the build procedure for the software you are attempting to port was may assume that the pthread library is be present and that required header files are in standard (from a Linux perspective) location.

It seems you are lucky enough that RIOT-OS has a pthread library, and at list the netinet/in.h header file in the sys/posix directory.

That does probably mean that you will need to modify the CMakeLists.txt of the Zenoh package so that include and library directories will point to the RIOT-OS libpthread.a library and the RIOT-OS posix include directories.