Cannot update RTClib

  1. I cannot update either with the Update button or by selecting Version 2.14. After reopening Manage Libraries the update is still being offered. Same after restarting IDE 1.8.19.

  2. Why is version 2.12 not listed?

  3. Shouldn't version 2.13 also be listed, even though it is installed?

EDIT:
I've just tried IDE 2.3.2 which is much more informative, telling me:
Failed to install library: 'RTClib:2.1.4'.
Error: 3 INVALID_ARGUMENT: The library RTClib has multiple installations:

and listing several, all beginning with 'RTClib'. So it seems that I was wrong in assuming that specifying exactly 'RTClib' would be absolutely unambiguous, yes?

Not if has been withdrawn and is now not available to be installed

See above

1 Like

Thanks, understood.

And re the main issue (failing to update to 2.1.4) , presumably the compiler goes deeper than just the name 'RTClib'? What exactly does it look at to conclude that there are multiple versions, even though there is only one named 'RTClib'?

Please post the list

It looks at the name field in the library.properties metadata file. This file will be located in the root of the library's folder.

Some older libraries don't have a library.properties metadata file, and in this case Arduino IDE identifies the library by its folder name, but all libraries from Library Manager have a library.properties file.

library.properties is just a text file. You can open it in any text editor and search the contents of these files using any text search utility. You'll see something like this in the file:

name=RTClib
1 Like

Thanks, that's helpful.

After further study I'm pretty sure I know the cause of my problem.
I discussed a manual edit to RTClib in the thread
https://forum.arduino.cc/t/change-rtclib-clock-time-without-new-upload/1233491/61

As confirmed in its post #62, I submitted that as an 'Issue' here:
https://github.com/adafruit/RTClib/issues/299

After some joint testing that facility was subsequently adopted as a 'Pull request' (#300, 'DS3231: Add support for the Aging Offset Register') by Edgar Bonet:
https://github.com/adafruit/RTClib/pull/300

I will ask Edgar but assume this is part of the recent update, 2.1.4. If so then it will obviously 'break' my existing sketch, as I edited RTClib.h and replaced that file in my RTClib library.

However, I don't understand why, given that I'm still using 2.1.3 (a library that as I mentioned apparently no longer exists in Manage Libraries!) my sketch no longer compiles. It gives the error
'class RTC_DS3231' has no member named 'readAging'

@UKHeliBob
In reply to your question, the error report includes this:

Alternatives for RTClib.h: [RTClib@2.1.3 RTClib-BeforeAging@2.1.1 RTClib-aging-offset@2.1.3 RTClib-MyEdit@2.1.3]

I provided a detailed explanation here:

https://github.com/adafruit/RTClib/issues/302#issuecomment-2051075289

It was explained by the RTClib developer here:

https://github.com/adafruit/RTClib/issues/302#issuecomment-2050111587

the 2.1.2 release is essentially non-existent due to an issue with not updating library.properties correctly.

I'll provide a more detailed explanation: The unit of release for Arduino Library Manager is the Git tag. A tag is a marker at a specific point in the revision history of the library's repository. The automated system that populates Library Manager (referred to as the "indexer") periodically checks out each of the tags in each of the library repositories and then adds any new releases it finds that are compliant with the requirements for inclusion.

Versioning of Library Manager libraries is done according to the version field of the library.properties file. Even though it is common to use version numbers as tag names, the Library Manager indexer does not use tag names for versioning.

As I mentioned above, only new releases are added by the Library Manager indexer. "New" is determined by comparing the value of the version field at the tagged point to the version numbers of the releases of the library that have been added to Library Manager previously.

If you look at the version field in the RTClib library's library.properties file at the 2.1.2 tag:

You can see that the library developers forgot to update the value before making the tag. So as far as the Library Manager indexer is concerned, this tag does not represent a new version, and so it ignores it.

If you look at the version field in the RTClib library's library.properties file at the 2.1.3 tag:

You can see that the developers did remember to update the value before making the 2.1.3 tag, so a 2.1.3 release of the library was added to Library Manager.

This is the reason why there is no version 2.1.2 of the RTClib library in Arduino Library Manager.

It was explained by the RTClib developer here:

https://github.com/adafruit/RTClib/issues/302#issuecomment-2050111587

2.1.3 is not in the drop down list since it is the currently installed version.

It seems like you have made quite a mess.

Here is what I recommend:

  1. Start Arduino IDE.
  2. Select File > Preferences... (or Arduino > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Note the path shown in the "Sketchbook location:" field of the "Preferences" dialog.
  4. Click the "Cancel" button in the "Preferences" dialog.
  5. Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus.
    All Arduino IDE windows will close.
  6. Using your file manager, open the folder at the path that was shown in the "Sketchbook location" IDE preference.
  7. Navigate to the libraries subfolder.
  8. Delete all the folders of your various "RTClib" library installations.
    :warning: Please be careful when deleting things from your computer. When in doubt, back up!
  9. Click the following link to open the GitHub repository homepage at the version of the library with Edgar Bonet's "aging offset register" feature in your web browser:
    https://github.com/adafruit/RTClib/tree/4d19d981129b9c795d794b20927b75d4349237c2
  10. Click the "Code ▾" button you see on that page.
  11. Select Download ZIP from the menu.
    A download of the ZIP file of the library will start.
  12. Wait for the download to finish.
  13. Select Sketch > Include library > Add .ZIP Library from the Arduino IDE menus.
    The "Select the zip file containing the library you'd like to add" dialog will open.
  14. Select the downloaded file from the dialog.
  15. Click the "Open" button.
    The dialog will close.
  16. Wait for the message to appear on the teal bar in the Arduino IDE Window:

    Library added to your libraries. Check "Include library" menu

Arduino IDE may periodically show a notification that a newer version of the library is available. This is because the version number in the metadata at the time of Edgar Bonet's work was 2.1.3, but Adafruit made a 2.1.4 release since that time. Edgar Bonet's work has not been merged into the library so if you update the library to 2.1.4 the "aging offset register" feature will no longer be present in the version of the library you have installed.

Many thanks for taking the time over that thorough explanation.

I understand that it looks that way! But it was a tightly controlled ‘mess’ that worked well for me - until the 2.1.4 update. It failed for reasons I think I now understand thanks to you.

Those alternative libraries were effectively merely backups. In retrospect it was clearly a mistake to keep them in my \libraries folder, where I assumed they would be ignored by the IDE and compiler.

I’ll give it further thought. But my preference is to simply restore the library I named RTClib but which was in fact version 2.1.3 with my aging edits added to RTClib.h. These were subsequently successfully incorporated in my full project. If I eventually do need the benefits of 2.1.4 or later then I’d review things.

They most likely would be. All else the same, when there are multiple libraries that contain a header file matching the name in an #include directive in your sketch, Arduino IDE will pick the library that has a name matching the header filename. If there are multiple libraries with the same name then it will use the match with the library folder name as the deciding factor.

The version of the library with Edgar Bonet's changes is actually not missing anything that is in the 2.1.4 release. You can see it here:

The only change missing from the Edgar Bonet version is the change to the value of the version metadata field:

--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
 name=RTClib
-version=2.1.3
+version=2.1.4
 author=Adafruit
 maintainer=Adafruit <info@adafruit.com>
 sentence=A fork of Jeelab's fantastic RTC library

So don't worry that you are missing out on something by not "updating" to 2.1.4. The situation might be different when the next release comes out, so it is definitely good to check back on the library from time to time. With luck, perhaps that "aging offset register" feature will be merged in by that time and you can go back to using the release versions of the library.

So did the developer (or you) change it earlier today? The two version numbers looked identical here when I opened that link just now (17:20, UK)
https://github.com/adafruit/RTClib/blob/2.1.2/library.properties#L2-L2

But as you see there was only one called RTClib.h, which gave the error in post #1.

No.

I don't understand what you mean by that. Which two version numbers are you referring to specifically?

RTClib.h is a filename, not a library name. The library name is "RTClib".

As I explained previously, the name of a library is defined by the name field of the library.properties file:

Although it is common for the filename of the primary header, the installation folder, and the repository name to be the same or similar to the library name, there is no requirement or guarantee that it be so.

You said the developer forgot to change 2,1.1 to 2.1.2.
The link you gave when I opened it today showed that they didn’t. So I wondered if it was a change made since your earlier post.

Re the name, I thought that despite the strict technical (non-intuitive) definition you’d explained previously you were now referring to the (intuitive) text string in the include statement.

Please check again. Click the following link:

https://github.com/adafruit/RTClib/blob/2.1.2/library.properties#L2

There you will see the contents of the library.properties file as it was at the time they made the Git tag named 2.1.2. If you check the value of the version field in the file as it was at that point in the library's revision history, you should see that it is 2.1.1.

It is a common mistake to think the header filename is the library name. It is not. That is only one of the files of the library.

Libraries sometimes have multiple header files which might be used in the sketch depending on the application. So you see that we can not consider the header filename to be the library name even if you could often (but not always) infer the library name simply by trimming off the .h file extension from the header filename.

1 Like

My mistake, sorry. Don’t know how I missed that after staring so long at it, but having looked again I obviously did!

No worries. It is obviously only a boring minutia for most anyone other than an Arduino library maintainer, but I happen to find it an interesting subject so I like talking about it.

This mistake of library maintainers forgetting to bump the version field value before making a release tag is quite common. As the person who provides support for the Library Manager indexer system, I regularly receive reports when they think something is wrong with the indexer after a release is not picked up.

1 Like

Me too. So can I ask a related question please?

The first of many (currently 47) entries in my \libraries folder is called 'arduino_129118'. (From previous discussions I understand this is a result of the library manager avoiding possible ambiguity during a previous installation.)

I'd like to rename it to something meaningful. If I open its Properties file I see its correct name is specified by this line:
name=Adafruit MCP23017 Arduino Library

While I assume that 'Arduino Library' is relevant to the library manager, can I confidently ignore it and rename the library to 'Adafruit MCP23017'?

Do you mean rename the folder that the library files are in ?

No! Rename the current name 'arduino_129118'.

Nice!

It is not. The name value is an arbitrary string. There is no technical significance to the specific content of the string.

In the context of a discussion about Arduino libraries, the term "name" by itself will be considered to be a short form of "library name". As explained previously, the library name is the value of the name field in the library.properties metadata file. So you should only use the term "name" when referring to that value.

arduino_129118 is not the value of the name field in the metadata so you should not use the term "name" when referring to this. This is the "library folder name".

There is an exception, as I mentioned in post #5: in the case of libraries that are installed manually, the presence of a library.properties file is not mandatory. In this specific case, the library folder name defines the library name.

You are welcome to do that. You should make sure the folder name you use is compliant with the Arduino Library Specification:

https://arduino.github.io/arduino-cli/latest/library-specification/#library-root-folder

The library root folder name must start with a basic letter (A-Z or a-z) or number (0-9), followed by basic letters, numbers, underscores (_), dots (.) and dashes (-). The maximum length is 63 characters.

If you want to use the name Library Manager would have used if it hadn't resorted to that fallback folder name, just replace all the spaces in the library name with underscores (i.e., Adafruit_MCP23017_Arduino_Library).