Skip to content

Linking project with spaces in path fails #6463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
maxgerhardt opened this issue Mar 22, 2022 · 2 comments
Closed
1 task done

Linking project with spaces in path fails #6463

maxgerhardt opened this issue Mar 22, 2022 · 2 comments
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Mar 22, 2022

Board

any

Device Description

Not relevant.

Hardware Configuration

Not relevant.

Version

latest master

IDE Name

PlatformIO

Operating System

Windows 10 x64

Flash frequency

40

PSRAM enabled

no

Upload speed

115200

Description

Projects which live in a folder path where there is a space, or where we are building for an environment (as defined in th e platformio.ini) that has a space in it, fail to link.

Example: I create a ESP32 project at the path C:\Users\Max\temp\Test Project With Spaces using the platformio.ini

[env:esp32dev with spaces]
platform = https://github.com/Jason2866/platform-espressif32.git
board = esp32dev
framework = arduino
platform_packages = 
	framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master

with a semantically empty src/main.cpp code. Linking fails with


Linking .pio\build\esp32dev with spaces\firmware.elf
xtensa-esp32-elf-g++: error: Project: No such file or directory
xtensa-esp32-elf-g++: error: With: No such file or directory
xtensa-esp32-elf-g++: error: Spaces.map: No such file or directory
*** [.pio\build\esp32dev\firmware.elf] Error 1
================[FAILED] Took 102.29 seconds ================

which is due to the linker flag for generating the .map file being

-Wl,-Map="C:\Users\Max\temp\Test Project With "Spaces\.pio\build\esp32dev\Test Project With Spaces.map""

as one can see, unexpectedly before the wor Spaces there is a ". This prematurely ends the string for the -Map= argument, and the command is messed up.

The builder script does

'-Wl,-Map="%s"' % join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))

which looks correct, but behind-the-scenes corrections / auto-escaping of anything that has a space done presumably by either SCons or the PlatformIO in it destroys this logic and produces these wrong commands.

A workaround is to use as much relative paths as possible to get only .pio\build\<env name>\<project name>.map, and then remove the spaces if there are any.

'-Wl,-Map="%s"' % relpath(join(env.subst("$PROJECT_BUILD_DIR"), env.subst("$PIOENV"),  basename(env.subst("${PROJECT_DIR}.map")))).replace(" ", "_")

EDIT: A better fix has been found in the linked PR.

As shown in https://community.platformio.org/t/working-with-esp-arduino-2-0-2/26540/6?u=maxgerhardt and following. The person in https://community.platformio.org/t/xtensa-esp32-elf-g-error-controller-map-no-such-file-or-directory/26675 is also affected.

I'm opening this bug here so that a temporary fix may be implemented, working around what looks like a core bug to me. Due to the war, fixes on the PlatformIO side may take a very long time.

Sketch

#include <Arduino.h>
void setup() {}
void loop(){}

Debug Message

None relevant.

Other Steps to Reproduce

None relevant.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@maxgerhardt maxgerhardt added the Status: Awaiting triage Issue is waiting for triage label Mar 22, 2022
@maxgerhardt maxgerhardt changed the title Linking project with spaces in name fails Linking project with spaces in path fails Mar 22, 2022
@VojtechBartoska
Copy link
Contributor

@me-no-dev Can you please take a look?

@VojtechBartoska VojtechBartoska added the IDE: PlaformIO Issue relates to PlatformIO IDE label Mar 24, 2022
@maxgerhardt
Copy link
Contributor Author

Fixed through #6464.

@VojtechBartoska VojtechBartoska removed the Status: Awaiting triage Issue is waiting for triage label Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE
Projects
None yet
Development

No branches or pull requests

2 participants