0

I am trying to learn dds. According to the tutorial, Appendix 1 suggests to look at examples on provided in github called dds-examples-cpp-ex.

The simple commands to build this examples according to readme is cmake . && make

I execute the command

cmake . && make

from the cmake directory of this folder after cloning it on my local machine

I get the following error:

CMake Error at CMakeLists.txt:28 (FIND_PACKAGE):
  By not providing "FindOpenSplice.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "OpenSplice", but CMake did not find one.

  Could not find a package configuration file provided by "OpenSplice" with
  any of the following names:

    OpenSpliceConfig.cmake
    opensplice-config.cmake

  Add the installation prefix of "OpenSplice" to CMAKE_PREFIX_PATH or set
  "OpenSplice_DIR" to a directory containing one of the above files.  If
  "OpenSplice" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!
See also "/home/gajendra/Documents/AnokhiDocs/DDS/dds-tutorial-cpp-ex/cmake/CMakeFiles/CMakeOutput.log".

I tried to locate OpenSpliceConfig.cmake && opensplice-config.cmake on my system but I did not get any result.

My question is how can I correct the paths or fix this error?

I have OpenSplice running on my local machine and I have executed other examples directly from $OSPL_HOME/opensplice/dcps/Tutorial. and they work fine.

I also tried to build ch1. I edited the second line in ch1/CMakeLists.txt from

set(CMAKE_MODULE_PATH ../cmake)

to

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)

so that it can find cmake folder in the root directory where CMakeLists.txt resides.

I run into the same problem when I execute the following:

    cd ch1 && mkdir build && cd build && cmake ..

CMake Error at /home/gajendra/Documents/AnokhiDocs/DDS/dds-tutorial-cpp-ex/cmake/FindOpenSplice.cmake:72 (MESSAGE):Could not find OpenSplice DDS
Call Stack (most recent call first):
 CMakeLists.txt:8 (find_package)
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Anokhi Shah
  • 168
  • 1
  • 8
  • Actually, the script `FindOpenSplice.cmake` noted in the error message exists at [cmake/FindOpenSplice.cmake](https://github.com/ADLINK-IST/dds-tutorial-cpp-ex/blob/master/cmake/FindOpenSplice.cmake). But running `cmake` from the `cmake/` directory is **wrong** (not sure why they provide `CMakeLists.txt` in that directory). There are `ch1/`, `ch2/` and `ch3/` directories, and exactly they contain examples. Run `cmake` from that directories. – Tsyvarev Mar 12 '21 at 11:56
  • "Ofcourse before this error I also get MacroOpenSplice and osmacros not found." - Always say about the **first error** you got. Actually, I find strange that they place **relative** path into `CMAKE_MODULE_PATH` variable. Try to replace the second line in the `ch1/CMakeLists.txt` file - `set(CMAKE_MODULE_PATH ../cmake)` - with `set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)`. – Tsyvarev Mar 12 '21 at 14:35
  • As you could note, the **comments** are badly suited for multiline code or logs. Instead, add such code/logs into the **question post** itself. – Tsyvarev Mar 12 '21 at 15:23
  • cool I move your suggestions and our discussions to the post itself. I will delete the messages because stackoverflow suggests to avoid extended discussions in comments. You could do it too. :) And thanks for the suggestions, I am new to this platform, so this is quite helpful. – Anokhi Shah Mar 12 '21 at 15:36
  • Well, the message `Could not find OpenSplice DDS`, as the script reports about the problem, is not so helpful as it could be: it doesn't contain information what actually has been searched. You could look into `CMakeCache.txt` file in the build directory and find following variables there: `OpenSplice_INCLUDE_DIR`, `KERNEL_LIBRARY`, `DCPSISOCPP_LIBRARY` and `DCPSCPP_LIBRARY`. Which of them are set to NOTFOUND? – Tsyvarev Mar 12 '21 at 16:07

1 Answers1

0

I had the same problem on Ubuntu 20.04 and OpenSplice 6.10.3p1

I just sourced the release.com file in the installation directory, then went to each "ch" folder as suggested by @Tsyvarev and ran cmake . && make from there.

CMake ran successfully afterwards.

makolele12
  • 111
  • 1
  • 10