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

sdkconfig changes when project is built on different machines (IDFGH-12478) #13490

Open
3 tasks done
krupis opened this issue Mar 28, 2024 · 12 comments
Open
3 tasks done
Assignees
Labels
Awaiting Response awaiting a response from the author Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@krupis
Copy link

krupis commented Mar 28, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

5.0.4

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

Build the project without any sdkconfig conflicts

What is the actual behavior?

We have multiple people working on the same esp-idf project. We have noticed that whenever someone makes changes and push to the repository, whenever other people try to pull all the changes and build the project on their own machine, during build process something changes on the sdkconfig.h.

I want to understand why does the sdkconfig.h changes when project is built on different machines even if the same esp-idf version is used?

Steps to reproduce.

  1. Pull someones changes from the repository
  2. Build project

Build or installation Logs.

For example, I have just pulled changes from my colleague and built the project. I can see that changes are automatically detected using the Source Control extension on the VSCode on the sdkconfig.

It seems that the only changes are the order. Please see the example below:
image

image

As you can see from 2 images above, on my machine, LittleFS is configured starting on the line 1675 and on my colleagues sdkconfig it is configured starting at line 1737. What is the reason for that and why that happens?

More Information.

No response

@krupis krupis added the Type: Bug bugs in IDF label Mar 28, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 28, 2024
@github-actions github-actions bot changed the title sdkconfig changes when project is built on different machines sdkconfig changes when project is built on different machines (IDFGH-12478) Mar 28, 2024
@dobairoland
Copy link
Collaborator

Because items before writing those files are not sorted and their order is semi-random and could be different between systems just as you observe.

You are not supposed to commit sdkconfig or anything from the build directory, including sdkconfig.h, into source control management systems. Any changes different from the default ones should be stored in sdkconfig.defaults and that could be committed. See idf.py save-defconfig for how to generate that file. You can add items to that file manually as well. sdkconfig should be removed each time there is a change in sdkconfig.defaults or the changes will be ignored.

@dobairoland
Copy link
Collaborator

I was notified that we should support committing sdkconfig files into source control systems, and therefore, deterministic order in that file. So I'm reopening this....

@dobairoland dobairoland reopened this Mar 28, 2024
@krupis
Copy link
Author

krupis commented Mar 28, 2024

So everytime I make a change in sdkconfig asuming I use menuconfig what is being changed is the sdkconfig right? So when I am ready to upload new changes to the git, I have to manually copy and paste all the changes and put them to sdkconfig.defaults? That sounds like unnecessary extra step

Perhaps I do not fully understand how does sdkconfig and sdkconfig.defaults work yet. Im reading about it as we speak.

I simply want to understand what is the optimal way of making changes in the menuconfig and pushing those changes to the repository while avoiding the issue I have described above.

@KaeLL
Copy link
Contributor

KaeLL commented Mar 28, 2024

So everytime I make a change in sdkconfig asuming I use menuconfig what is being changed is the sdkconfig right?

Yes

So when I am ready to upload new changes to the git, I have to manually copy and paste all the changes and put them to sdkconfig.defaults?

No. You can just run idf.py save-defconfig.
Of if you haven't opened menuconfig yet, you can delete the sdkconfig file, open menuconfig, make the changes you want, press D, and save it to ../sdkconfig.defaults.

@krupis
Copy link
Author

krupis commented Mar 29, 2024

So everytime I make a change in sdkconfig asuming I use menuconfig what is being changed is the sdkconfig right?

Yes

So when I am ready to upload new changes to the git, I have to manually copy and paste all the changes and put them to sdkconfig.defaults?

No. You can just run idf.py save-defconfig.
Of if you haven't opened menuconfig yet, you can delete the sdkconfig file, open menuconfig, make the changes you want, press D, and save it to ../sdkconfig.defaults.

Could you just confirm what is the purpose of that and why cant we just simply commit sdkconfig instead?

@KaeLL
Copy link
Contributor

KaeLL commented Apr 1, 2024

You can commit it, but the file is unstable given that configs are added/removed/moved/renamed at will, resulting in a lot of noise each time IDF is updated and a Kconfig is touched.

@dobairoland
Copy link
Collaborator

Hi @krupis.

There is a line in tools/cmake/project.cmake at https://github.com/espressif/esp-idf/blob/v5.0.4/tools/cmake/project.cmake#L292:

file(GLOB component_dirs ${component_dir}/*)

Could you please try adding the following line after it?

list(SORT component_dirs)

This has to be done on both computers where you experience the difference in the sdkconfig content.

Could you please try this and report back if this fixed the issue? I'm just guessing because I cannot reproduce it.

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Apr 4, 2024
@dobairoland dobairoland added the Awaiting Response awaiting a response from the author label Apr 8, 2024
@mickeyl
Copy link
Contributor

mickeyl commented Apr 16, 2024

@dobairoland

I have a similar problem, but more annoying in so far that it happens on the same machine.

A call of idf.py build seems to reorder certain parts of the sdkconfig, so that I get a bogus diff afterwards.
Adding the suggested list(SORT component_dirs) in project.cmake does not make a difference for me.

Anything else I could try?

@dobairoland
Copy link
Collaborator

The greatest help would be to guide us to reproduce it.

Which parts of sdkconfig are changing? There is a one block which is moving around or there are more moving parts? It is always completely different or there is a pattern?

Where the moving parts are coming from? Is it a component in ESP-IDF, added by an environment variable, a local component in the project directory, obtained by component manager, ....?

@mickeyl
Copy link
Contributor

mickeyl commented Apr 16, 2024

Complete blocks are moving, always the same blocks. Those blocks are coming in from Kconfig files that are part of components referenced via (local) dependencies specified in main/idf_components.yml.

@ConnorDuvalS
Copy link

I believe @mickeyl is right about #10419 being related to this. @dobairoland there is a full step-by-step reproduction guide in my comment at #10419 (comment).

@dobairoland
Copy link
Collaborator

Let us wait for espressif/idf-component-manager#58 to see if the ordering can be fixed on the component manager side.

2f811b7 already addressed ordering on the ESP-IDF side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response awaiting a response from the author Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

6 participants