eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
854 stars 352 forks source link

idlc has dependencies on iceoryx and others #1288

Open sumanth-nirmal opened 2 years ago

sumanth-nirmal commented 2 years ago

Required information

Operating system: Ubuntu 20.04 LTS

Compiler version: GCC 8.4.0

Observed result or behaviour:

With this https://github.com/eclipse-cyclonedds/cyclonedds/pull/1282/ we now enable topic/type discovery by default. However now this makes idlc to depend on iceoryx and others:

ldd on the current idlc is as follows

    linux-vdso.so.1 (0x00007ffe6b322000)
    libcycloneddsidl.so.0 => /opt/cyclonedds/x86_64/cyclonedds/lib/libcycloneddsidl.so.0 (0x00007f117a4b0000)
    libddsc.so.0 => /opt/cyclonedds/x86_64/cyclonedds/lib/libddsc.so.0 (0x00007f117a392000)
    libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007f117a350000)
    libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007f117a15e000)
    libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f117a13b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f117a591000)
    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f117a0a6000)
    libiceoryx_binding_c.so => /opt/iceoryx/x86_64/lib/libiceoryx_binding_c.so (0x00007f117a069000)
    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f1179d93000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1179b79000)
    libiceoryx_posh.so => /opt/iceoryx/x86_64/lib/libiceoryx_posh.so (0x00007f1179a73000)
    libiceoryx_hoofs.so => /opt/iceoryx/x86_64/lib/libiceoryx_hoofs.so (0x00007f11799f5000)
    libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007f11798a6000)
    libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f117988b000)
    libiceoryx_platform.so => /opt/iceoryx/x86_64/lib/libiceoryx_platform.so (0x00007f1179886000)
    libacl.so.1 => /usr/lib/x86_64-linux-gnu/libacl.so.1 (0x00007f117987b000)
    librt.so.1 => /usr/lib/x86_64-linux-gnu/librt.so.1 (0x00007f1179871000)

Expected result or behaviour:

Ideally the idlc as a tool doesn't need to depend on iceoryx, the dependencies for idlc should be straightforward as below

    linux-vdso.so.1 (0x00007ffdc9545000)
    libcycloneddsidl.so.0 => /opt/cyclonedds/x86_64/cyclonedds/lib/libcycloneddsidl.so.0 (0x00007f7da4f87000)
    libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7da4f45000)
    libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007f7da4d53000)
    libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7da4d30000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7da5051000)

Details

After looking into the code a bit these additional dependencies are pulled into idlc because of including "dds/ddsi/ddsi_cdrstream.h" in https://github.com/eclipse-cyclonedds/cyclonedds/blob/03aeb611debb4f0e25ac41b220f3a6ac35118bc3/src/tools/idlc/src/descriptor_type_meta.c#L21 which will eventually include , this has the iceoryx related entities.

I think this will need some restructuring of the code to not pull in undesired dpendencies

eboasson commented 2 years ago

Thanks for pointing this out @sumanth-nirmal, you're right that's an unintended consequence from reusing the serialiser from the core library to construct the type objects required by XTypes. We are looking at restructuring the integration with Iceoryx a bit so that the integration points are abstracted into a proper interface. That has the nice side effect that the core library (libddsc.so) will be able to dynamically load Iceoryx instead of requiring it to be linked directly to it. That's not a trivial bit of work, so it will take some time.

I assume this is not an urgent problem? Because if it is a showstopper, we may have to figure out some workaround.

sumanth-nirmal commented 2 years ago

@eboasson It will be a showstopper as is! However, the workaround, for now, is to disable the Topic/Type discovery as below to not have additional dependencies with the idlc.

-option(ENABLE_TYPE_DISCOVERY "Enable Type Discovery support" ON)
-option(ENABLE_TOPIC_DISCOVERY "Enable Topic Discovery support" ON)
+option(ENABLE_TYPE_DISCOVERY "Enable Type Discovery support" OFF)
+option(ENABLE_TOPIC_DISCOVERY "Enable Topic Discovery support" OFF)

We will disable the Topic/Type discovery for now, until this issue is fixed.