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

cmake: fixing toolchain_parse_make_rule to correctly handle \ files #38333

Merged

Conversation

tejlmand
Copy link
Collaborator

@tejlmand tejlmand commented Sep 6, 2021

Fixes: #37637

toolchain_parse_make_rule() parses depfiles and converted \\ to the
CMake list separator ;.

However, gcc -M might create depfiles with windows path separator \
causing this conversion to fail, as a path like:

c:\...\zephyr\samples\drivers\led_ws2812\nrf52-bindings.h

resulting in a file list as:

c:;...;zephyr;samples;drivers;led_ws2812;nrf52-bindings.h

which results in a CMake configure dependency to be added to C:.
As C: is always newer than the build.ninja file, this resulted in
continues CMake re-invocation.

As a small side-note, the \ in file name did only occur in situations
where a relative past had been used elsewhere in the build system, such
as here:

To ensure proper handling of files, then all files are converted to
CMake paths, that is with forward slashes: /

Signed-off-by: Torsten Rasmussen Torsten.Rasmussen@nordicsemi.no

@tejlmand tejlmand added the bug The issue is a bug, or the PR is fixing a bug label Sep 6, 2021
@tejlmand tejlmand added this to the v2.7.0 milestone Sep 6, 2021
@tejlmand
Copy link
Collaborator Author

tejlmand commented Sep 6, 2021

FYI @epietrowicz

@tejlmand tejlmand force-pushed the 37637_fix_infinite_cmake_configure branch 4 times, most recently from d2cde59 to 494e2fa Compare September 6, 2021 11:01
Fixes: zephyrproject-rtos#37637

toolchain_parse_make_rule() parses depfiles and converted `\\` to the
CMake list separator `;`.

However, gcc -M might create depfiles with windows path separator `\`
causing this conversion to fail, as a path like:
c:\...\zephyr\samples\drivers\led_ws2812\nrf52-bindings.h

resulting in a file list as:
c:;...;zephyr;samples;drivers;led_ws2812;nrf52-bindings.h

which results in a CMake configure dependency to be added to `C:`.
As C: is always newer than the build.ninja file, this resulted in
continues CMake re-invocation.

As a small side-note, the `\` in file name did only occur in situations
where a relative past had been used elsewhere in the build system, such
as here:
https://github.com/zephyrproject-rtos/zephyr/blob/\
c3050a5/samples/drivers/led_ws2812/\
boards/nrf52dk_nrf52832.overlay#L9

To ensure proper handling of files, then all files are converted to
CMake paths, that is with forward slashes: `/`

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
@tejlmand
Copy link
Collaborator Author

tejlmand commented Sep 6, 2021

FYI @thedjnK

@cfriedt cfriedt assigned nashif and unassigned tejlmand Sep 10, 2021
@cfriedt
Copy link
Member

cfriedt commented Sep 10, 2021

@nashif - could you please ack as a collaborator?

@cfriedt cfriedt assigned tejlmand and unassigned nashif Sep 11, 2021
@cfriedt cfriedt merged commit 14b6314 into zephyrproject-rtos:main Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite configuring loop for samples\drivers\led_ws2812 sample
4 participants