BlazingRenderer / BRender

Modernized fork of BRender
MIT License
49 stars 5 forks source link

Issues when building on Linux (Debian) #37

Closed MetalMaxMX closed 3 months ago

MetalMaxMX commented 3 months ago

Hello!

I am trying to compile BRender on my Linux box, which is a Debian 11 machine that runs under x86_64. Things seemed to do well up until I reached this part of the code:

[ 83%] Building C object examples/brdemo/CMakeFiles/brdemo.dir/brdemo.c.o
/home/mega/brender/BRender/examples/brdemo/brdemo.c: In function ‘BrDemoRun’:
/home/mega/brender/BRender/examples/brdemo/brdemo.c:185:18: warning: implicit declaration of function ‘SDL_GetTicks64’; did you mean ‘SDL_GetTicks’? [-Wimplicit-function-declaration]
  185 |     ticks_last = SDL_GetTicks64();
      |                  ^~~~~~~~~~~~~~
      |                  SDL_GetTicks
[ 83%] Linking CXX static library libbrdemo.a
[ 83%] Built target brdemo
[ 83%] Building C object examples/brintro/CMakeFiles/brintro.dir/main.c.o
[ 83%] Building C object examples/brintro/CMakeFiles/brintro.dir/intro.c.o
[ 84%] Linking CXX executable brintro
/usr/local/bin/ld: ../brdemo/libbrdemo.a(brdemo.c.o): in function `BrDemoRun':
brdemo.c:(.text+0x542): undefined reference to `SDL_GetTicks64'
/usr/local/bin/ld: brdemo.c:(.text+0x552): undefined reference to `SDL_GetTicks64'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/brintro/CMakeFiles/brintro.dir/build.make:121: examples/brintro/brintro] Error 1
make[1]: *** [CMakeFiles/Makefile2:1637: examples/brintro/CMakeFiles/brintro.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Not sure exactly how to proceed from here.

vs49688 commented 3 months ago

Hi!

SDL_GetTicks64() was introduced in SDL 2.0.18 (see https://wiki.libsdl.org/SDL2/SDL_GetTicks64). Looking at Debian 11's packages, it only has SDL 2.0.14 (see https://packages.debian.org/bullseye/libsdl2-2.0-0).

As a hacky workaround, you can replace it with SDL_GetTicks() as they're both in milliseconds, but I'd strongly recommend upgrading to a later SDL, if you can.

Note that this should only effect the example applications - if you don't need them you can switch them off with -DBRENDER_BUILD_EXAMPLES=OFF

MetalMaxMX commented 3 months ago

Hello!

Thanks! I was able to get this to build by setting that flag on the cmake command indeed! I can also manually upgrade SDL on my end though so maybe I can try that just to see how the examples look like.

I'll set this issue as closed! Once again, thanks!