raylib icon indicating copy to clipboard operation
raylib copied to clipboard

[rcore] Building with SDL fails without rtext

Open M374LX opened this issue 6 months ago • 1 comments

The rtext module is supposed to be optional. However, when building a program for the desktop platform using the SDL backend, it fails with the following message due to rcore_desktop_sdl.c requiring the GetCodepointNext() function:

/usr/bin/ld: ../src/libraylib.a(rcore.o): in function `PollInputEvents':
rcore.c:(.text+0x2d212): undefined reference to `GetCodepointNext'
collect2: error: ld returned 1 exit status

It fails when building a program, but not when building raylib itself as a static library.

Steps to reproduce

  1. Edit config.h do disable the rtext module, like so: //#define SUPPORT_MODULE_RTEXT 1
  2. Build raylib like so: make PLATFORM=PLATFORM_DESKTOP_SDL SDL_INCLUDE_PATH=/usr/include/SDL2/ SDL_LIBRARY_PATH=/usr/lib
  3. Finally, build a program using raylib: gcc test.c -lraylib -lSDL2

M374LX avatar May 29 '25 00:05 M374LX

@M374LX Good catch! It should be reviewed!

raysan5 avatar May 29 '25 10:05 raysan5

Would it make sense to pull out the unicode related functions out of the text module and put them in a separate module (maybe inside util), since it is useful outside just text rendering?

by unicode related function I specifically mean the 3 functions GetCodepoint, GetCodepointNext, GetCodepointPrevious. Since they are not dependent on any other part of the rtext module could we enable those functions even if the rtext module is disabled?

NimComPoo-04 avatar Jun 24 '25 10:06 NimComPoo-04