Build Process Driving Me Insane....

I am, once again, butting heads with the build process. I’ve been beating my head against the wall for the last hour, and every change I make creates another nonsensical error, telling me include files that absolutely DO exist do not, or that it can’t find an include file that is not even referenced in the class its compiling.

Here is the error I’m getting at the moment:

C:\Users\RayL\AppData\Local\Temp\build4822534246727886184.tmp\BOBTester.cpp -o C:\Users\RayL\AppData\Local\Temp\build4822534246727886184.tmp\BOBTester.cpp.o
In file included from C:\Users\RayL\AppData\Local\Temp\build4822534246727886184.tmp\BOBTester.h:6:0,
from C:\Users\RayL\AppData\Local\Temp\build4822534246727886184.tmp\BOBTester.cpp:4:
C:\Users\RayL\AppData\Local\Temp\build4822534246727886184.tmp\UniTester.h:5:24: fatal error: I2CSCanner.h: No such file or directory
#include <I2CSCanner.h>
^
compilation terminated.
Error compiling.

Now, what’s strange about this is that BOBTester.cpp, BOBTester.h and the UniTester.h in the sketch directory do not contain ANY references to I2CScanner.h. But, the UniTester.h in the build directory DOES contain a #include <I2CScanner.h>. Why is it adding that?

This project consists of a small sketch (UniTester.h, UniTester.ino), and a large number of other classes, all in their own .cpp and .h files, all in one project directory. All of these other classes #include UniTester.h, as well as a large number of other local and global libraries, like LiquidCrystalI2C, SoftI2CMaster, Wire, and many, many others. It was all working just fine, until I made a small “improvement” in one of the classes. It’s been all downhill from there…

So, why is I2CScanner.h getting shoved into UniTester.h, and how do I make it NOT do that?

Unfortunately, this project is far too large, and far too many files, to post here, but I’m sure the problems I’m having are due to not adequately understanding the build process, rather than a problem in my code.

Regards,
Ray L.

It's case sensitive so it's I2CSCanner.h not ISCScanner.h

Mark

And it is in one of your BOBTester's. If your using an editor outside the Arduino IDE make sure you save before building.

Mark

That's a good catch, I can't believe I didn't spot that.

But, this is where it gets deeply weird.... I've grep'd the ENTIRE sketch directory tree - ALL my projects, and ALL my libraries - and "I2CSCanner.h" exists in only one old project that has nothing to do with the current project. It does not occur in ANY of the files involved in this project. So where is it coming from?

Regards, Ray L.

Is it in one of the BOBTesters?

AS I understand the Arduino IDE it rebuilds ALL your .c and .cpp files every time you do a build. This avoids the need for a make file.

Mark

This is just loony… OK, so I close everything, then re-started just the Arduino IDE, opened the project, and did a verify. I now get a completely different, but no less irrational, error:

C:\Users\RayL\AppData\Local\Temp\build2620674784740847926.tmp\ComponentTester.cpp:7:27: fatal error: SoftI2CMaster.h: No such file or directory
#include <SoftI2CMaster.h>
^

SoftI2CMaster is a valid library, used in several other projects. It is correctly installed in my local library, along with dozens of other libraries, all working fine. So why does the build NOT find it when building this one class? It was compiling earlier this afternoon.

I suspect it has to do with the class heirarchy:

ComponentTester.cpp includes LiquidCrystal_SoftI2C as well as SoftI2CMaster
LiquidCrystal_SoftI2C also includes SoftI2CMaster

I’ve had problems in the past with libraries including other libraries - in some cases, those other libraries cannot be found, even though they are right where they are suppose to be. I can copy those other libraries to the same directory as the top-level library, and the build will succeed. I suspect I am now having a related problem here.

Regards,
Ray L.

holmes4:
Is it in one of the BOBTesters?

No, it’s in a totally unrelated project.

Regards,
Ray L.

Is there a way to create a local library directory that can be addressed by an explicit, absolute path? Seems to me that would get around many of the problems I've had, and would be easier than littering the files with extraneous #includes just to make the build process happy. Could I, for instance, move all my local libraries up to C:\Arduino, then include them as "#include "C:\Arduino\libraryname\includename"?

Regards, Ray L.

I don't think there is a "tree" as you put it, and there's no such thing as an arduino "project". No project no makefile no nothing. It just builds every thing that is a .c or .cpp Just brute force!

holmes4: I don't think there is a "tree" as you put it, and there's no such thing as an arduino "project". No project no makefile no nothing. It just builds every thing that is a .c or .cpp Just brute force!

By "project", I mean everything in the sketch directory. Yes, the build process "just builds everything", but it does a lot of mangling and copying of files along the way. That mangling and copying is what is screwing me here., and I don't know enough about exactly what it's doing to know how to work around it, or trick it into doing what it needs to do to build this application.

Regards, Ray L.

Below is a simple example (one sketch and two libraries) that exhibits the same problem. Attempting to build the sketch gives this error:

In file included from BlivetSketch.ino:2:0:
C:\Users\RayL\Documents\Arduino\libraries\LiquidCrystal_SoftI2C/LiquidCrystal_SoftI2C.h:9:27: fatal error: SoftI2CMaster.h: No such file or directory
#include <SoftI2CMaster.h>
^

Even though SoftI2CMaster.h is exactly where it should be. If I move the files for SoftI2CMaster into the LiquidCrystal_SoftI2C directory, and change the includes to #include “” instead of #include <>, then it builds.

How do I get around this? I don’t want those two classes in the same library.

Regards,
Ray L.

Bug.zip (9.26 KB)

By "project", I mean everything in the sketch directory.

I think that this is your problem. IT's every thing in both lib's yours and the IDE's

There is just no concept of "project"!

Mark

I think I've pinned down what is happening, but I don't have a clue how/why, or what to do about it.

I can take a working library, then create a new sketch, and in the sketch directory, create a new stand-alone class (.cpp/.h files) that reference that library. That class will not compile, failing with a .h not found error, even though the needed library is present, and does work. Similarly, if one library, in my local libraries, references another library, that build too will fail in the same way. The only solution I've found for this is to copy the needed libraries to the same directory as the class that needs them. That sucks!

Surely there is some way around this, short of copying libraries all over the place, which is completely un-maintainable.

Regards, Ray L.

OK, I have a solution that works, but I sure don't like it....

I create symlinks to all the libraries in the sketch directory, and use a quoted, rather than angle brackets, include path. I hate doing it this way, but it's the only way I can get these things to build.

There HAS to be a better way....

Regards, Ray L.

I don't like this appdata\local\temp stuff.

RayLivingston:
There HAS to be a better way…

You will have to decide if this is better.

The Arduino IDE only includes libraries that are listed in the sketch. Because LiquidCrystal_SoftI2C.h uses SoftI2CMaster and I2CScanner these have to be added to the top of BlivetSketch…

#include <SoftI2CMaster.h>
#include <I2CScanner.h>

Ray,

Take a deep breath. Take a walk. Show me "wax on, wax off'. Show me "sand the floor".

Now read this: How to avoid the quirks of the IDE sketch file pre-preprocessing

Nick,

I already do all that. The problems I’m having occur under two circumstances, both involving building stand-alone classes.

Create a library. Let’s call it LibA, consisting of a .h file and a .cpp file. Put these in your “local” library - sketchbook\libraries\LibA.

Now do the same with LibB, putting it in sketchbook\libraries\LibB.

Now create a sketch, LibTest.ino, that uses these libraries, putting it in sketchbook\LibTest.

So far, all works well. It builds, it runs. Now, modify LibA, so it uses LibB, and include LibB in LibA using:

#include <LibB.h>

In my experience, this will not work. You’ll get a LibB.h not found error on compile, which I have been able to fix ONLY by copying/linking the LibB files into the LibA directory, and changing the include in LibA.h to:

#include “LibB.h”

Now, LibA, and the sketch, will build and run.

Now, create a new object, LibC, but place the .h and .cpp files that define it in the LibTest sketch folder, and include LibC into the sketch using:

#include “LibC.h”

This will work fine. But, now modify LibC, so it uses LibA, by adding:

#include <LibA.h>

This will fail to compile, with a LibB.h not found error. The only way to get it to compile is to copy/link all the files for LibA and LibB to the sketch folder, and change all includes to use “” instead of <>.

#including those libraries into the .ino file does NOT make the sketch compile.

When I look at the build directory after a failed build on LibC.cpp, NONE of the files for the libraries from the sketchbook are present, no matter how many nonsensical places I sprinkle #includes for them throughout the sketch itself.

Regards,
Ray L.

This will work fine. But, now modify LibC, so it uses LibA, by adding:

#include <LibA.h>

Because it should be #include"LibA.h" but I think that the IDE has a screwed up $PATH

Once upon a time when C was young and C++ had yet to be invented you had 2 sets of lib’s the system libs accessed using < .h> and the user accessed using " .h"

$PATH is used to tell the compiler etc where to look for things.

Mark