Back in November I started a project based on the Spark Transport Display project and using that as a starting point.
Back then my project compiled properly using the CLI, but now it’s not. In a nutshell: the compiler ignores all files in the /lib subdirectory, and only compiles the files in the main project directory, then fails because it doesn’t see the /lib files that are referenced.
And, the same breakage happens now when I try to compile the original Spark Transport Display code.
Here’s the relevant error text:
Errors
In file included from Transport.cpp:1:0:
Transport.h:4:36: fatal error: Adafruit_CharacterOLED.h: No such file or directory
#include "Adafruit_CharacterOLED.h"
^
compilation terminated.
make: *** [Transport.o] Error 1
Compile failed - compile failed
@savage, you may have to create a spark.include file in your directory and see if you can include the lib directory via that. I have not tested this yet but it’s worth a shot.
The most recent updates to the Spark-CLI reverted the TI CC3000 patcher level and changed the readme instructions to do npm install. That doesn’t seem related.
I believe the default behavior (without adding a spark.include file), is to grab any source files (*.h, *.c, *.cpp, *.ino) in the directory provided. If you have a spark.include file in that directory, it’ll parse it and interpret any wildcards.
spark compile . / spark compile /some/directory
look for spark.include / spark.ignore files in that folder, or just grab any source files from there
spark compile foo.cpp foo.h main.ino
send those files specifically to compile
I think this has always been the default behavior… Maybe I’m confused? Here’s a generic spark.include file that should include everything in subdirectories:
#spark.include
# from current dir
*.h
*.ino
*.cpp
*.c
# and from any subdirectories
**/*.h
**/*.ino
**/*.cpp
**/*.c
I don’t believe I changed this behavior in the last release, but it’s possible some submodule got updated and broke something. Please do let me know if this doesn’t seem right, or if anyone has more info.
Thank you for bumping this, I’m sorry it took me this long to find the bug. If you notice something stop working like this, please ping me with @Dave, or feel free to open an issue on the repo directly (which will email me). I just released 0.4.94 which should fix the issue of ‘spark.include’ files not being considered. You can update the cli with this command:
npm update -g spark-cli
#and check the version with:
spark --version
#should report 0.4.94
Looks like I am still hitting this problem with 0.4.94. It complains about .h files not found in subdirectory, and when I move those files to the main directory (and changed the #include’s together with the spark.include) it works perfectly. Here is what happened when the MFRC522.* were inside the subdirectory MFRC522:
bleu:Spark edwintam$ spark compile musicsense
Including:
/Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/HTTPClient.cpp
/Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/HTTPClient.h
/Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/MFRC522/MFRC522.cpp
/Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/MFRC522/MFRC522.h
/Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/musicsense.ino
attempting to compile firmware
pushing file: /Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/HTTPClient.cpp
pushing file: /Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/HTTPClient.h
pushing file: /Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/MFRC522/MFRC522.cpp
pushing file: /Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/MFRC522/MFRC522.h
pushing file: /Volumes/Haruka/Users/edwintam/Documents/Development/Spark/musicsense/musicsense.ino
Errors
musicsense.cpp:3:29: fatal error: MFRC522/MFRC522.h: No such file or directory
void transfer_data_lcd(byte ucData);
^
compilation terminated.
make: *** [musicsense.o] Error 1
Compile failed - compile failed
bleu:Spark edwintam$ ls -R musicsense/
HTTPClient.cpp MFRC522 spark.ignore
HTTPClient.h musicsense.ino spark.include
musicsense//MFRC522:
MFRC522.cpp MFRC522.h
bleu:Spark edwintam$ head musicsense/musicsense.ino
// This #include statement was automatically added by the Spark IDE.
#include "HTTPClient.h"
#include "MFRC522/MFRC522.h"
#define version 102
/****************************************************************************
* Project: Generic project name *
* *
****************************************************************************/
bleu:Spark edwintam$ cat musicsense/spark.include
HTTPClient.cpp
HTTPClient.h
MFRC522/MFRC522.cpp
MFRC522/MFRC522.h
musicsense.ino
bleu:Spark edwintam$ spark --version
0.4.94
bleu:Spark edwintam$