eclipse-cyclonedds / cyclonedds

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

Helloworld demo compiles but doesn't communicate #1601

Open jack-buffington opened 1 year ago

jack-buffington commented 1 year ago

I am evaluating different DDS implementations for a project that I am working on. I have been following along with the instructions located on this page:

https://cyclonedds.io/docs/cyclonedds/latest/getting_started/installation/installation.html

I have managed to compile everything and can run the Helloworld demo but the two programs don't communicate with each-other.

The exact steps that I took to compile and install are below. I have done this on a pretty recent install of Ubuntu 20.04 running on Intel hardware with cmake version 3.16.3. What am I missing?

sudo apt-get install git cmake gcc git clone https://github.com/eclipse-cyclonedds/cyclonedds.git cd cyclonedds mkdir build mkdir install cd build cmake -DCMAKE_INSTALL_PREFIX=../install -DBUILD_EXAMPLES=ON .. Errors: -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Failed -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads - not found cmake --build . --parallel No errors cmake --build . --target install No errors

In one terminal from build/bin: ./HelloworldPublisher

In another terminal from build/bin: ./HelloworldSubscriber

The results are:

Publisher: === [Publisher] Waiting for a reader to be discovered ...

Subscriber: === [Subscriber] Waiting for a sample ...

eboasson commented 1 year ago

The only thing that comes to mind immediately is the possibility that you have a firewall blocking incoming traffic on the Ethernet and this preventing discovery from succeeding.

You could try forcing it to use the loopback interface instead, by making a configuration file like:

<CycloneDDS>
  <Domain id="any">
    <General>
      <Interfaces>
        <NetworkInterface address="127.0.0.1"></NetworkInterface>
      </Interfaces>
    </General>
  </Domain>
</CycloneDDS>

For example, put this in cyclonedds.xml and then set CYCLONEDDS_URI=$PWD/cyclonedds.xml. There are more ways of doing this (for example, if you search a bit on GitHub you'll find many comments from me where I put "abbreviated XML" directly in the environment variable) but this is the "proper" way.

(There is also more information in the README.)

I have to say I find this:

Errors:
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Failed
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads - not found

intriguing to say the least. I've never seen them, but clearly they have not caused any problems because otherwise the build would have failed!