Downloading libraries in Raspberry Pi

I'm having troubles downloading a library to the Arduino IDE in a Raspberry Pi. I assumed this problem was more of a pi problem than an Arduino IDE but the only response I got from the pi forum was to ask here, so here I am.

I'm using the IDE in the pi desktop, I downloaded the TinyGPSPlus library zip file. I go to sketch/import library/add library. At first I got errors saying the file can't have certain characters in the file name, so I've renamed it, Eventually I was able to add the library.

Now when I go to include the library to my sketch I go to sketch/import library, I see that TinyGPSPlus is an available library but when I select it it only adds a blank line to the sketch not #<include TinyGPS++.h>.

I've confirmed both using file explorer and ls in the terminal that the folder and all sub folders and files are there.

First question, why do I get a blank line?

Second question, what is the proper procedure to import a library when in pi?

thanks
John

Which platform you use the Arduino IDE on is not importent. The failing include may be related to the "++" in the file name, but you can manually add it by adding "#include <TinyGPS++.h>" to the include section of your sketch.

@Danois90, thanks for the suggestion but that doesn't seem to work either. I have an existing program, that I program in windows and transferred to the pi and that has that, I tried to compile it and get the error "TinyGPS++.h: No such file or directory"

I then tried on a blank sketch and get the same thing.

Thanks again for the help

Was the downloaded library sucessfully added to the library folder (typical locations: /home/pi/Arduino/libraries or /home/pi/snap/arduino/current/Arduino/libraries)?

No it's not and I was thinking that could be the problem but I don't see anyway I can tell it to load it to the proper folder, also wouldn't think I would have to. Most of the libraries are in "/usr/share/arduino/libraries" but some other libraries I had imported a couple of years ago are in "/home/pi". It's been a couple of years since I've been back into the pi.

When I go to the folder that has the zip file there's no where to say where to put it so I'd assume it would just go to the default folder. When I added this library it put it in "/home/pi".

I can also select a library that is in either folder and it does include in my sketch.

John

Stumpy_L:
Most of the libraries are in "/usr/share/arduino/libraries" but some other libraries I had imported a couple of years ago are in "/home/pi".

That implies that you installed the Arduino IDE using the system's package manager. It's probably an ancient version. Uninstall it and download the latest version from the Arduino website.

Pieter

As mentioned @PieterP it has been a couple of years since I've worked with this pi and in computer years that is ancient. I'll uninstall and reinstall the latest version

Thanks
John

PieterP:
That implies that you installed the Arduino IDE using the system's package manager. It's probably an ancient version. Uninstall it and download the latest version from the Arduino website.

Pieter

My Arduino IDE is V1.8.13, installed as a snap using the package manager on Kubuntu 20.04.

Danois90:
My Arduino IDE is V1.8.13, installed as a snap using the package manager on Kubuntu 20.04.

AFAIK, Raspbian doesn't come with Snap preinstalled, and many guides on the internet will tell you to sudo apt install <package name>, which will install version 1.0.5:

$ apt-cache policy arduino
arduino:
  Installed: (none)
  Candidate: 2:1.0.5+dfsg2-4.1
  Version table:
     2:1.0.5+dfsg2-4.1 500

Please just download the official Arduino IDE from this website:

For the Raspberry Pi, use the "Linux ARM 32 bits" download link on that page.

The package manager versions are created by third parties. In order to meet the requirements for addition to the package manager repositories, they must make modifications to the Arduino IDE. Sometimes they make other modifications beyond what is required. This regularly results in the package manager versions of the Arduino IDE having unique bugs. Not as many of the people here on the forum use the package manager versions of the Arduino IDE, so we're less able to provide support for those package manager-specific bugs.

when I run "apt-cache policy arduino" I get the same version as Pieter90. I will uninstall it and reload as per how pert has shown.

thanks all

pert:
The package manager versions are created by third parties.

Is there a reason why there isn't an official APT package? Many Linux desktop systems run some kind of Ubuntu- or Debian-based distro, so having an official APT distribution would be quite useful for a majority of Linux users.

If that's not something that Arduino wants to spend developer time on, that would be unfortunate but not unreasonable, however in that case, there shouldn't be an “arduino” package at all IMHO. Especially not such an ancient, unsupported version.

I expressed a similar sentiment a few years ago:

My feeling is that either Arduino needs to take an official role in maintaining the Linux packages or else the packages should be removed. Yes, it's another job, but if you're going to present a keynote speech at the Embedded Linux Conference titled "Arduino & Linux: A Love Story", well... Even beyond this license issue, it just seems like having 3rd parties making random modifications to the IDE and not keeping the packages updated leads to many more problems than if the Arduino IDE was only available for download from Arduino's website.

The response from one of Arduino's firmware developers:

I mostly agree with you, but historically it has always been the distribution's maintainer duty to compile and package the supported applications.

There was also some interesting information about why these modifications to the IDE are necessary before it can be accepted into the package repositories:

We have a huge dependency problem, mostly due to the fact that the "zero external dependencies" approach started by bundling the JRE helps the beginners but becomes a PITA for repackagers.

I believe @NicoHood 's effort on AUR packets is the way to go; we could add a wrapper to easily create deb packages in the repo itself to ease rebuilding, but we need some advice from the actual Debian/Ubuntu/Raspbian packagers to do the right thing.

The Arduino approach is to make things as easy as possible by making it so that when you install the Arduino IDE you get everything you need to start working with the AVR boards right away: Java, avr-gcc, avrdude, etc. But the package manager's don't allow that because each of those dependencies already have their own packages.

There was recently a community effort to create a package for Arduino CLI. I have more optimism about how that will turn out because Arduino CLI doesn't have all these bundled dependencies, so should be able to be packaged without any modifications at all. But you still have the issue of the package maintainer getting busy with other things and not keeping the package up to date. I think that issue could probably be mitigated to a large extent by taking the time up front to automate the system as much as possible. But even automated systems require some care and feeding from time to time to keep them running.

One interesting thing is that Arduino CLI does have an officially maintained Homebrew formula. After the initial work to establish the formula, the formula updates are now done completely automatically as part of the release process.

Very interesting information. This is probably why the look, and operation, of adding a library is so different between the Windows version and the Raspbian

Thanks
John

PieterP:
AFAIK, Raspbian doesn't come with Snap preinstalled, and many guides on the internet will tell you to sudo apt install <package name>, which will install version 1.0.5:

Bummer! Even though I dislike snap-packages for their bulkiness and their slow startup (due to compression), they offer a simple one-click sollution to install latest Arduino IDE and all of it's dependencies and run those in a sandbox-like environment. That's neat! :slight_smile:

Success! I downloaded the latest version of the Arduino IDE, 1.8.13, by installing Linux ARM 32 bits,. The add Library is more what I'm accustomed to. I have a sketch that I had imported to the pi and between the Manage Libraries and download from zip I was able to install all the libraries I needed.

Now I can get back to working on my sketch.

Thanks so much for all the comments and help
John

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.