Skip to content

Compilation error caused by Different Drive Letter on Windows #271

Description

@tanreinama

Is your feature request related to a problem? Please describe.
The following error occurs when the project folder is located on a drive other than the C drive.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Scripts\west.exe\__main__.py", line 7, in <module>
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Lib\site-packages\west\app\main.py", line 1199, in main
    app.run(argv or sys.argv[1:])
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Lib\site-packages\west\app\main.py", line 278, in run
    self.run_command(argv, early_args)
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Lib\site-packages\west\app\main.py", line 584, in run_command
    self.run_extension(args.command, argv)
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Lib\site-packages\west\app\main.py", line 739, in run_extension
    self.cmd.run(args, unknown, self.topdir, manifest=self.manifest,
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\venv\Lib\site-packages\west\commands.py", line 200, in run
    self.do_run(args, unknown)
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\zephyr-main\scripts\west_commands\build.py", line 263, in do_run
    self._sanity_check()
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\zephyr-main\scripts\west_commands\build.py", line 582, in _sanity_check
    self._sanity_check_source_dir()
  File "C:\Users\sakam\.pico-sdk\zephyr_workspace\zephyr-main\scripts\west_commands\build.py", line 566, in _sanity_check_source_dir
    srcrel = os.path.relpath(self.source_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen ntpath>", line 796, in relpath
ValueError: path is on mount 'D:', start on mount 'C:'

Describe the solution you'd like
Works correctly regardless of drive letter

Describe alternatives you've considered
In a Windows environment, drive letters must be taken into account; therefore, a relative path cannot be created when crossing between different drives.
It seems there is an issue with the mechanism that performs compilation using relative paths, even though the workspace is set up at .pico-sdk\zephyr_workspace. Possible solutions include creating a symbolic link to the target project within .pico-sdk\zephyr_workspace before compilation and reverting it afterward.

Additional context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions