micro-ROS / micro_ros_platformio

micro-ROS library for Platform.IO
Apache License 2.0
224 stars 80 forks source link

Windows 11 VSCode "'.' is not recognized as an internal or external command" when adding library to lib_deps in platformio.ini #124

Open Darkextratoasty opened 11 months ago

Darkextratoasty commented 11 months ago

Issue template

Steps to reproduce the issue

Note: this procedure works fine on Ubuntu 22.04.

Expected behavior

Project should configure properly.

Actual behavior

Get the error:

Build dev micro-ROS environment failed: 
 '.' is not recognized as an internal or external command,

Additional information

The full output is below:

Resolving teensy41 dependencies...
Library Manager: Installing git+https://github.com/micro-ROS/micro_ros_platformio
git version 2.39.0.windows.2
Cloning into 'C:\Users\joshu\.platformio\.cache\tmp\pkg-installing-atkqsg_i'...

Library Manager: micro_ros_platformio@0.0.1+sha.e87705f has been installed!
Updating metadata for the vscode IDE...
UserSideException: Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.18.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy @ 1.158.0 (1.58) 
 - tool-teensy @ 1.158.0 (1.58) 
 - toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
C:\Users\joshu\.platformio\penv\Scripts\python.exe -m pip install pyyaml
Requirement already satisfied: pyyaml in c:\users\joshu\.platformio\penv\lib\site-packages (6.0.1)

[notice] A new release of pip available: 22.2.2 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip
Installing markupsafe==2.0.1 with pip at PlatformIO environment
C:\Users\joshu\.platformio\penv\Scripts\python.exe -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in c:\users\joshu\.platformio\penv\lib\site-packages (2.0.1)

[notice] A new release of pip available: 22.2.2 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip
Configuring teensy41 with transport serial
Downloading micro-ROS dev dependencies
     - Downloaded ament_cmake
     - Downloaded ament_lint
     - Downloaded ament_package
     - Downloaded googletest
     - Downloaded ament_cmake_ros
     - Downloaded ament_index
Building micro-ROS dev dependencies
Build dev micro-ROS environment failed: 
 '.' is not recognized as an internal or external command,

operable program or batch file.

========================== [FAILED] Took 8.88 seconds ==========================
joshua-8 commented 10 months ago

Hi, I get the same issue on Windows 10.

The . comes from https://github.com/micro-ROS/micro_ros_platformio/blob/e87705fab34ff23f2d117d0185f19fc8698ff081/microros_utils/library_builder.py#L103C29-L103C31 where it appears that it's being used as a synonym for the source command: https://ss64.com/bash/source.html

I don't know why neither "source" nor "." are recognized in the environment that the commands run in.

Hopefully we can keep each other updated as we troubleshoot this and maybe we'll find a solution.

joshua-8 commented 10 months ago

I just found another potential issue: In my .platformio folder (in my windows user folder), there's a folder named penv, but within that there is no /bin folder, only a Scripts folder, though interestingly there is a file called activate, activate.bat, and Activate.ps1 among other files. That might be relevant to this line: https://github.com/micro-ROS/micro_ros_platformio/blob/e87705fab34ff23f2d117d0185f19fc8698ff081/extra_script.py#L97

After editing the library_builder.py and extra_script.py files to use the activate file within the Scripts directory I get a new error:

cd C:\Users\Joshua\Desktop\micro_ros_platformio\examples\micro-ros_publisher\.pio\libdeps\teensy\micro_ros_platformio/build/dev && C:\Users\Joshua\.platformio/penv/Scripts/activate && colcon build --cmake-args -DBUILD_TESTING=OFF -DPython3_EXECUTABLE=`which python`

[note above that I removed the . and the path to activate is different because of my changes]
[the command above was printed by adding print(command) after this line https://github.com/micro-ROS/micro_ros_platformio/blob/e87705fab34ff23f2d117d0185f19fc8698ff081/microros_utils/library_builder.py#L103 for debugging purposes]
----------------------------------------
[I edited utils.py's run_cmd to print sys.version here]
3.11.7 (tags/v3.11.7:fa7a6f2, Dec  4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]

Build dev micro-ROS environment failed: 
 --- stderr: gtest_vendor

Traceback (most recent call last):

  File "C:\Users\Joshua\.platformio\penv\Lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__

    rc = await self.task(*args, **kwargs)

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\Joshua\.platformio\penv\Lib\site-packages\colcon_core\task\__init__.py", line 93, in __call__

    return await task_method(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\Joshua\.platformio\penv\Lib\site-packages\colcon_ros\task\cmake\build.py", line 34, in build

    rc = await extension.build(

         ^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\Joshua\.platformio\penv\Lib\site-packages\colcon_cmake\task\cmake\build.py", line 87, in build

    rc = await self._reconfigure(args, env)

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\Joshua\.platformio\penv\Lib\site-packages\colcon_cmake\task\cmake\build.py", line 153, in _reconfigure

    raise RuntimeError(

RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

---

Failed   <<< gtest_vendor [3.19s, exited with code 1]

WNDPROC return value cannot be converted to LRESULT

TypeError: WPARAM is simple, so must be an int object (got NoneType)

VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

========================= [FAILED] Took 96.60 seconds =========================

If anyone is looking at this, please let me know if I can provide more information. I'm just trying to get any micro ros example to compile in PlatformIO in windows

Legohead259 commented 10 months ago

It could be that Micro-ROS is not intended to be compiled on Windows?

For your application, is there a specific need to use VSCode on Windows or would WSL2 Ubuntu suffice?