Hi,
It sounds like you want to use a shared object library inside your RCC
Worker.
Is this correct?
If so, a quick way to do that is:
* Add the include directory for the library to the `includedirs`
attribute of your `rccworker`.
* It sounds like you've done this, or have worked out an alternative way.
* Create a `Makefile` inside your `<worker>.rcc` directory.
* The `Makefile` should end with: `include $(OCPI_CDK_DIR)/include/worker.mk
`
* Before that you need to use `RccCustomLibs` to say where your shared
object library is:
* `RccCustomLibs=/path/to/shared/object/library/lib.so`
If you need a different shared object for various platforms, you can write
`RccCustomLibs_<platform>` instead.
AFAIK, there is no way to do this style of library include solely in XML at
the moment.
There is another approach to integrating external libraries using the
`prerequisites` folders, but this is more involved and I think undocumented
(although I could be wrong).
If you'd instead like to compile the library into your RCC Worker directly,
you can add the specific source files to the `sourcefiles` attriibute in
your `rccworker`.
Kind Regards,
D. Walters
On Thu, Apr 20, 2023 at 1:19 PM <dwp_at_md1tech.co.uk> wrote:
> Hello,
>
> My objective is to develop an RCC worker that can utilise an external
> library which is not inherently integrated into openCPI. With standard C++,
> I would achieve this by simply adding the required include path and library
> to the makefile.
>
> As an example, I attempted to construct a worker that could host a
> CivetWeb server. The first issue I ran into was getting the worker to
> build, giving the error:
>
> In file included from *source.cc:14*:
>
> *web.h:4:10:* *fatal error: *CivetServer.h: No such file or directory
>
> 4 | #include *“CivetServer.hâ€*
>
> | *^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
>
> compilation terminated.
>
> To determine if this was the sole problem, as a temporary solution I
> created a folder named 'civetweb' within 'source.rcc' containing the
> civetweb source code. Allowing it to be accessed directly. The component
> then compiled successfully.
>
>
> I created an application that solely comprised of this worker, but when
> trying to run the application I got the following error:
>
> app failed: Could not open RCC worker file /…/
> local.examples.source.rcc.0.ubuntu22_04.so: error loading "/…/
> local.examples.source.rcc.0.ubuntu22_04.so": /…/
> local.examples.source.rcc.0.ubuntu22_04.so: undefined symbol:
> _ZN12CivetHandler9handleGetEP11CivetServerP13mg_connectionPi
>
> make: *** [/…/opencpi/cdk/include/application.mk:70: run] Error 1
>
>
> Has anyone successfully used an external C++ library in a worker in this
> way? Any guidance would be really appreciated.
>
> Thanks in advance,
>
> Dan
> _______________________________________________
> discuss mailing list -- discuss_at_lists.opencpi.org
> To unsubscribe send an email to discuss-leave_at_lists.opencpi.org
>
Received on Thu Apr 20 2023 - 12:43:41 CDT