wheelos / core

Autonomous driving middleware publish subscribe system
Other
23 stars 7 forks source link

feat: add fastrtps as module #29

Closed wep21 closed 1 month ago

wep21 commented 2 months ago
wep21 commented 2 months ago

@daohu527 What do you think about the change?

daohu527 commented 2 months ago

@wep21 Yes, I am ready want to do that, but there are a few problems here.

  1. I need to upgrade the version of fastdds. ref link. After the upgrade, this patch is basically invalid. Someone has reported the deadlock problem to me.
  2. I also need to use blzmod for fastdds's dependencies. I see that the latest fastdds also depends on openssh, so I think these also need to be clarified.

Or if you have any ideas, let's take a look together.

------update-------

seems fastdds cmake just need Foonathan memory and Fast CDR

we can add fastdds here https://github.com/wheelos/bazel-central-registry/tree/fast-dds

wep21 commented 2 months ago

I try to build fastdds 2.14.2 by bzlmod without any patch first. Then, try to apply patch to work with cyberrt. I'm not familiar with the changes, so I appreciate it if you could cowork with me.

daohu527 commented 2 months ago

sure, here is an bazel work about https://github.com/daohu527/Fast-DDS.

daohu527 commented 2 months ago

@wep21 I found foonathan_memory include path is not match with fastdds, The following is the include path parsed by bazel, but it does not match the actual path in bazel-out

-isystem bazel-out/k8-fastbuild/bin/include/foonathan_memory -isystem bazel-out/k8-fastbuild/bin/external/foonathan_memory~/libfoonathan_memory-0.7.3/include 

we should add

+cmake(
+    name = "foonathan_memory",
+    build_args = [
+        "--",
+        "-j4",
+    ],
+    cache_entries = cache_entries,
+    lib_source = ":all_srcs",
+    lib_name = "libfoonathan_memory-0.7.3",
+    out_include_dir = "include/foonathan_memory",   // here
+    visibility = ["//visibility:public"],
+)
daohu527 commented 2 months ago

Currently encountering the following error. here is an example https://onlinegdb.com/FwD2XMYb-f. But I have confirmed that there is a copy constructor

ERROR: /workspaces/Fast-DDS/BUILD:44:11: Compiling src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //:fastdds) 
  (cd /home/codespace/.cache/bazel/_bazel_codespace/f420b8a5550244be0170f8ea34b7a3d3/sandbox/linux-sandbox/907/execroot/_main && \
  exec env - \
    BAZEL_CXXOPTS='-std=c++17' \
    PATH=/usr/local/rvm/gems/ruby-3.2.4/bin:/usr/local/rvm/gems/ruby-3.2.4@global/bin:/usr/local/rvm/rubies/ruby-3.2.4/bin:/vscode/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/bin/remote-cli:/home/codespace/.local/bin:/home/codespace/.dotnet:/home/codespace/nvm/current/bin:/home/codespace/.php/current/bin:/home/codespace/.python/current/bin:/home/codespace/java/current/bin:/home/codespace/.ruby/current/bin:/home/codespace/.local/bin:/usr/local/python/current/bin:/usr/local/py-utils/bin:/usr/local/oryx:/usr/local/go/bin:/go/bin:/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:/usr/local/rvm/gems/default/bin:/usr/local/rvm/gems/default@global/bin:/usr/local/rvm/rubies/default/bin:/usr/local/share/rbenv/bin:/usr/local/php/current/bin:/opt/conda/bin:/usr/local/nvs:/usr/local/share/nvm/versions/node/v20.14.0/bin:/usr/local/hugo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/dotnet:/home/codespace/.dotnet/tools:/usr/local/rvm/bin \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++17' -MD -MF bazel-out/k8-fastbuild/bin/_objs/fastdds/TypeLookupRequestListener.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/_objs/fastdds/TypeLookupRequestListener.pic.o' -fPIC -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/fastcdr~ -iquote bazel-out/k8-fastbuild/bin/external/fastcdr~ -iquote external/tinyxml2~ -iquote bazel-out/k8-fastbuild/bin/external/tinyxml2~ -iquote external/asio~ -iquote bazel-out/k8-fastbuild/bin/external/asio~ -Ibazel-out/k8-fastbuild/bin/external/fastcdr~/_virtual_includes/fastcdr -isystem include -isystem bazel-out/k8-fastbuild/bin/include -isystem src/cpp -isystem bazel-out/k8-fastbuild/bin/src/cpp -isystem src/cpp/utils -isystem bazel-out/k8-fastbuild/bin/src/cpp/utils -isystem thirdparty/filewatch -isystem bazel-out/k8-fastbuild/bin/thirdparty/filewatch -isystem thirdparty/nlohmann-json -isystem bazel-out/k8-fastbuild/bin/thirdparty/nlohmann-json -isystem thirdparty/boost/include -isystem bazel-out/k8-fastbuild/bin/thirdparty/boost/include -isystem thirdparty/taocpp-pegtl -isystem bazel-out/k8-fastbuild/bin/thirdparty/taocpp-pegtl -isystem thirdparty/taocpp-pegtl/pegtl -isystem bazel-out/k8-fastbuild/bin/thirdparty/taocpp-pegtl/pegtl -isystem thirdparty/taocpp-pegtl/pegtl/contrib -isystem bazel-out/k8-fastbuild/bin/thirdparty/taocpp-pegtl/pegtl/contrib -isystem thirdparty/taocpp-pegtl/pegtl/internal -isystem bazel-out/k8-fastbuild/bin/thirdparty/taocpp-pegtl/pegtl/internal -isystem bazel-out/k8-fastbuild/bin/external/foonathan_memory~/libfoonathan_memory-0.7.3/include/foonathan_memory -isystem external/tinyxml2~ -isystem bazel-out/k8-fastbuild/bin/external/tinyxml2~ -isystem external/asio~ -isystem bazel-out/k8-fastbuild/bin/external/asio~ '-std=c++17' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp -o bazel-out/k8-fastbuild/bin/_objs/fastdds/TypeLookupRequestListener.pic.o)
# Configuration: 72be7928349f00dd27dda730d25806a54b2d8c5d1e4dd1f1b16764f75b75f7ef
# Execution platform: @@platforms//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from /usr/include/c++/9/deque:66,
                 from /usr/include/c++/9/queue:60,
                 from src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.hpp:25,
                 from src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp:20:
/usr/include/c++/9/bits/stl_uninitialized.h: In instantiation of '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const eprosima::fastdds::dds::AnnotationDescriptorImpl*, std::vector<eprosima::fastdds::dds::AnnotationDescriptorImpl> >; _ForwardIterator = eprosima::fastdds::dds::AnnotationDescriptorImpl*]':
/usr/include/c++/9/bits/stl_uninitialized.h:307:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const eprosima::fastdds::dds::AnnotationDescriptorImpl*, std::vector<eprosima::fastdds::dds::AnnotationDescriptorImpl> >; _ForwardIterator = eprosima::fastdds::dds::AnnotationDescriptorImpl*; _Tp = eprosima::fastdds::dds::AnnotationDescriptorImpl]'
/usr/include/c++/9/bits/stl_vector.h:555:31:   required from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = eprosima::fastdds::dds::AnnotationDescriptorImpl; _Alloc = std::allocator<eprosima::fastdds::dds::AnnotationDescriptorImpl>]'
src/cpp/fastdds/xtypes/dynamic_types/DynamicTypeMemberImpl.hpp:52:16:   required from here
/usr/include/c++/9/bits/stl_uninitialized.h:127:72: error: static assertion failed: result type must be constructible from value type of input range
  127 |       static_assert(is_constructible<_ValueType2, decltype(*__first)>::value,
      |                                                                        ^~~~~
daohu527 commented 1 month ago

close and move to https://github.com/wheelos/core/pull/32