KallistiOS / kos-ports

Ported library collection for KallistiOS
Other
52 stars 33 forks source link

GLdc (new `libGL`) can be compiled only under GCC 13.x #36

Closed sizious closed 8 months ago

sizious commented 8 months ago

It's impossible to compile GLdc (new libGL) under GCC 9.x branch but only with GCC 13.x. I think it isn't big deal but in that case maybe it should be documented.

Here is the full log on GCC 9.5.0:

Installing the KallistiOS Port...
libGL is not currently installed.
Finished processing dependencies for libGL.
Fetching libGL from https://gitlab.com/simulant/GLdc.git ...
Cloning into 'libGL-1.0.0'...
Copying SCM checkout of libGL ...
Copying KOS files...
make[1]: Entering directory `/usr/opt/toolchains/dc/kos-ports/libGL/build/libGL-1.0.0'
kos-cc  -c containers/aligned_vector.c -o containers/aligned_vector.o
kos-cc  -c containers/named_array.c -o containers/named_array.o
kos-cc  -c containers/stack.c -o containers/stack.o
kos-cc  -c GL/draw.c -o GL/draw.o
GL/draw.c:803: warning: "likely" redefined
  803 | #define likely(x)      __builtin_expect(!!(x), 1)
      | 
In file included from /opt/toolchains/dc/kos/include/sys/_types.h:12,
                 from c:\dreamsdk\msys\1.0\opt\toolchains\dc\sh-elf\sh-elf\include\sys\reent.h:15,
                 from c:\dreamsdk\msys\1.0\opt\toolchains\dc\sh-elf\sh-elf\include\stdio.h:60,
                 from GL/draw.c:1:
/opt/toolchains/dc/kos/include/kos/cdefs.h:81: note: this is the location of the previous definition
   81 | #define likely(exp)   __builtin_expect(!!(exp), 1)
      | 
kos-cc  -c GL/error.c -o GL/error.o
kos-cc  -c GL/flush.c -o GL/flush.o
kos-cc  -c GL/fog.c -o GL/fog.o
kos-cc  -c GL/framebuffer.c -o GL/framebuffer.o
kos-cc  -c GL/glu.c -o GL/glu.o
kos-cc  -c GL/immediate.c -o GL/immediate.o
GL/immediate.c: In function 'glVertex3f':
GL/immediate.c:174:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  174 |     *(dest++) = *((uint32_t*) &x);
      |                  ~^~~~~~~~~~~~~~~
GL/immediate.c:175:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  175 |     *(dest++) = *((uint32_t*) &y);
      |                  ~^~~~~~~~~~~~~~~
GL/immediate.c:176:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  176 |     *(dest++) = *((uint32_t*) &z);
      |                  ~^~~~~~~~~~~~~~~
GL/immediate.c:177:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  177 |     *(dest++) = *((uint32_t*) &UV_COORD[0]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:178:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  178 |     *(dest++) = *((uint32_t*) &UV_COORD[1]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:179:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  179 |     *(dest++) = *((uint32_t*) &ST_COORD[0]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:180:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  180 |     *(dest++) = *((uint32_t*) &ST_COORD[1]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:182:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  182 |     *(dest++) = *((uint32_t*) &NORMAL[0]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:183:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  183 |     *(dest++) = *((uint32_t*) &NORMAL[1]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~
GL/immediate.c:184:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  184 |     *(dest++) = *((uint32_t*) &NORMAL[2]);
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~
kos-cc  -c GL/lighting.c -o GL/lighting.o
kos-cc  -c GL/matrix.c -o GL/matrix.o
kos-cc  -c GL/state.c -o GL/state.o
GL/state.c:55:14: warning: missing braces around initializer [-Wmissing-braces]
   55 | } GPUState = {
      |              ^
......
   83 |     .lights = {0},
      |                -
      |                {{0}}
GL/state.c:55:14: warning: missing braces around initializer [-Wmissing-braces]
   55 | } GPUState = {
      |              ^
......
   83 |     .lights = {0},
      |                -
      |                {{0}}
   84 |     .enabled_light_count = 0,
   85 |     .material = {0},
      |                  {}
GL/state.c:55:14: warning: missing braces around initializer [-Wmissing-braces]
   55 | } GPUState = {
      |              ^
......
   83 |     .lights = {0},
      |                -
      |                {{0}}
   84 |     .enabled_light_count = 0,
   85 |     .material = {0},
      |                  {}
kos-cc  -c GL/texture.c -o GL/texture.o
GL/texture.c: In function 'update_data_pointer':
GL/texture.c:2044:55: error: parameter name omitted
 2044 | static void update_data_pointer(void* src, void* dst, void*) {
      |                                                       ^~~~~
make[1]: *** [GL/texture.o] Error 1
make[1]: Leaving directory `/usr/opt/toolchains/dc/kos-ports/libGL/build/libGL-1.0.0'
make: *** [build-stamp] Error 2
Cleaning up build directories ...
Cleaning up dist files ...
*** Operation done with errors.

Probably the relevant part is:

GL/texture.c: In function 'update_data_pointer':
GL/texture.c:2044:55: error: parameter name omitted
 2044 | static void update_data_pointer(void* src, void* dst, void*) {
      |                                                       ^~~~~
make[1]: *** [GL/texture.o] Error 1
GravisZro commented 8 months ago

There is the option of patching the upstream version to ensure that it will compile on older versions of GCC. It doesn't look like it would take much.

ljsebald commented 8 months ago

I’ve reported some issues on the GLdc bug tracker related to this already.

darcagn commented 8 months ago

I submitted a PR upstream for this based on @ljsebald's recommendation.

darcagn commented 8 months ago

The upstream PR was merged so I'm closing this issue. :smile: