RobotecAI / ros2-for-unity

High-performance ROS2 solution for Unity3D
Apache License 2.0
448 stars 58 forks source link

dependency of custom message could not be found #49

Closed Deric-W closed 1 year ago

Deric-W commented 1 year ago

Describe the bug The following error occurs while building a part of this package:

C:\dev\ros2-for-unity\build\ros2_custom_msgs\rosidl_generator_cs\ros2_custom_msgs\msg\sphere.cs(31,10): error CS0246: The type or namespace name 'geometry_msgs' could not be found (are you missing a using directive or an assembly reference?) [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly\ros2_custom_msgs_assembly_dotnetcore.csproj] [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly.vcxproj]

To Reproduce Steps to reproduce the behavior:

  1. Follow the tutorial (omit Num.msg and AddThreeInts.srv in msgand CMakeLists.txt)
  2. add the following to ros2_for_unity_custom_messages.repos:
    src/ros2cs/custom_messages/<package_name>:
        type: git
        url: <url>
        version: humble
  1. create a Windows build
  2. watch it fail to build the custom package

Expected behavior The build succeeds

Desktop:

Fix The build succeeds when adding the following to ros2_for_unity_custom_messages.repos:

    src/ros2cs/src/ros2/<package_name>:
        type: git
        url: <url>
        version: humble
pijaro commented 1 year ago

I tried to reproduce the issue but without success.

I created a custom message package from the mentioned tutorial (pijaro/tutorial_interfaces) and set it up in a custom messages file ros2_for_unity_custom_messages.repos:

# NOTE: Use this file if you want to build with custom messages that reside in a separate remote repo.
# NOTE: use the following format

repositories:
#  src/ros2cs/custom_messages/<package_name>:
#    type: git
#    url: <repo_url>
#    version: <repo_branch>
#  custom_messages/<package2_name>:
#    ...
#    ...

    src/ros2cs/custom_messages/tutorial_interfaces:
        type: git
        url: git@github.com:pijaro/tutorial_interfaces.git
        version: main

then .\pull_repositories.ps1 and .\build.ps1. Build succeeded without errors.

Did you check the Windows important notices? A lot of strange errors are most often caused by Windows path restrictions.

Also, It is always a good idea to clear the build and install directories if the workspace dir changed substantially.

A full build log could be useful as well. Maybe the package and repos are correct, but the problem is that the geometry_msgs did not build successfully.

Deric-W commented 1 year ago

Sorry for the long delay, I cleared the build and install directories and it worked, sorry for bothering you.