Skip to content
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

esp-2021r2-patch2-8.4.0 not working if user folder has a space in it (IDFGH-6735) #8364

Closed
apiesse opened this issue Feb 9, 2022 · 9 comments · Fixed by #9656
Closed

esp-2021r2-patch2-8.4.0 not working if user folder has a space in it (IDFGH-6735) #8364

apiesse opened this issue Feb 9, 2022 · 9 comments · Fixed by #9656
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@apiesse
Copy link

apiesse commented Feb 9, 2022

Environment

  • Development Kit: none
  • Module or chip used: ESP32
  • IDF version: v4.4
  • Build System: CMake
  • Compiler version : xtensa-esp32-elf-gcc (crosstool-NG esp-2021r2-patch2) 8.4.0
  • Operating System: Windows
  • (Windows only) environment type: idf.py
  • Using an IDE?: Yes, Eclipse 2021-06 with esp-idf plugin

Problem Description

I've just updated a project from esp-idf-v4.3.2 to esp-idf-v4.4 and I have the following error message:

xtensa-esp32-elf-gcc.exe: error: C:\Users\Marco: No such file or directory
xtensa-esp32-elf-gcc.exe: error: Mariotti\AppData\Roaming/.ccache/tmp/cmd_args.bHD3G8: No such file or directory
xtensa-esp32-elf-gcc.exe: fatal error: no input files
compilation terminated.

As you can guess, the user directory is "C:\Users\Marco Mariotti", but somehow the space in it is no longer escaped.
The error was not present in esp-idf-v4.3.2 (using esp-2021r2-8.4.0 toolchain).

@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 9, 2022
@github-actions github-actions bot changed the title esp-2021r2-patch2-8.4.0 not working if user folder has a space in it esp-2021r2-patch2-8.4.0 not working if user folder has a space in it (IDFGH-6735) Feb 9, 2022
@igrr
Copy link
Member

igrr commented Feb 9, 2022

Hi @apiesse, thanks for reporting this. It's interesting to hear that having a directory with space in its path worked for you in older versions of ESP-IDF. This is explicitly not supported and there were several places in the build system where spaces were not handled correctly.
https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/get-started/index.html#step-1-install-prerequisites

We have fixed these issues in master recently and the future v5.0 release will support spaces in paths.

Could you please check the following:

  • when you used v4.3.2, did ESP-IDF directory have path with spaces?
  • did your project have path with spaces?

@apiesse
Copy link
Author

apiesse commented Feb 9, 2022

Thanks for the reply @igrr .
That surprised me as well give the IDE Tools are installed in C:\espressif and the project is located in C:\svn\project\firmware\trunk\app (same with esp-idf-v4.3.2) as the documentation suggested.

@igrr
Copy link
Member

igrr commented Feb 9, 2022

I see, looks like it might be a ccache issue. Are you building using idf.py build from command line or from an IDE?
If it's the former, could you do set IDF_CCACHE_ENABLE=0 in the command prompt, then idf.py fullclean and finally idf.py build again.

@apiesse
Copy link
Author

apiesse commented Feb 9, 2022

This is working both from command line and Eclipse!
Thank you, hope to see this soon in some release before 5.0!

@igrr
Copy link
Member

igrr commented Feb 9, 2022

Thanks for confirming that disabling the cache helps.

I'm afraid we can't add support for spaces in paths to existing v4.x release because it introduces certain breaking changes to project CMakeLists.txt files. So by fixing spaces in paths, we unfortunately also have a chance of breaking some projects. Because of that, we decided to include this change only in v5.0.

However the issue with ccache seems to be unrelated, and I think it can be fixed by upgrading ccache to a more recent version. We'll try to reproduce the issue and upgrade ccache version in the existing v4.x releases.

In the meantime, you can re-enable ccache (set IDF_CCACHE_ENABLE=1) and then configure ccache to use different cache directory — instead of somewhere in your home directory, point it e.g. to C:\espressif\ccache. This can be done using CCACHE_DIR environment variable. More on this in ccache manual. This way you will keep having faster builds, and will have everything working until we manage to upgrade ccache.

@acebearxp
Copy link

I think I meet a similar situation.
When I execute idf.py gdbgui, there is a red error line shown as below
image

obviously the \t in .espressif\tools\xtensa... was represented as a "TAB"

The red line scared me, but the gdbgui still works fine, I think it is just wrong in the error message, perhaps the internal function is not wrong

@Alvin1Zhang Alvin1Zhang removed their assignment Feb 17, 2022
@xiaguangbo
Copy link

@igrr I also encountered a similar problem, I put 'esp-idf' and '.espressif' in 'C:\Program Files...', and then 'kconfiglib.KconfigError: D: /.../project/esp/project/template-app/build/kconfigs_projbuild.in:1: 'C:/Program' not found (in 'source "C:/Program"').', I use esp-idf v4.4

binary1230 added a commit to binary1230/esp-idf that referenced this issue Aug 27, 2022
- primary reason: 4.6.2 fixes errors if the user's home directory contains a space
- alternative fix: the CCACHE_DIR env var can be set to something without a space in it, or set to TMP which properly escapes the home dir name
- there may be other issues with spaces in filenames on builds in other parts of ESP-IDF, see espressif#8364 for more info

tested locally on windows only, use at your own risk
@binary1230
Copy link
Contributor

binary1230 commented Aug 27, 2022

I kept running into this

(damn you windows for using a space in my home directory name and making it really hard to change, why...)

Here's a couple workarounds from my travels:

  1. probable best thing (new)
    The latest ccache release fixes this issue, I have submitted a PR for upgrading this in ESP-IDF here:
    upgrade ccache installed version to 4.6.2 (IDFGH-8160) #9656

More info from https://ccache.dev/releasenotes.html#_ccache_4_6_2

Ccache 4.6.2- Release date: 2022-08-22
Corrected handling of space in paths when using response file on Windows. [contributed by Sergey Semushin]

The upstream ccache fix for this is probably this PR: ccache/ccache#1124

  1. Workaround: Set the CCACHE_DIR somewhere that doesn't have spaces in the filename, using this powershell command (or equivalent in cmd prompt). In here, $env:TMP uses 8.3 filename format to properly escape the space, so, this happens to work:
$env:CCACHE_DIR=$env:TMP; idf.py build
  1. Sledgehammer:
$env:IDF_CCACHE_ENABLE=0; idf.py build

Hope that helps.

Bonus: It might be cool to get a hint from idf.py that the user's home directory contains a space in the filename, and warn about potential issues with that. It was hard to track down that this was a ccache / path spaces bug. In the future, other stuff could break too (spaces in home directory names is evil), so this breadcrumb could help devs reach the solution quicker.

Thanks!
-Dom

@dobairoland
Copy link
Collaborator

Thanks @binary1230 for sharing your findings and creating a PR for this. Space support for ccache is really good news. We handle your PR soon.

@dobairoland dobairoland linked a pull request Aug 29, 2022 that will close this issue
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Aug 29, 2022
espressif-bot pushed a commit that referenced this issue Sep 2, 2022
- primary reason: 4.6.2 fixes errors if the user's home directory contains a space
- alternative fix: the CCACHE_DIR env var can be set to something without a space in it, or set to TMP which properly escapes the home dir name
- there may be other issues with spaces in filenames on builds in other parts of ESP-IDF, see #8364 for more info

tested locally on windows only, use at your own risk

Closes #9656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants