Closed AlgoryxJosef closed 2 years ago
We are on it - my colleague confirmed that the build is broken on Windows (likely due to change in ros2 installation). You can expect a fix soon
@AlgoryxJosef
I tried to reproduce this issue on 3 different machines but without success.
I did some digging however and it looks like the problem is in colcon build
and resolving packages hooks/prefixes. You can confirm that by inspectingbuild/<PACKAGE_WHICH_DID_NOT_BUILD>/colcon_command_prefix_build.ps1.env
and checking CMAKE_PREFIX_PATH
and PYTHONPATH
variables. They should contain install
and install\Lib\site-packages
dirs respectively, but in this case, they most probably are not.
As we can see in this colcon-powershell
function it loads prefixes by running build/<PACKAGE>/colcon_command_prefix_build.ps1
and fetching env variables. colcon_command_prefix_build.ps1.env
is a debug dump of these env variables. Errors like ImportError: cannot import
or could not be found
are most probably caused by invalid PYTHONPATH
and CMAKE_PREFIX_PATH
vars.
As for now, I can't really go deeper without reproducing this issue, so I will focus on this.
You can try a dirty workaround by calling install/local_setup.ps1
in your workspace (even if it didn't build - just ignore errors if some of them shows up) and then retry the ./build.sh
- this should set the vars correctly and build should continue.
Thank you for the quick feedback. I'll do some more tests here, and also try your suggested workaround. I'll update in a few days with my progress.
I've now done some more testing. First off: thank you for the much appreciated guidance; I was able to succesfully complete the build with the workaround proposed (called install/local_setup.ps1) after the initial build error.
It would be nice not having to do the workaround of course, so I tried doing it all over: I removed all of my previous ROS2 installations/builds. Uninstalled all instances of Python, ensuring everything on disk is clean and cleaned up the PATH environment variable.
I carefully followed build instructions for ROS2 Galactic here: https://docs.ros.org/en/galactic/Installation/Windows-Development-Setup.html (I even installed Qt which is actually not really necessary).
My python installation is located at C:\Python38 .
Installed everything listed in the Prerequisites and did the things under Important notice here (like longFilePath and nuget source (which already existed), and creating the C:\ci\ws\install\include directory etc.): https://github.com/RobotecAI/ros2cs/blob/master/README-WINDOWS.md
Still, I get the same error, see log file: Build_err_source_buit_ros2_Windows.md
My colcon_command_prefix_build.ps1 looks like this: colcon_command_prefix_build.ps1.txt
The things you wrote about PYTHONPATH
and CMAKE_PREFIX_PATH
seems highly relevant though.
I can confirm that once I've called C:\dev\ros2_galactic\install\local_setup.ps1
and ran ros2cs\pull_repositories.ps1
, my PYTHONPATH
points only to C:\dev\ros2_galactic\install\Lib\site-packages;
and CMAKE_PREFIX_PATH
points only to C:\dev\ros2_galactic\install
. But after running the ros2cs\install\local_setup.ps1
, my PYTHONPATH
now has a new added entry C:\dev\ros2cs\install\Lib\site-packages
and my CMAKE_PREFIX_PATH
has gotten an added entry C:\dev\ros2cs\install
and with that, I can build everything succesfully (although I noticed many size_t to int conversion warnings, perhaps interesting to have a look at).
Is there any guesses to what has gone wrong here for me?
@pijaro can you share your recent discoveries?
@AlgoryxJosef I think I found the issue. The problem is executing Powershell scripts via python asyncio
- one of the "middleware" scripts dies quietly because of invalid execution permissions. Most probably, your PowerShell has an invalid execution policy.
Please try to run
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
to set your PowerShell policy to bypass
. Then the build should finish just fine.
The weird thing is that the Unrestricted
policy is enough for one Windows system, but it is insufficient for others (like the one I tested and reproduced the issue). I guess that may be connected with PowerShell config propagation in the Windows system; I can't tell.
A fantastic find! This indeed fixed my issue, thank you. Closing this.
Still getting this error when building for ros2 iron. Any Suggestions?
I originally posted an issue when trying to build ros2-for-unity (that uses ros2cs) here:
https://github.com/RobotecAI/ros2-for-unity/issues/30
But since then, I have realized that that issue should perhaps be added to this repo instead, so I'm posting it here. Sorry for the mix-up in that case. Depending on where it belongs, I can close this or the other issue and we can keep everything in one of them. The issue detailed below:
I have attemted to build from source, carefully following the instructions. I have tried both with a pre-built ROS2 (Foxy) that I installed from: https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html and also with a ROS2 (Galactic) that I built from source myself. Both versions work fine as-is. I use Windows.
When I try to build the ros2-for-unity project, I get the same error message regardless of which ROS2 installation I source prior to starting the build. It seems to be related to
generate_cs
not beeing found. I get the following error message:I have attached the complete build log, if it helps. ROS-for-Unity-build-err-ros2algoryx.md
I have done a little bit of digging my self, and noticed that the path in
rosidl_generator_cs_module
inside src/ros2cs/src/ros2cs/rosidl_generator_cs/bin/rosidl_generator_cs points to a file that does not exists. It points to something like ros2-for-unity\install\lib\rosidl_generator_cs/init.py but the file actually seems to be located at ros2-for-unity\install\lib\site-packages\rosidl_generator_cs/init.pyI tried manually patching this path, and the build now continued a little while longer, but now I get a new error saying :
So I'm guessing that there may be some other issues as well. I hope this info helps, I would be really exited being able to use ros2-for-unity with custom messages. Let me know if I can help out, I can test certain things here locally for example if it helps.
Best regards, Josef