Skip to content

Build folder not correctly cleaned when user sets static build.path property #4862

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
kravlost opened this issue Apr 14, 2016 · 11 comments
Closed
Labels
arduino-builder The tool used to handle the Arduino sketch compilation process Type: Bug
Milestone

Comments

@kravlost
Copy link

When using a specified Build folder, if you have two sketches open at once, the Build folder isn't cleaned out between compiles, which can lead to spurious "already defined" compiler errors. To solve this, it would be useful to have a menu item which cleans out the Build folder.

@facchinm
Copy link
Member

@steronydh , are you experiencing this with a nighlty build? Since arduino/arduino-builder@47f3fc4 was merged, I never got that error (since the .o generated by the previous sketch is ignored)
Could you provide a couple of sketches which trigger the issue?

@kravlost
Copy link
Author

Yes, it's a nightly. I'm getting this with two very similar sketches which access the same set of libraries. I think it could be the libraries which are causing this.

@facchinm
Copy link
Member

Sorry but I need the sketches and the environment (core version, target boards etc), otherwise I'll never be able to replicate it coherently

@kravlost
Copy link
Author

kravlost commented Apr 14, 2016

With nightly 1.6.9 2016/04/07 12:33, I can reproduce this in this way compiling for Mega2560.

Specify a build folder in preferences.txt:

build.path=C:\Temp\Arduino\Build

Clean out the build folder.

Open two new sketches. At the top of each add the global line: int i=0;

Compile one. No errors.

Compile the second. I get errors about multiple definitions of setup(), loop(), and i.

@facchinm
Copy link
Member

Specify a build folder in preferences.txt: build.path=C:\Temp\Arduino\Build

This is the key, since usually two different sketches get compiled into different folders. I'll look into this but don't expect a fast solution (since the option is not reachable by the GUI)

@kravlost
Copy link
Author

OK, no worries. Now there's the option to export the compiled binary to the sketch folder, I can probably delete this setting anyway.

@kravlost
Copy link
Author

I can confirm that the problem goes away if I delete the line completely from preferences.txt, but not if I leave build.path= blank.

@kravlost
Copy link
Author

There is a problem with my original build now - gcc complains that the command line is too long! If I use my specified path it's fine, but the random path makes the linker call very long. (My project is quite big, producing a 100k+ hex file.)

@matthijskooijman
Copy link
Collaborator

@facchinm, I think the changes I proposed in arduino/arduino-builder#86 would fix this (the duplicate symbol issue, not the linker commandline length). However, it would then still recompile everything whenever switching between Windows, but at least it would work.

@steronydh, perhaps you could set a different build.path for each window / sketch by using the --pref build.path=/some/path commandline option? E.g. by creating two shortcuts or wrapper scripts with different options allows setting static, but different, build paths.

facchinm added a commit to facchinm/arduino-builder that referenced this issue Apr 20, 2016
facchinm added a commit to facchinm/arduino-builder that referenced this issue May 2, 2016
facchinm added a commit to facchinm/arduino-builder that referenced this issue May 3, 2016
facchinm added a commit to facchinm/arduino-builder that referenced this issue May 3, 2016
@cmaglie cmaglie added this to the Release 1.6.9 milestone May 6, 2016
@cmaglie
Copy link
Member

cmaglie commented May 6, 2016

Fixed by arduino/arduino-builder#144

@cmaglie cmaglie closed this as completed May 6, 2016
@piotrjan-kano
Copy link

clean the temp folder where arduino saves temp files. Restart the IDE. Arduino will rebuild

@per1234 per1234 changed the title Menu option to "Clean" the Build folder Build folder not correctly cleaned when user sets static build.path property Jan 15, 2023
@per1234 per1234 added Type: Bug arduino-builder The tool used to handle the Arduino sketch compilation process labels Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arduino-builder The tool used to handle the Arduino sketch compilation process Type: Bug
Projects
None yet
Development

No branches or pull requests

6 participants