OoliteProject / oolite

The main Oolite repository.
https://www.oolite.space
543 stars 70 forks source link

Git master not compiling on Arch Linux with GCC 14 #484

Closed evertvorster closed 3 weeks ago

evertvorster commented 3 weeks ago

Hi there!

I am currently trying to make a package in the Arch Linux AUR for oolite, called oolite-git. This package checks out the latest git master source, and compiles & installs it. This sort of package is great for people who would like to play test the latest version of the game and to provide feedback to the developers of any bugs encountered before a stable version is released.

At the moment, this package does not build with GCC 14. I'll try again with GCC 13, but for completeness I would like to report the build error here.

This is the bit where it goes off the rails:

 Compiling file src/Core/OXPVerifier/OOCheckEquipmentPListVerifierStage.m ...
src/Core/OOPolygonSprite.m: In function ‘-[OOPolygonSprite loadPolygons:outlineWidth:]’:
src/Core/OOPolygonSprite.m:286:58: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
  286 |         gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, TessBeginCallback);
      |                                                          ^~~~~~~~~~~~~~~~~
      |                                                          |
      |                                                          void (*)(GLenum,  void *) {aka void (*)(unsigned int,  void *)}
In file included from /usr/include/SDL/SDL_opengl.h:51,
                 from src/Core/OOOpenGLOnly.h:58,
                 from src/Core/OOOpenGL.h:31,
                 from src/Core/OOPolygonSprite.h:33,
                 from src/Core/OOPolygonSprite.m:42:
/usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(GLenum,  void *)’ {aka ‘void (*)(unsigned int,  void *)’}

About my system:

Operating System: Arch Linux 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.9.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900HX
Memory: 62.5 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: TUXEDO
Product Name: PD5x_7xSNC_SND_SNE
AnotherCommander commented 3 weeks ago

This has to be related to one of the changes in PR #426. Unfortunately _GLUfuncptr is not defined in the Windows headers and just doing the obvious casting as described in the PR would just break the Windows build.

But we could maybe try something else. Please apply this patch and let us know how it goes for you. Does it compile OK? It does for me on Windows, so if this works also on Linux we should be in really good shape.

diff --git a/src/Core/OOPolygonSprite.m b/src/Core/OOPolygonSprite.m
index 5ada443e..216d67f1 100644
--- a/src/Core/OOPolygonSprite.m
+++ b/src/Core/OOPolygonSprite.m
@@ -115,6 +115,9 @@ static void APIENTRY TessEndCallback(void *polygonData);

 static void APIENTRY ErrorCallback(GLenum error, void *polygonData);

+// this is needed to maintain compatibility with GCC 14+
+typedef GLvoid (*TessFuncPtr)();
+

 @implementation OOPolygonSprite

@@ -283,11 +286,11 @@ static void APIENTRY ErrorCallback(GLenum error, void *polygonData);
    dataArray = DataArrayToPoints(&polygonData, dataArray);

    /*** Tesselate polygon fill ***/
-   gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, TessBeginCallback);
-   gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, TessVertexCallback);
-   gluTessCallback(tesselator, GLU_TESS_END_DATA, TessEndCallback);
-   gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, ErrorCallback);
-   gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, TessCombineCallback);
+   gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, (TessFuncPtr)TessBeginCallback);
+   gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, (TessFuncPtr)TessVertexCallback);
+   gluTessCallback(tesselator, GLU_TESS_END_DATA, (TessFuncPtr)TessEndCallback);
+   gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, (TessFuncPtr)ErrorCallback);
+   gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, (TessFuncPtr)TessCombineCallback);

    gluTessBeginPolygon(tesselator, &polygonData);
    SVGDumpBeginGroup(&polygonData, @"Fill");
@@ -351,11 +354,11 @@ static void APIENTRY ErrorCallback(GLenum error, void *polygonData);
    polygonData.generatingOutline = YES;
 #endif

-   gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, TessBeginCallback);
-   gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, TessVertexCallback);
-   gluTessCallback(tesselator, GLU_TESS_END_DATA, TessEndCallback);
-   gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, ErrorCallback);
-   gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, TessCombineCallback);
+   gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, (TessFuncPtr)TessBeginCallback);
+   gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, (TessFuncPtr)TessVertexCallback);
+   gluTessCallback(tesselator, GLU_TESS_END_DATA, (TessFuncPtr)TessEndCallback);
+   gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, (TessFuncPtr)ErrorCallback);
+   gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, (TessFuncPtr)TessCombineCallback);
    gluTessProperty(tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);

    gluTessBeginPolygon(tesselator, &polygonData);
evertvorster commented 3 weeks ago

Hi there!

The patch works in as far as it allows me to build with GCC14. Thanks very much for that. Unfortunately the installed game does not run.

I think the problem starts fairly early on, at the head of the Latest log file I see the following error:

12:22:34.142 [dataCache.found]: Found data cache.
  12:22:34.142 [dataCache.rebuild]: Data cache version (1.90) does not match Oolite version ((null)), rebuilding cache.
12:22:34.142 [oxz.manager.debug]: Initialised with (null)
12:22:34.142 [searchPaths.debug]: (AddOns, "/home/evert/.Oolite/AddOns")

How do you tell the OXP manager which version the game is at?

AnotherCommander commented 3 weeks ago

Looks to me this was improperly packaged and it cannot locate resource files needed to determine the game version. But I cannot tell you exactly what's wrong, Linux is not my field of expertise. Sorry!

Good to know at least that the patch works. Will be committing the fix asap.

evertvorster commented 3 weeks ago

I agree that it is improperly packaged, because when I run oolite where I built it, it does start up. I'll go poke around the package for the tarball release build to see what is different.

Thanks for the quick response.