Closed dkroenke closed 3 years ago
Hey @dkroenke! Can you give my #108 a try?
@k0ekk0ek I gave it a try and the compilation error changed a bit:
In file included from iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp:24,
from iceoryx/build/iceoryx_dds_messages/Mempool.hpp:48,
from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:23,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp: In constructor ‘ddscxx_sertype<T>::ddscxx_sertype()’:
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:536:38: error: ‘TopicTraits’ is not a member of ‘org::eclipse::cyclonedds::topic’
536 | org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeName(),
| ^~~~~~~~~~~
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:536:51: error: expected primary-expression before ‘>’ token
536 | org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeName(),
| ^
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:536:54: error: ‘::getTypeName’ has not been declared; did you mean ‘typename’?
536 | org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeName(),
| ^~~~~~~~~~~
| typename
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:539:38: error: ‘TopicTraits’ is not a member of ‘org::eclipse::cyclonedds::topic’
539 | org::eclipse::cyclonedds::topic::TopicTraits<T>::isKeyless());
| ^~~~~~~~~~~
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:539:51: error: expected primary-expression before ‘>’ token
539 | org::eclipse::cyclonedds::topic::TopicTraits<T>::isKeyless());
| ^
iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp:539:54: error: ‘::isKeyless’ has not been declared
539 | org::eclipse::cyclonedds::topic::TopicTraits<T>::isKeyless());
| ^~~~~~~~~
In file included from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:23,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/iceoryx_dds_messages/Mempool.hpp: At global scope:
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:97:8: error: ‘topic_type_name’ is not a class template
97 | struct topic_type_name<::Mempool::Chunk>
| ^~~~~~~~~~~~~~~
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:98:1: error: explicit specialization of non-template ‘dds::topic::topic_type_name’
98 | {
| ^
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:110:1: error: expected constructor, destructor, or type conversion before ‘namespace’
110 | namespace org{
| ^~~~~~~~~
In file included from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TTopicDescription.hpp:23,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TopicDescription.hpp:21,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TopicDescription.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/ddstopic.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/dds.hpp:35,
from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:25,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TopicTraits.hpp:46:8: error: ‘dds::topic::topic_type_name’ is not a template
46 | struct topic_type_name
| ^~~~~~~~~~~~~~~
That probably means I have to update my PR too :slightly_smiling_face: I'll have a look
This on top of my PR might work. I'll have do some testing tomorrow. Basically it includes datatopic.hpp
after TopicTraits.hpp
.
diff --git a/src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp b/src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp
index ab7307a..a1e7d71 100644
--- a/src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp
+++ b/src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp
@@ -21,7 +21,6 @@
#include <vector>
#include "org/eclipse/cyclonedds/topic/DataRepresentation.hpp"
-#include "org/eclipse/cyclonedds/topic/datatopic.hpp"
struct ddsi_sertype;
diff --git a/src/idlcxx/src/traits.c b/src/idlcxx/src/traits.c
index 45ac21c..521264c 100644
--- a/src/idlcxx/src/traits.c
+++ b/src/idlcxx/src/traits.c
@@ -182,8 +182,10 @@ generate_traits(const idl_pstate_t *pstate, struct generator *generator)
idl_visitor_t visitor;
const char *sources[] = { NULL, NULL };
- if (idl_fprintf(generator->header.handle, "#include \"org/eclipse/cyclonedds/topic/TopicTraits.hpp\"\n"
- "#include \"org/eclipse/cyclonedds/topic/DataRepresentation.hpp\"\n\n"
+ if (idl_fprintf(generator->header.handle,
+ "#include \"org/eclipse/cyclonedds/topic/TopicTraits.hpp\"\n"
+ "#include \"org/eclipse/cyclonedds/topic/DataRepresentation.hpp\"\n"
+ "#include \"org/eclipse/cyclonedds/topic/datatopic.hpp\"\n\n"
"namespace org {\n"
"namespace eclipse {\n"
"namespace cyclonedds {\n"
@k0ekk0ek
I tested that patch and it helped a bit, nevertheless there are still some errors:
In file included from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:23,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:98:8: error: ‘topic_type_name’ is not a class template
98 | struct topic_type_name<::Mempool::Chunk>
| ^~~~~~~~~~~~~~~
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:99:1: error: explicit specialization of non-template ‘dds::topic::topic_type_name’
99 | {
| ^
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:111:1: error: expected constructor, destructor, or type conversion before ‘namespace’
111 | namespace org{
| ^~~~~~~~~
In file included from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TTopicDescription.hpp:23,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TopicDescription.hpp:21,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TopicDescription.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/ddstopic.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/dds.hpp:35,
from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:25,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/dependencies/install/include/ddscxx/dds/topic/TopicTraits.hpp:46:8: error: ‘dds::topic::topic_type_name’ is not a template
46 | struct topic_type_name
| ^~~~~~~~~~~~~~~
In file included from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:23,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/iceoryx_dds_messages/Mempool.hpp:98:8: note: previous declaration here
98 | struct topic_type_name<::Mempool::Chunk>
| ^~~~~~~~~~~~~~~
In file included from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp:23,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/BuiltinTopic.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp:36,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp:31,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/ContentFilteredTopic.hpp:22,
from iceoryx/build/dependencies/install/include/ddscxx/dds/topic/ddstopic.hpp:25,
from iceoryx/build/dependencies/install/include/ddscxx/dds/dds.hpp:35,
from iceoryx/iceoryx_dds/include/iceoryx_dds/dds/cyclone_data_reader.hpp:25,
from iceoryx/iceoryx_dds/source/iceoryx_dds/dds/cyclone_data_reader.cpp:18:
iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TTopicImpl.hpp: In static member function ‘static void dds::topic::detail::Topic<T>::discover_topics(const DomainParticipant&, std::vector<dds::topic::Topic<T, dds::topic::detail::Topic> >&, uint32_t)’:
iceoryx/build/dependencies/install/include/ddscxx/dds/topic/detail/TTopicImpl.hpp:365:34: error: ‘dds::topic::topic_type_name’ is not a template
365 | dp.delegate()->lookup_topics(topic_type_name<T>::value(), ddsc_topics, max_size);
| ^~~~~~~~~~~~~~~
@dkroenke, my PR has a fix for this too. dds/topic/TopicTraits.hpp
wasn't included by the generated code. We simply never ran into the problem because we included dds/dds.hpp
before including the generated headers. Please let me know if this fix allows you to compile.
I can confirm that this fix work, thanks for that!.
There is still the issue that an Segmentation fault occurs while reading samples from datareader https://github.com/eclipse-cyclonedds/cyclonedds-cxx/issues/64 but that's not part of this issue here.
CycloneDDS version: https://github.com/eclipse-cyclonedds/cyclonedds/commit/7bc432683690ba860a72c662395c07835ce0b3a4 CYcloneDDS-CXX version: https://github.com/eclipse-cyclonedds/cyclonedds-cxx/commit/0add05083ef4c560eb2641ada38432f53d0c3cc8
When using the idlcxx generator in iceoryx, there are some compile errors with the generated code:
This error comes up when trying to use the generated Code from idlcxx.
The idl file for it is here: https://github.com/ApexAI/iceoryx/blob/iox-%23736-update-cyclonedds-to-idlcxx/iceoryx_dds/msg/Mempool.idl
The CMake processing for generating the code: https://github.com/ApexAI/iceoryx/blob/iox-%23736-update-cyclonedds-to-idlcxx/iceoryx_dds/cmake/idlcxx-generate.cmake.in
And attached the generated file: Mempool_generated.zip
Do you have maybe a hint for me what could be possibly wrong here? The cyclone_data_writer hpp and cpp are only including the Mempool.hpp at that places.