Go Down

Topic: conflicting library versions (Read 174 times) previous topic - next topic

nomadic68

Hi all,

I am currently using arduino-cli, and am writing to ask if it is possible to disable the 2 default library include paths
(in Windows):

1) C:\Program Files (x86)\Arduino\libraries
2) %userprofile%\Documents\Arduino\libraries

The reason is that for some of my projects i am using older versions of some libraries because with the latest ones my code doesn't compile anymore (library interface changed). I don't want to update my code to support the newest libraries because this does not protect me from the problem possibly happening again when a library gets updated further. 

Instead, i would like to keep the relevant libraries inside the project source tree and use the --library option to include them; but if i do so, i get compile errors because the 2 directories above are always included by default, thus ending in conflicting/duplicate declarations.

A temporary (and horrible!) solution i found was to leave the default library directories empty by relocating the system and contributed libraries somewhere else, but this adds extra work to keep the libraries updated (for my newer projects) since the library manager doesn't work anymore.

An additional command line option to disable these 2 default locations or a CLI version requiring to mandatorily specify also the 2 aforementioned library paths would be perfect.

Does anybody know if there is a secret/hidden command option or configuration to alter to accomplish that?
Thanks and regards


pert

I am currently using arduino-cli

...

1) C:\Program Files (x86)\Arduino\libraries

Instead, i would like to keep the relevant libraries inside the project source tree and use the --library option to
This is not clear to me. Are you using Arduino CLI?:
https://arduino.github.io/arduino-cli/latest/
or the command line interface of the standard Arduino IDE?:
https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc

The reason I ask is because Arduino CLI only uses the libraries subfolder of the Arduino IDE installation folder in the event it is located in the Arduino IDE installation folder, which is an unusual circumstance at this time when Arduino CLI has not yet been integrated with Arduino IDE.

The other thing I don't understand is the mention of the --library option. Neither program has such an option. Arduino CLI does have a --libraries option.

nomadic68

Hi,

I am using the Arduino CLI, not the command line interface of the standard IDE:
my aim is to have a better control of the whole source tree (including libraries) and the compiler options.
(that is, like i had with Atmel Studio when it was working; at a certain point the support for the ARM boards broke and never got fixed, so i moved away from AS7 and landed to Visual Studio Code and Arduino CLI).

And yes, I was meaning the --libraries options of Arduino CLI, sorry for the typo.

Would it be possible to make a change request to the CLI developers to allow better control of the libraries folders? How?

Thanks

pert

OK
1) C:\Program Files (x86)\Arduino\libraries
As I mentioned before, this folder will only be used by Arduino CLI if it's bundled with the Arduino IDE at C:\Program Files (x86)\Arduino. This is in preparation for the planned complete replacement of arduino-builder with Arduino CLI as the engine behind the Arduino IDE's GUI. So you can simply use a standalone installation of Arduino CLI to avoid the use of this folder.

2) %userprofile%\Documents\Arduino\libraries
Arduino CLI always uses the libraries subfolder of the user directory. %userprofile%\Documents\Arduino is the default user directory, but you are welcome to set it to any location you like. You can learn more about that here:
https://arduino.github.io/arduino-cli/latest/configuration/
Note also that configuring Arduino CLI has become even more convenient with the addition of the ability to control the configuration settings  via `arduino-cli config`:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_config/

You can have a separate configuration file for each project if you need different settings.

and the compiler options.
You can inject arbitrary compiler flags using the `arduino-cli compile --build-property` flag:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/#options
Some detailed discussion about that here:
https://github.com/arduino/arduino-cli/issues/846

Would it be possible to make a change request to the CLI developers to allow better control of the libraries folders? How?
Sure, though it seems to me that the tool already provides all the functionality you seek. You can learn about submitting feature requests and bug reports here:
https://arduino.github.io/arduino-cli/latest/CONTRIBUTING/#issue-reports

nomadic68

@Pert: 1000 thanks for the useful indications, now i have a lot to work on!
You are right, i have downloaded the Arduino-CLI and started using it without uninstalling my Arduino IDE, so the CLI found the boards and the libraries automatically. I will look at the configuration options you pointed me to in order to  understand them better.
I also came across the PRO version of the IDE, i got curious, downloaded it and gave it a look: surprisingly, the PRO IDE didn't find the normal IDE folders. If i get this one to work the way i want, it will save me from the hassle of studying how to set up VS Code instead. Wow!


 

pert

@Pert: 1000 thanks for the useful indications, now i have a lot to work on!
You're welcome. Please let me know if you end up having any other questions or problems.

i have downloaded the Arduino-CLI and started using it without uninstalling my Arduino IDE, so the CLI found the boards and the libraries automatically.
There's no problem with having Arduino CLI and Arduino IDE installed at the same time. I always have both installed (as well as Arduino Pro IDE). By default, Arduino CLI does use the same user, data, and download directories as the Arduino IDE, but you can always configure it to use other directories if that's a problem for you. The only time the Arduino IDE being installed has special implications for Arduino CLI is if Arduino CLI is installed to the same folder as the Arduino IDE, but that's easy enough to work around simply by moving Arduino CLI somewhere else.

If i get this one to work the way i want, it will save me from the hassle of studying how to set up VS Code instead. Wow!
I'm glad if the Arduino Pro IDE provides for your needs. Arduino Pro IDE actually uses Arduino CLI under the hood so you will find the Arduino CLI configuration file information also applies to the Arduino Pro IDE configuration.

Go Up