-
-
Notifications
You must be signed in to change notification settings - Fork 398
Incorrect compiler selected by Arduino-cli #1876
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
Thanks for reporting this. I've taken the liberty to fix some formatting in your post (replaced single backticks with triple backticks) and added a link to the code you mentioned. I have been seeing this same problem with upload tools on a custom-installed (from git) STM32 core, that randomly selects upload tools from multiple different stm32 cores I installed through the board/core manager. I think the problem (at least in my case) is that cores installed into ~/.arduino15 using arduino-cli have a json file describing their dependencies, so arduino-cli knows exactly which version of all tools they need. However, for locally installed cores (in my sketchbook), there is no such dependency mapping, so arduino-cli uses an arbitrary version (in terms of code, I think One question is of course how to solve this non-determinism, i.e. which version should be preferred? I suspect that the highest version number makes the most sense, even though that is not perfect for all situations. The code you pointed out indeed seems likely the cause of this problem, and I suspect that would be also be the right place to fix it, probably by just sorting (or iterating) AllTools by increasing version number. I cannot speak for the devs, but I would think this might indeed be the correct fix for this. |
The correct answer is that it should only be using the tool and version as specified in the platform.txt and package_..._index.json for that specific board. Such that different versions of compiler or bossac etc can be specified for specific boards or MCUs. |
How was it installed? Did you use Or did you install it manually to
There is to some extent: https://arduino.github.io/arduino-cli/dev/platform-specification/#tools
If @zaphodbe uses a reference to the Unfortunately, the poor design of this property format does still leave room for ambiguity. The flaw is that it does not allow specifying the package name. So if two packages contain an
Please provide the |
To @per1234 questions. It was installed and updated using the Arduino IDE and I have done a fresh install and problem persists. To your point I tried specifying a specific version I did some more digging in the arduino-cli code and have determined that the RequiredTools only uses board specific settings from the boards.txt file and never uses the platform settings from platform.txt as such it defaults to entries from AllTools dependent on the order they were found in. It seems to me that the dependency order should be boards.txt with highest priority then platform.txt and finally defaults. Please find attached the platform.txt and package index files (with some redactions) |
Hm, seems my previous comment was quite off, so probably just ignore that (the problem I describe there, for self-installed cores, probably does exist, but reading your issue better, your issue is different since your core seems to be installed using arduino-cli/board manager using a json file, not self-installed). About your issue - looking at the debug output, I believe that for some reason both runs have a different arm-gcc version in the RequiredTools for some reason, e.g.: ctx.RequiredTools: tool: arm-none-eabi-gcc ver: 4.8.3-2014q1 Given the code you highlighted, it seems to me that the problem is not that arm-none-eabi-gcc is in AllTools twice in arbitrary order, but that the version present in RequiredTools is different on different runs. What is also weird, is that RequiredTools has a lot of other tools, like avr-gcc and avrdude, which are not mentioned in the JSON
Note sure I understand what you are saying here. AFAIU |
@matthijskooijman correct the RequiredTools is created by the Then that list is overridden by the board settings. However in testing I never see anything from the board settings and it is not getting the platform settings. To debug I added some output to each of the loops in the Either way |
Describe the problem
Arduino-cli version 0.27.1 and previous versions. Have both Arduino core and a custom SAMD based core installed. Arduino core has arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc and the SAMD based core has things/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-gcc. On each successive run of Arduino-cli it will randomly select which one of those compilers to use. Similar thing happens for bossac.
I added some debug output to the Arduino-cli code in setup_build_properties.go around line 99 ... here
Basically what appears to be happening is that the AllTools and RequiredTools arrays are created non-deterministically and so depending on the order of entries in those arrays depends on which version of the tool is ultimately selected. With the one from RequiredTools finally taking dominance.
This is the output of Arduino-cli with the println's shown and the output grep'd for the .path variables from 2 consecutive runs...
To reproduce
arduino-cli -v compile --fqbn things:samd: file.ino --show-properties
Expected behavior
Correct compiler and bossac should be selected.
Arduino CLI version
0.27.1
Operating system
macOS
Operating system version
12.5
Additional context
No response
Issue checklist
The text was updated successfully, but these errors were encountered: