Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore] Raylib fails to build on gcc 14+ #4679

Closed
kwargstar opened this issue Jan 10, 2025 · 3 comments
Closed

[rcore] Raylib fails to build on gcc 14+ #4679

kwargstar opened this issue Jan 10, 2025 · 3 comments

Comments

@kwargstar
Copy link

Hello there,

I got into raylib today as I'm learning C for fun. However, building raylib from source on GNU/Linux with gcc 14+ produces an error.

My system:

  • Linux 6.12 (Fedora Workstation)
  • gcc 14.2.1
  • raylib commit 08b089f

After cloning the repo, I navigate to raylib/src and run the following:

$ make clean
$ make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED
gcc -c rcore.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -fPIC -O1 -Werror=implicit-function-declaration -fPIC -DBUILD_LIBTYPE_SHARED -fvisibility=hidden -D_GLFW_X11  -I.  -Iexternal/glfw/include
rcore.c: In function ‘IsFileExtension’:
rcore.c:1934:34: error: initialization of ‘const char **’ from incompatible pointer type ‘char **’ [-Wincompatible-pointer-types]
 1934 |         const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
      |                                  ^~~~~~~~~
make: *** [Makefile:730: rcore.o] Error 1

It seems the compiler is throwing an error here, but I'm not proficient enough to diagnose it further.

Thanks!

@kwargstar
Copy link
Author

kwargstar commented Jan 10, 2025

Building appears to work using older gcc versions, throwing a warning instead of an error (in my case, I had 8.3 lying around):

$ make -e
gcc -c rcore.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -fPIC -O1 -Werror=implicit-function-declaration -D_GLFW_X11  -I.  -Iexternal/glfw/include
rcore.c: In function 'IsFileExtension':
rcore.c:1934:34: warning: initialization of 'const char **' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
         const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
                                  ^~~~~~~~~

Thanks to antediluvianapocalypse on the discord for confirming this behavior with gcc 12 and Clang<16. It seems gcc 14+ and Clang 16+ reject this behavior pertaining to the const char ** vs char **.

@kwargstar kwargstar changed the title [module] Raylib fails to build on gcc 14+ [rcore] Raylib fails to build on gcc 14+ Jan 10, 2025
@JeffM2501
Copy link
Contributor

Fixed in PR #4680

@raysan5
Copy link
Owner

raysan5 commented Jan 10, 2025

@kwargstar thanks for reporting, fixed.

It seems GCC 14+ really messed things up with that error... :(

@raysan5 raysan5 closed this as completed Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants