Re: Checking compiler support for userspace C, C++ libs (ZeroMQ)


Stanislav Pobořil
 

Hi Ivan,

I have successfully tried Zephyr with C++ library (eRPC) some time ago.
The version of Zephyr was based on master branch as of March 19th.

However:

    I haven't used zephyr-sdk, I used arm-gcc toolchain instead - standard C++ headers in zephyr-sdk were not complete and build failed in zephyr-sdk.
    I got some compilation warnings as the build system tried to put C only compiler flags to C++ sources. This could be ignored.
    I had the following in project configuration:
        CONFIG_NEWLIB_LIBC=y
        CONFIG_CPLUSPLUS=n     (the demo application and Zerphyr were compiled as C, only eRPC C++ files were compiled as C++)


So your desired ZeroMQ library can have problems in zephyr-sdk, but could be probably build with third party toolchains specific to each architecture.
You may need to create definitions of some C++ operators like operator new, delete if the library does not define it. eRPC library defines it like this: https://github.com/EmbeddedRPC/erpc/blob/master/erpc_c/port/erpc_port_zephyr.cpp
I am not sure about the version of zephyr-sdk I have used. Probably 0.9.4 or 0.9.5. The situation in the actual Zephyr and zephyr-sdk versions may be different now. Search for LIB_CPLUSPLUS in the Zephyr source, this for example includes the C++ operator definitions into a build.

It is also worth noting that eRPC is created with embedded C interoperability in mind. If your ZeroMQ library for example uses C++ exceptions, you would have to work around it somehow.

Best regards,
Staňa

Join devel@lists.zephyrproject.org to automatically receive all group messages.