-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Core files should be compiled in a subdirectory #2997
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
Comments
Weird bug. You should probably include the full compiler output here as well? |
Not Working:
Working:
|
The problem is in the Consumer.ino filename. This results in a compiled Consumer.cpp.o file, directly inside the tmp directory. However, the Consumer.cpp file from the core is also compiled to the same Consumer.cpp.o file. Having the .o filenames conflict in this way should be fixed in the IDE. I think the core files should be compiled inside a subfolder of the tmp folder ("core", or perhaps named after the core itself). This would reduce the potential for conflicts, only when you have a library called "core" this could still conflict. To fix that, a library should be compiled inside a tmp/libraries/name_of_library folder perhaps. Also interesting is that any subdirectories in the core directory are lost. cpp files in subdirectories are compiled, but the .o path doesn't contain the subdirectory anymore. So if the same filename occurs in the core twice (in different (sub)folders), this would again conflict. |
Thx! And I've noted it somewhere in my Documentation to not do this. X_x Thanks! Ergo: Someone should add a patch to check the filename vs any compiled cpp? |
Also note that this is not specific to 3rd party cores - If I create a Print.ino sketch, I expect the IDE will break using the normal Arduino core as well. |
I was wondering if this problem would ever come up.... been watching for it for years! |
ACK. Solving this will also help solving #1337 as we'll be able to copy sketch source files into temp dir. |
There is already the sub-folder compile for libraries: private void recursiveCompileFilesInFolder(File srcBuildFolder, File srcFolder, List<File> includeFolders) throws RunnerException, PreferencesMapException {
compileFilesInFolder(srcBuildFolder, srcFolder, includeFolders);
for (File subFolder : srcFolder.listFiles(new OnlyDirs())) {
File subBuildFolder = new File(srcBuildFolder, subFolder.getName());
recursiveCompileFilesInFolder(subBuildFolder, subFolder, includeFolders);
}
} it uses the |
Sounds good (though we'd have to modify the .a file generation as well I believe). Furthermore, it might be useful to modify this line to insert a fixed "libraries" folder (e.g. so a Foo library is compiled in build_dir/libraries/Foo). This completely rules out any conflict by weirdly named libraries. Not sure about platform.txt reliability on file position - I think at least the recipes only deal with a single file, regardless of where it is? |
If you are changing things in the library linkage, would it also be possible to implement this option with the fix as well? #2800 |
That's a very different issue, unrelated to simply building the core library in its own directory for the purpose of avoiding file naming conflicts. I'm not commenting whether or not that change should be made. My only point is it's a completely separate issue, which should be considered separately from this one. It should not be combined with this issue. |
I'll explain the issue with an example (ide 1.6.3, win8):
Install the HID project into /sketchbook/hardware/HID
https://github.com/NicoHood/HID
Restart the IDE
Now select the new board that pops up under tools/boards/leonardo HID Project
Type Consumer.begin() in the empty sketchs setup()
compile the code (Control + R) -> Works fine
Now open the example via File>Sketchbook>hardware>HID>HID>Consumer
It wont compile.
I've tested:
It seems that the files are not linked correct, maybe due to a subfolder?
The error occurs when:
It does not occur if you:
It does not matter which Board was selected at closing.
Temporary workaround for 3rd party developers
Open the examples, mark everything (Ctrl + A) and paste it into a new sketch (Ctrl + V)
The text was updated successfully, but these errors were encountered: