calaos / calaos_base

Calaos server
https://calaos.fr
GNU General Public License v3.0
162 stars 37 forks source link

Compilation error on master #162

Closed StevenLeRoux closed 9 months ago

StevenLeRoux commented 9 months ago

Hi! I'm having a compilation error with the latest master.

1 warning generated. CXX ColorUtils.lo In file included from ColorUtils.cpp:21: ./ColorUtils.h:103:13: error: unknown type name 'uint16_t' uint16_t r, g, b; ^ ./ColorUtils.h:107:13: error: unknown type name 'uint16_t' uint16_t h, s, v; ^ ./ColorUtils.h:111:13: error: unknown type name 'uint16_t' uint16_t h, s, l; ^ ./ColorUtils.h:113:9: error: unknown type name 'uint16_t' uint16_t array[3]; ^ ./ColorUtils.h:115:5: error: unknown type name 'uint16_t' uint16_t alpha; ^ ./ColorUtils.h:114:7: warning: private field 'color' is not used [-Wunused-private-field] } color; ^ ./ColorUtils.h:115:14: warning: private field 'alpha' is not used [-Wunused-private-field] uint16_t alpha; ^ 2 warnings and 5 errors generated. make[3]: *** [Makefile:731 : ColorUtils.lo] Erreur 1

Maybe there are some work being done on master, but I'm a bit confused with tags version. What version should be used currently to build calaos server and home?

StevenLeRoux commented 9 months ago

Ok it may be due to my environment...

I've installed g++ dependency, and I've still an error, but not the same:


  CXX      ColorUtils.lo
In file included from ColorUtils.cpp:21:
ColorUtils.h:103:13: error: 'uint16_t' does not name a type
  103 |             uint16_t r, g, b;
      |             ^~~~~~~~
ColorUtils.h:25:1: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   24 | #include <iostream>
  +++ |+#include <cstdint>
   25 | 
ColorUtils.h:107:13: error: 'uint16_t' does not name a type
  107 |             uint16_t h, s, v;
      |             ^~~~~~~~
ColorUtils.h:107:13: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
ColorUtils.h:111:13: error: 'uint16_t' does not name a type
  111 |             uint16_t h, s, l;
      |             ^~~~~~~~
ColorUtils.h:111:13: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
ColorUtils.h:113:9: error: 'uint16_t' does not name a type
  113 |         uint16_t array[3];
      |         ^~~~~~~~
ColorUtils.h:113:9: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
ColorUtils.h:115:5: error: 'uint16_t' does not name a type
  115 |     uint16_t alpha;
      |     ^~~~~~~~
ColorUtils.h:115:5: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
ColorUtils.h: In member function 'int ColorValue::getAlpha() const':
ColorUtils.h:40:35: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
   40 |     int getAlpha() const { return alpha; }
      |                                   ^~~~~
      |                                   isalpha
ColorUtils.cpp: In constructor 'ColorValue::ColorValue()':
ColorUtils.cpp:33:5: error: class 'ColorValue' does not have any field named 'alpha'
   33 |     alpha(0)
      |     ^~~~~
ColorUtils.cpp:35:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
   35 |     color.rgb.r = color.rgb.g = color.rgb.b = 0;
      |               ^
ColorUtils.cpp:35:29: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
   35 |     color.rgb.r = color.rgb.g = color.rgb.b = 0;
      |                             ^
ColorUtils.cpp:35:43: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
   35 |     color.rgb.r = color.rgb.g = color.rgb.b = 0;
      |                                           ^
ColorUtils.cpp: In member function 'void ColorValue::setAlpha(int)':
ColorUtils.cpp:239:5: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
  239 |     alpha = a;
      |     ^~~~~
      |     isalpha
ColorUtils.cpp: In member function 'int ColorValue::getRed() const':
ColorUtils.cpp:245:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  245 |         return color.rgb.r;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getGreen() const':
ColorUtils.cpp:253:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  253 |         return color.rgb.g;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getBlue() const':
ColorUtils.cpp:261:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  261 |         return color.rgb.b;
      |                          ^
ColorUtils.cpp: In member function 'void ColorValue::setRed(int)':
ColorUtils.cpp:275:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  275 |         color.rgb.r = red;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setGreen(int)':
ColorUtils.cpp:289:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  289 |         color.rgb.g = green;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setBlue(int)':
ColorUtils.cpp:303:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  303 |         color.rgb.b = blue;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setRgb(int, int, int, int)':
ColorUtils.cpp:321:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  321 |     color.rgb.r = r;
      |               ^
ColorUtils.cpp:322:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  322 |     color.rgb.g = g;
      |               ^
ColorUtils.cpp:323:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  323 |     color.rgb.b = b;
      |               ^
ColorUtils.cpp: In member function 'int ColorValue::getHSVHue() const':
ColorUtils.cpp:329:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  329 |         return color.hsv.h;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getHSVSaturation() const':
ColorUtils.cpp:337:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  337 |         return color.hsv.s;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getHSVValue() const':
ColorUtils.cpp:345:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  345 |         return color.hsv.v;
      |                          ^
ColorUtils.cpp: In member function 'void ColorValue::setHSVHue(int)':
ColorUtils.cpp:359:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  359 |         color.hsv.h = h;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHSVSaturation(int)':
ColorUtils.cpp:373:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  373 |         color.hsv.s = s;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHSVValue(int)':
ColorUtils.cpp:387:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  387 |         color.hsv.v = v;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHsv(int, int, int, int)':
ColorUtils.cpp:408:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  408 |     color.hsv.h = h;
      |               ^
ColorUtils.cpp:409:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  409 |     color.hsv.s = s;
      |               ^
ColorUtils.cpp:410:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  410 |     color.hsv.v = v;
      |               ^
ColorUtils.cpp: In member function 'int ColorValue::getHSLHue() const':
ColorUtils.cpp:416:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  416 |         return color.hsl.h;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getHSLSaturation() const':
ColorUtils.cpp:424:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  424 |         return color.hsl.s;
      |                          ^
ColorUtils.cpp: In member function 'int ColorValue::getHSLLightness() const':
ColorUtils.cpp:432:26: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  432 |         return color.hsl.l;
      |                          ^
ColorUtils.cpp: In member function 'void ColorValue::setHSLHue(int)':
ColorUtils.cpp:446:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  446 |         color.hsl.h = h;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHSLSaturation(int)':
ColorUtils.cpp:460:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  460 |         color.hsl.s = s;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHSLLightness(int)':
ColorUtils.cpp:474:19: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  474 |         color.hsl.l = l;
      |                   ^
ColorUtils.cpp: In member function 'void ColorValue::setHsl(int, int, int, int)':
ColorUtils.cpp:495:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  495 |     color.hsl.h = h;
      |               ^
ColorUtils.cpp:496:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  496 |     color.hsl.s = s;
      |               ^
ColorUtils.cpp:497:15: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  497 |     color.hsl.l = l;
      |               ^
ColorUtils.cpp: In member function 'ColorValue ColorValue::toRgb() const':
ColorUtils.cpp:529:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  529 |         double h = double(color.hsv.h);
      |                                     ^
ColorUtils.cpp:530:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  530 |         double s = double(color.hsv.s) / 100.;
      |                                     ^
ColorUtils.cpp:531:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  531 |         double v = double(color.hsv.v) / 100.;
      |                                     ^
ColorUtils.cpp:537:40: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  537 |             int vv = (double(color.hsv.v) * 255. / 100.);
      |                                        ^
ColorUtils.cpp:594:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  594 |         float L = ((float)color.hsl.l)/100;
      |                                     ^
ColorUtils.cpp:595:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  595 |         float S = ((float)color.hsl.s)/100;
      |                                     ^
ColorUtils.cpp:596:37: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  596 |         float H = ((float)color.hsl.h)/360;
      |                                     ^
ColorUtils.cpp:598:22: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  598 |         if(color.hsl.s == 0)
      |                      ^
ColorUtils.cpp:600:27: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  600 |             r = color.hsl.l;
      |                           ^
ColorUtils.cpp:601:27: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  601 |             g = color.hsl.l;
      |                           ^
ColorUtils.cpp:602:27: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  602 |             b = color.hsl.l;
      |                           ^
ColorUtils.cpp: In member function 'ColorValue ColorValue::toHsv() const':
ColorUtils.cpp:674:33: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  674 |     double r = double(color.rgb.r * 100. / 255.);
      |                                 ^
ColorUtils.cpp:675:33: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  675 |     double g = double(color.rgb.g * 100. / 255.);
      |                                 ^
ColorUtils.cpp:676:33: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  676 |     double b = double(color.rgb.b * 100. / 255.);
      |                                 ^
ColorUtils.cpp: In member function 'ColorValue ColorValue::toHsl() const':
ColorUtils.cpp:730:41: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  730 |     float r_percent = ((float)color.rgb.r) / 255;
      |                                         ^
ColorUtils.cpp:731:41: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  731 |     float g_percent = ((float)color.rgb.g) / 255;
      |                                         ^
ColorUtils.cpp:732:41: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  732 |     float b_percent = ((float)color.rgb.b) / 255;
      |                                         ^
ColorUtils.cpp:786:17: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  786 |     c.color.hsl.s = (unsigned int)(S*100);
      |                 ^
ColorUtils.cpp:787:17: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  787 |     c.color.hsl.l = (unsigned int)(L*100);
      |                 ^
ColorUtils.cpp:791:17: error: 'struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  791 |     c.color.hsl.h = (unsigned int)H;
      |                 ^
ColorUtils.cpp: In member function 'bool ColorValue::operator==(const ColorValue&) const':
ColorUtils.cpp:823:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  823 |             return color.hsl.h == c.color.hsl.h &&
      |                              ^
ColorUtils.cpp:823:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  823 |             return color.hsl.h == c.color.hsl.h &&
      |                                               ^
ColorUtils.cpp:824:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  824 |                    color.hsl.s == c.color.hsl.s &&
      |                              ^
ColorUtils.cpp:824:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  824 |                    color.hsl.s == c.color.hsl.s &&
      |                                               ^
ColorUtils.cpp:825:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  825 |                    color.hsl.l == c.color.hsl.l;
      |                              ^
ColorUtils.cpp:825:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'l'
  825 |                    color.hsl.l == c.color.hsl.l;
      |                                               ^
ColorUtils.cpp:829:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  829 |             return color.hsv.h == c.color.hsv.h &&
      |                              ^
ColorUtils.cpp:829:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'h'
  829 |             return color.hsv.h == c.color.hsv.h &&
      |                                               ^
ColorUtils.cpp:830:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  830 |                    color.hsv.s == c.color.hsv.s &&
      |                              ^
ColorUtils.cpp:830:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 's'
  830 |                    color.hsv.s == c.color.hsv.s &&
      |                                               ^
ColorUtils.cpp:831:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  831 |                    color.hsv.v == c.color.hsv.v;
      |                              ^
ColorUtils.cpp:831:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'v'
  831 |                    color.hsv.v == c.color.hsv.v;
      |                                               ^
ColorUtils.cpp:835:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  835 |             return color.rgb.r == c.color.rgb.r &&
      |                              ^
ColorUtils.cpp:835:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'r'
  835 |             return color.rgb.r == c.color.rgb.r &&
      |                                               ^
ColorUtils.cpp:836:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  836 |                    color.rgb.g == c.color.rgb.g &&
      |                              ^
ColorUtils.cpp:836:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'g'
  836 |                    color.rgb.g == c.color.rgb.g &&
      |                                               ^
ColorUtils.cpp:837:30: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  837 |                    color.rgb.b == c.color.rgb.b;
      |                              ^
ColorUtils.cpp:837:47: error: 'const struct ColorValue::<unnamed union>::<unnamed>' has no member named 'b'
  837 |                    color.rgb.b == c.color.rgb.b;
      |                                               ^
make[3]: *** [Makefile:731 : ColorUtils.lo] Erreur 1
raoulh commented 9 months ago

Using master it should build fine. What is you build env? (distro, compiler, ...)

StevenLeRoux commented 9 months ago

Hi Raoul, it's a fresh debian trixie from yesterday installed on a Chuwi Larkbox X (powered by Intel n100). It has two ethernet ports which will allow me to separate and isolate communication with Wago PLC.

GCC/G++-13 I followed https://calaos.fr/wiki/fr/compilation except libsigc++ and libuv came as packages directly. Would you recommand any specific version? I see some effort with devcontainers, maybe the way to go?

(For the context, I already have a Calaos OS installed on another setup, but I want to build Calaos to contribute stuff)

raoulh commented 9 months ago

Ok. calaos_base builds on debian bookworm as latest ArchLinux. Maybe there is an issue with Debian testing?...

You could try to add the include requested in ColorUtils.h : #include <cstdint> That should do no harm.

PS: https://calaos.fr/wiki/fr/compilation is not up to date 😓

raoulh commented 9 months ago

FYI: this is how we build for Debian 12 in our Dockerfile:

https://github.com/calaos/calaos_base/blob/master/Dockerfile

StevenLeRoux commented 9 months ago

Adding #include <cstdint> did it! Thanks :)

Now I'm setting up a dev env, so I will test with the devcontainers next week. Thanks again for your help, closing.