Perhaps a bug in uecide core selections?

After some lib updates done in the Arduino IDE my sketch no longer compiled under uecide. While I found a remedy, I believe the underlying cause might be a bug in uecide.

Compilation failed with this message:

        ‣ RTClib [/home/ullix/Code/Arduino/libraries/RTClib]
            ◦ USI_TWI_Master.cpp
    • Error at line 22 in file USI_TWI_Master.cpp:
        ‣ avr/interrupt.h: No such file or directory

I found that the USI* file is part of the TinyWireM lib. Making this lib inaccessible results in a correctly running sketch, despite compiler giving this remark:

    Compiling...
    • Preprocessing...
    /home/ullix/Code/Arduino/libraries/TinyWireM/TinyWireM.h (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/USI_TWI_Master.h (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/TinyWireM.cpp (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp (Datei oder Verzeichnis nicht gefunden)
    • Converting binary files
    /home/ullix/Code/Arduino/libraries/TinyWireM/TinyWireM.h (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/USI_TWI_Master.h (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/TinyWireM.cpp (Datei oder Verzeichnis nicht gefunden)
    /home/ullix/Code/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp (Datei oder Verzeichnis nicht gefunden)
    • Compiling sketch...
    ◦ am_0.4_05-15b_combined.cpp
    • Compiling core...
    ‣ base64
    ‣ esp32
   • Compiling libraries...

Note that is also shows compiling for core esp32!

Looking into RTClib.cpp I find these lines:

    #ifdef __AVR_ATtiny85__
    #include <TinyWireM.h>
    #define Wire TinyWireM
    #else
    #include <Wire.h>
    #endif

which looks to me like AVR_ATtiny85 is defined, and therefore this wrong lib chosen, although I have no avr whatsever, never activated it myself, and only want ESP32.

Is this avr* definition intentional or a bug? And how can I blank it out? (Apart from the just-learned localization of the lib and its subsequent modification :-))

Comments

It's not a bug, it's a

It's not a bug, it's a "feature". More a shortcoming of the current dependency parsing. Simply put: it sucks. It just uses a regex to look for any #includes and adds them to the library list - whether they are excluded by #defines or not.

The only way I can improve it is to use the compiler's preprocessor to parse the file fully with all the right command line flags etc. That's not easy, and is very messy, especially when you have to support lots of different compilers, including non-GCC ones (like SDCC for example).

It is something that I am working on with the new library system, along with better limiting of libraries to specific architectures regardless of their location (properly using the library.properties file, as long as the library maintainers actually filled it in properly...).

For now you can slip the TinyWireM library into a folder within the libraries folder named after the core that it should be used with (so libraries/tiny/TinyWireM or whatever) or just delete it entirely if you don't need it (it's only showing the errors because it thinks the library is still there and just needs a refresh of the internal structures to realise that it's gone).

Pages