Timezone library cannot find Time.h

The timezone branch of Motobuddy does not build – the complaint is a missing Time.h when building the Timezone library (library ID 76).

The failing branch is here:

The failing Travis CI build is here:

The failure text is as follows:

Compiling .pioenvs/adafruit_feather_m0_usb/src/main.o
In file included from src/main.cpp:11:0:
.piolibdeps/Timezone_ID76/Timezone.h:19:76: fatal error: Time.h: No such file or directory
#include <Time.h>              //http://www.arduino.cc/playground/Code/Time
^
compilation terminated.

Any suggestions?

I manually added library 44 (Time) before library 76 (Timezone) and it works now. I think that the Timezone library needs a dependency on the Time library.

Please create library.json manifest for your library and specify and specify dependecies. Later, please register it.

Not my library. I’ll open an issue on their GitHub repo. It is already registered (that’s why it has library ID 76 I think).

As a test I tried adding:

  "dependencies":
  [
      {
          "name" : "Time",
          "frameworks" : "arduino"
      }
  ],

To .piolibdeps/Timezone_ID76/library.json. This failed with:

Error: Could not findTimedependency forTimezonelibrary

If I change the dependency to:

  "dependencies":
  [
      {
          "name" : "Adafruit BluefruitLE nRF51",
          "frameworks" : "arduino"
      }
  ],

Then it works fine, and I see:

|-- <Timezone>
|   |-- <Adafruit BluefruitLE nRF51> v1.9.3
|   |   |-- <SPI> v1.0

So the bottom line at this point is that I am unable to add a dependency for the existing Time library (library 44) to the library.json for the existing Timezone library (library 76).

This is a service folder. Please don’t modify it. PlatformIO handles dependecies and install them on “install” stage. If you add this manfiest to a library and install it using PlatformIO Library Manager, all will work.

OK, I have made a repository that demonstrates the current issue. I did the following:

bcr blake$ mkdir libtest
bcr blake$ cd libtest/
libtest blake$ platformio init --board uno

The current working directory /Users/blake/Source/bcr/libtest will be used for project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.

The next files/directories have been created in /Users/blake/Source/bcr/libtest
platformio.ini - Project Configuration File
src - Put your source files here
lib - Put here project specific (private) libraries

Project has been successfully initialized!
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
`platformio run --help` - additional information

libtest blake$ echo 'lib_deps=https://github.com/bcr/Timezone.git#bcr-time-dependency' >> platformio.ini 
libtest blake$ echo "#include <Timezone.h>" > src/main.cpp
libtest blake$ platformio run
[Wed Nov 16 14:05:15 2016] Processing uno (platform: atmelavr, lib_deps: https://github.com/bcr/Timezone.git#bcr-time-dependency, board: uno, framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------
LibraryManager: Installing Timezone
git version 2.8.4 (Apple Git-73)
Cloning into '/Users/blake/Source/bcr/libtest/.piolibdeps/installing-dhIL0q-package'...
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 1), reused 11 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), done.
Checking connectivity... done.
Timezone @ a3dd6de has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
Collected 26 compatible libraries
Looking for dependencies...
Error: Could not find `Time` dependency for `Timezone` library
============================================================= [ERROR] Took 2.25 seconds =============================================================
libtest blake$ 

I forked your repo from when you did the work to create the package.json initially, and I modified it to add the Time library dependency. If you follow this set of steps to make a project and use the new library, it will fail to find the Time library dependency.

Thanks for the help so far, I’ll see if there’s an easy way to fix the dependency, and then I will submit a pull request for you to integrate the changes.

I just realized that the output is kind of messy, the steps I did (without any other output):

$ mkdir libtest
$ cd libtest/
$ platformio init --board uno
$ echo 'lib_deps=https://github.com/bcr/Timezone.git#bcr-time-dependency' >> platformio.ini 
$ echo "#include <Timezone.h>" > src/main.cpp
$ platformio run

Please sorry, that is my fault! I’ve just seen that this library uses my forked library.json. I updated it. Please try again

> pio lib -g install Timezone
Library Storage: /Users/ikravets/.platformio/lib
Looking for Timezone library in registry
Found: http://platformio.org/lib/show/76/Timezone
LibraryManager: Installing id=76
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Timezone @ 510ae2f6b6 has been successfully installed!
Installing dependencies
Looking for Time library in registry
Found: http://platformio.org/lib/show/44/Time
LibraryManager: Installing id=44
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Time @ 1.5 has been successfully installed!

This works fine now, thank you for the help!

I don’t understand why my fork of your fork of the Timezone library with the same modification to add the dependency for the Time library didn’t work. I forked your repo, then made this changeset:

https://github.com/bcr/Timezone/commit/a3dd6deed7aaffad79dc0d811f4c087aff9393c9

Which I think is the same as your changeset:

https://github.com/ivankravets/Timezone/commit/80f730c57654f01541a81aa80ecf1983270ce5b8

But mine could not find the “Time” dependency.

PIO handles dependencies from library that is located in PIO Registry. In previous post, you used library from GIT. PIO doesn’t look for dependencies in this case.