eclipse-cyclonedds / cyclonedds

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

Is it true that Iceoryx libs are not needed when running CycloneDDS applications built with Iceoryx? #1985

Closed t0ny-peng closed 5 months ago

t0ny-peng commented 5 months ago

I happened to notice this behavior. In my setup, the CycloneDDS example applications were built with SHM enabled -DENABLE_ICEORYX=ON and Iceoryx install dir set by -DCMAKE_PREFIX_PATH=/home/my-name/git/iceoryx/install.

In the runtime, the CycloneDDS XML config contained <PubSubMessageExchange name="iox" library="psmx_iox" config="LOG_LEVEL=DEBUG;"/> to enable Iceoryx, and that can be confirmed by the log of RouDi.

Then, I completely removed the Iceoryx build and install folder, and the above example still worked(given that RouDi is running).

My understand is that when ENABLE_ICEORYX is set, CycloneDDS builds an extra libpsmx_iox.so, which is loaded in the runtime by dl_open if enabled in the XML as a PubSubMessageExchange. However, neither libddsc.so nor libpsmx_iox.so has dependency on any Iceoryx library, therefore explaining why Iceoryx libraries is not needed in the runtime. This can be further confirmed by LD_DEBUG=all ./bin/HelloworldPublisher which does not loads any Iceoryx libraries.

Can I get an official confirmation? Much appreciated.

t0ny-peng commented 5 months ago

Here's the needed libraries for the Helloworld executables

[DESKTOP]➜ /home/my-name/git/cyclonedds/build/bin git:(2ad37f4c) ✗ ls
ddsperf  HelloworldPublisher  HelloworldSubscriber  idlc  RoundtripPing  RoundtripPong  symbol_export_test  ThroughputPublisher  ThroughputSubscriber
[DESKTOP]➜ /home/my-name/git/cyclonedds/build/bin git:(2ad37f4c) ✗ ldd HelloworldPublisher
        linux-vdso.so.1 (0x00007ffff7fcd000)
        libddsc.so.0 => /home/my-name/git/cyclonedds/build/lib/libddsc.so.0 (0x00007ffff7e0c000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7c03000)
        libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007ffff7b70000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007ffff7899000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffff7876000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff786e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fcf000)
[DESKTOP]➜ /home/my-name/git/cyclonedds/build/bin git:(2ad37f4c) ✗ ldd ../lib/libddsc.so.0
        linux-vdso.so.1 (0x00007ffff7fcd000)
        libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007ffff7d62000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007ffff7a8b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffff7a68000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7a62000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7870000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fcf000)
[DESKTOP]➜ /home/my-name/git/cyclonedds/build/bin git:(2ad37f4c) ✗ ldd ../lib/libpsmx_iox.so
        linux-vdso.so.1 (0x00007ffff7fcd000)
        libddsc.so.0 => /home/my-name/git/cyclonedds/build/lib/libddsc.so.0 (0x00007ffff7cba000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffff7c80000)
        libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007ffff7c75000)
        libatomic.so.1 => /lib/x86_64-linux-gnu/libatomic.so.1 (0x00007ffff7c6b000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ffff7c61000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffff7c44000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a52000)
        libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007ffff79bf000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007ffff76e8000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff76e2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fcf000)
[DESKTOP]➜ /home/my-name/git/cyclonedds/build/bin git:(2ad37f4c) ✗
eboasson commented 5 months ago

You're understanding is correct: Cyclone itself (libddsc.so) nowadays never has a direct dependency on Iceoryx, thanks to this PSMX stuff; and this libpsmx_iox.so provides the glue needed to plug Iceoryx in and has a direct dependency on Iceoryx. It is only when you configure this PubSubMessageExchange that libpsmx_iox.so becomes relevant at run-time.

Whether the Iceoryx libraries must be present at run-time also depends on whether libpsmx_iox.so was linked against shared or static libraries of Iceoryx. If they were shared ones, they would show up in the output of ldd libpsmx_iox.so and they would have to be present; if they were static ones the code of Iceoryx was embedded in libpsmx_iox.so and you don't need to have them.

From the output you pasted, I would say you have linked against static libraries and so no, you don't need any Iceoryx library on the machine to run it. Also, IIRC the default build settings of Iceoryx result in static libraries, so it is quite likely that this is the case.

t0ny-peng commented 5 months ago

Thanks @eboasson. I was under the (wrong) assumption that our build infra always builds Iceoryx as shared libraries, and that turned out to be false.

And, could you please delete this issue? I happened to include some sensitive information somewhere and I can't delete it. Thanks!

eboasson commented 5 months ago

I am glad that it was all just an incorrect assumption.

Regarding deleting issues: it is also beyond my powers. I've asked and it needs a strong case before the Eclipse Foundation will consider it. Public issues are obviously not the place for such discussions.