-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
-p doesn't run a pristine build #28876
Comments
@mbolivar-nordic Created an issue as per our conversation on slack. |
Thanks! I will look into it. |
Hi @vandita5, and thanks again for the detailed report. I tried to reproduce this on Windows 10 but I can't. I get no error in your step 5. When doing a verbose build, I get:
Can you please help me understand what's going on on your computer by running this exact command in step 5:
Notice how there are three v's: If you can copy/paste the output (screenshot if you must, but copy paste would be really preferred) here, I will try to figure out what is different on our computers. |
@mbolivar-nordic I tried doing this now but sadly couldn't reproduce it either. It is a bit finicky for me. I have to delete the build folder quite a few times when trying something new. like today I was trying to build for a custom board and saw this issue. I don't have a reproducer sadly but I will try running with -vvv when I encounter this problem next. |
I had a similar issue though it might not be the same. Today when I was trying to add a custom board, one error that I am able to reproduce was that when I gave the wrong BOARD_ROOT, changing it to the correct one and then running west build again always resulted in a permissions error. but running the build command one more time resolves or also resolved by deleting build folder.
|
I'm not able to reproduce any of the other times that I had to delete build folder. |
I see what's going on. I'll send a patch tomorrow after I've done some more testing. Thanks again. |
The west build command has historically tried not to rm -rf directories that don't look like zephyr build directories. The way it does this is by checking for the presence of a CMake cache with a Zephyr-specific variable (ZEPHYR_TOOLCHAIN_VARIANT) in it. The problem with this approach is that if the build system fails before this cache variable is set, the directory doesn't look like a zephyr build directory, and therefore west build won't make it pristine even with --pristine=always, even though build directories resulting from failed runs like that are almost certainly irrecoverably broken and need to be made pristine before anything will work. This leads to users having to rm -rf their directories manually, which is not so nice. To avoid this from happening, just check for ZEPHYR_BASE, which is set early on in ZephyrConfig.cmake in 'modern' zephyr build systems. Keep the ZEPHYR_TOOLCHAIN_VARIANT check in place for compatibility. We could consider being less selective and just using shutil.rmtree() whenever we have --pristine=always, but that would be a bigger behavioral change than I'm comfortable doing without a good reason. Fixes: zephyrproject-rtos#28876 Signed-off-by: Martí Bolívar <[email protected]>
The west build command has historically tried not to rm -rf directories that don't look like zephyr build directories. The way it does this is by checking for the presence of a CMake cache with a Zephyr-specific variable (ZEPHYR_TOOLCHAIN_VARIANT) in it. The problem with this approach is that if the build system fails before this cache variable is set, the directory doesn't look like a zephyr build directory, and therefore west build won't make it pristine even with --pristine=always, even though build directories resulting from failed runs like that are almost certainly irrecoverably broken and need to be made pristine before anything will work. This leads to users having to rm -rf their directories manually, which is not so nice. To avoid this from happening, just check for ZEPHYR_BASE, which is set early on in ZephyrConfig.cmake in 'modern' zephyr build systems. Keep the ZEPHYR_TOOLCHAIN_VARIANT check in place for compatibility. We could consider being less selective and just using shutil.rmtree() whenever we have --pristine=always, but that would be a bigger behavioral change than I'm comfortable doing without a good reason. Fixes: #28876 Signed-off-by: Martí Bolívar <[email protected]>
Describe the bug
A clear and concise description of what the bug is.
What have you tried to diagnose or workaround this issue?
This has happened to me in different scenarios but I didn't document them before. In this case I checked out a new version of zephyr and ran west update. I then ran the build command with -p and it kept failing as it couldn't find ZEPHYR_BASE. I tried to follow instructions from getting started about running the shell script to set environment variables and set them manually too but still got the same error. I then deleted the build folder and tried building and it worked.
Command that I was running
west build -p -b nucleo_f429zi samples\basic\blinky
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
I expected -p to create a pristine build and I didn't expect to have to delete build folder manually.
Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)
Annoyance
Logs and console output
If applicable, add console logs or other types of debug information
e.g Wireshark capture or Logic analyzer capture (upload in zip archive).
copy-and-paste text and put a code fence (```) before and after, to help
explain the issue. (if unable to obtain text log, add a screenshot)
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: