U8glib.h compiling error

Hi All,

I am hoping I may be able to get some assistance regarding installing a ST7920 controlled 128 x 64 LCD dot matrix screen.

I have been trying to fix this issue for days with no luck!

I have installed the following library into my Arduino IDE - u8glib_arduino_v1.18.1.zip - Success

The following code is one if the examples that came with the u8glib which I am trying to get working:

#include "U8glib.h"

U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16


//#define MINI_LOGO

void drawColorBox(void)
{
  u8g_uint_t w,h;
  u8g_uint_t r, g, b;
  
  w = u8g.getWidth()/32;
  h = u8g.getHeight()/8;
  for( b = 0; b < 4; b++ )
    for( g = 0; g < 8; g++ )
      for( r = 0; r < 8; r++ )
      {
        u8g.setColorIndex((r<<5) |  (g<<2) | b );
        u8g.drawBox(g*w + b*w*8, r*h, w, h);
      }
}

void drawLogo(uint8_t d)
{
#ifdef MINI_LOGO
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(0+d, 22+d, "U");
    u8g.setFont(u8g_font_gdr20n);
    u8g.drawStr90(17+d,8+d,"8");
    u8g.setFont(u8g_font_gdr17r);
    u8g.drawStr(39+d,22+d,"g");
    
    u8g.drawHLine(2+d, 25+d, 34);
    u8g.drawVLine(32+d, 22+d, 12);
#else
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(0+d, 30+d, "U");
    u8g.setFont(u8g_font_gdr30n);
    u8g.drawStr90(23+d,10+d,"8");
    u8g.setFont(u8g_font_gdr25r);
    u8g.drawStr(53+d,30+d,"g");
    
    u8g.drawHLine(2+d, 35+d, 47);
    u8g.drawVLine(45+d, 32+d, 12);
#endif
}

void drawURL(void)
{
#ifndef MINI_LOGO
  u8g.setFont(u8g_font_4x6);
  if ( u8g.getHeight() < 59 )
  {
    u8g.drawStr(53,9,"code.google.com");
    u8g.drawStr(77,18,"/p/u8glib");
  }
  else
  {
    u8g.drawStr(1,54,"code.google.com/p/u8glib");
  }
#endif
}


void draw(void) {
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    drawColorBox();
  }
  u8g.setColorIndex(1);
  if ( U8G_MODE_GET_BITS_PER_PIXEL(u8g.getMode()) > 1 ) {
    drawLogo(2);
    u8g.setColorIndex(2);
    drawLogo(1);
    u8g.setColorIndex(3);
  }
  drawLogo(0);
  drawURL();
  
}

void setup(void) {
  // flip screen, if required
  //u8g.setRot180();
}

void loop(void) {
  
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  u8g.setColorIndex(1);
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(200);  
}

Unfortunatley everytime I try and compile this code (or any other of the examples) it returns the following error:

In file included from /home/pi/sketchbook/libraries/U8glib/U8glib.h:42:0,
** from U8gLogo.ino:42:**
/home/pi/sketchbook/libraries/U8glib/utility/u8g.h:119:25: internal compiler error: in type_hash_canon, at tree.c:6953
typedef uint8_t PROGMEM u8g_pgm_uint8_t;
** ^**
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

After days of searching for an answer I am now at a loss. Is there anyone who can help me understand this problem to rectify?

Kind Regards in adavnce
Pete

Maybe time to brush up on your search skills? When I searched, the very first hit was this, which includes a potential work-around.

I think fundamentally the issue is that the PROGMEM attribute is intended to label a variable and not a type, so some versions of GCC can't handle it. The line seems to compile for me though on v1.8.5 of the Arduino IDE. If you are not already using the most recent version, then try upgrading first.

@ arduam,

Hi,

i purchased the elecrow arduino automatic smart plant watering; dowloaded both the sketch and de library -RTC en U8glib.

i also get the same error, compiling. I went for your solution (PROGMEM thing), but it didn't work out for me.
It's the most recent arduino version on my raspberry pi (stretch).
I already re-installed arduino, the sketch, the libs but no good.

so, if you would be so kind, any suggestion would be more then welcome.

pantah

Pantah:
i also get the same error, compiling. I went for your solution (PROGMEM thing), but it didn't work out for me.

Please be more specific by posting the compiler output after you made the "PROGMEM thing" changes. Just saying it didn't work out doesn't convey much useful information.

hi @ arduam,

I couldn't get a screenshot so, i'll type the compiler error as it shows in the sketch,

In file included from /home/pi/sketchbook/libraries/U8glib/U8glib.h:42:0,
from watering_kit.ino:2:
/home/pi/sketchbook/libraries/U8glib/utility/u8g.h:106:25: internal compiler error: in type_hash_canon, at tree.c:6953
typedef uint8_t PROGMEM u8g_pgm_uint8_t;

so, i also noticed a little "marker?" under the bottom line, character 25 (the u )
I did try your solution but that gives me a few pages of error message, a bit to much for typing.....

i hope it gives you a more clear vieuw on this.
as you probably noticed, i'm not so familiar with the arduino forum but i'll do my best in the future :slight_smile:

Screen shots of text should be avoided; there is also no need to type out the error messages:

Just select all the text by clicking on the console output black box then pressing Ctrl-A, press Ctrl-C to copy, then paste it into your next post using Ctrl-V.

Post the error messages generated after you tried the previous solution.

Please also post the version of the Arduino IDE you are using. You can find it in Help->About Arduino, it is in the top left of the pop-up box.

hi Arduarn,

alright, i changed the line as mentioned in the post above, but the error message i got exceeds the max of 9000 characters. So i can't send it .Tonight i'll try to figure out a way of sending it anyway.
thx anyway for guiding me into some basics;

the arduino version i found in the top right box is 2:1.0.5+dfsg 2-4.1

.

kind regards
pantah

Hi Arduarn,

this is the original error message. I changed the''typedef ......."line but that gave me the error message with more than 9000 char.

In file included from /home/pi/sketchbook/libraries/U8glib/U8glib.h:42:0,
from watering_kit.ino:2:
/home/pi/sketchbook/libraries/U8glib/utility/u8g.h:106:25: internal compiler error: in type_hash_canon, at tree.c:6953
typedef uint8_t PROGMEM u8g_pgm_uint8_t;
^
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

Save it in a file and attach the file to your post.

alright, this should do it....hope the attachment is coming

if not, i better chose another hobby...

ERROR MESSAGE U8glb.doc (45.5 KB)

Posting MS Word documents will not please many people due to security concerns. It is best to just post a simple text file from notepad or similar.

Ok, so the error you are getting is quite strange:

In file included from /home/pi/sketchbook/libraries/U8glib/U8glib.h:42:0,
                 from watering_kit.ino:2:
/home/pi/sketchbook/libraries/U8glib/utility/u8g.h:998:9: error: 'u8g_pgm_uint8_t' does not name a type

because u8g_pgm_uint8_t is, as far as I can tell, defined in u8g.h both for AVR devices and as a fall-back for other devices

#if defined(__AVR__)
...
typedef uint8_t PROGMEM u8g_pgm_uint8_t;
...

#else

...
typedef uint8_t u8g_pgm_uint8_t;
...

#endif

And indeed the example sketch, which I presume you are using from this link https://www.elecrow.com/download/watering_kit.zip, compiles for me on a Linux PC, IDE version 1.8.5 using Arduino Uno and Micro targets.

What device are you compiling for?

I think that your version of the Arduino IDE is quite old, from before December 2016; may or may not be a problem. The compiler and other toolchain is probably packaged separately and may be of a different vintage, but I'm guessing it will also be somewhat old. For the moment, let's not worry about that.

hi,

sorry for the doc file, won't happen again.

I did download from the elecrow site and according to the manual it should be a
Leonardo.

I will check the arduino ide and have a look on the arduino download page.
I re-installed the IDE just a week or two ago.
Its's installed on a RPI3 with "stretch", nothing else is running.

I guess i bring back the u8glib int he original version -undo the changes-;

Perhaps it is better to start all over again, from scratch. New "stretch", new arduino IDE and then download the sketch and the libs?

if i may ask, what version of IDE did compile the libs?

okay, thanks a lot for your time and your help. i'll let you know if i get it together.

to be continued :confused:

mvg
Pantah

Hold on a minute, I forgot to edit the file with the "correction". Now I am getting some errors...

Doof! I need glasses...

The fix suggested in the GitHub post has a typo in it. It should be was for ucglib, so you need to tweak it for u8glib:

#define u8g_pgm_uint8_t uint8_t PROGMEM

i would say, that happens;

i corrected it and yes, the message " compilleren voltooid" in englisch, compiling completed.

but i'll send an attachment (a txt file 8) with some orange messages.

Meanwhile, i will connect the leonardo and see if it works.

compiling complete but........txt (9.84 KB)

/tmp/ccUVNQNB.s: Assembler messages:
/tmp/ccUVNQNB.s:1318810: Warning: .stabs: description field '14625' too big, try a different debug format
/tmp/ccUVNQNB.s:1318811: Warning: .stabs: description field '1469a' too big, try a different debug format
/tmp/ccUVNQNB.s:1318819: Warning: .stabs: description field '14f75' too big, try a different debug format
...

I don't see those warnings, and I don't believe I ever have ever seen them before.
Since they concern debug annotations, you can probably ignore them.

ok,

tried to opload but he can't find a leonardo on the com port. there is only one port to select so i'll try to figure out what is going on, at least it is compiling, thanks to you.

concerning the messages, should i change the AVR programmer?? or has that nothing to do....

i will let you know tomorrow, i think i'm going to count some sheep :confused:

thx again

Pantah:
concerning the messages, should i change the AVR programmer?? or has that nothing to do....

If you mean the warnings, just ignore them and see how you get on.

hi Arduarn,

does compile, with some messages ( not all the time?!) but doesn't upload.
everytime when starting to upload, the board disconnects.
at the end of the upload there is the message that there is no Leonardo found on the serial port.
But on the bottom of the screen is the message "arduino leonardo on dev/ttyACM0"

Tried holding the resetbutton while uploaiding but no good.

so yeah, that will be another topicsearch i think .

many thanks for your help concerning the u8glib solution, was a great help.

last question, could it be a bootloader problem?

thx, keep up the good work

pantah

You mention holding the rest button but, just to be sure you have read it, here is the Getting Started with the Arduino Leonardo, Leonardo ETH and Micro page.

Without corroborating evidence I wouldn't assume a faulty bootloader.

You're welcome!