Open brccabral opened 5 months ago
As I run Fedora, I had to try this using a docker container:
And indeed, in ubuntu 24.04 and raylib 4.5.0 static (built from github) I get this error as well:
root@ubuntu24.04:~/tmx/examples/raylib/build# make
[ 50%] Building C object CMakeFiles/raylib_example.dir/raylib.c.o
[100%] Linking C executable raylib_example
/usr/bin/cc CMakeFiles/raylib_example.dir/raylib.c.o -o raylib_example -Wl,-rpath,/usr/local/lib /usr/local/lib/libtmx.a /usr/local/lib/libraylib.a /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libxml2.so -L/usr/local/lib -lraylib
/usr/bin/ld: /usr/local/lib/libraylib.a(rcore.c.o): undefined reference to symbol 'floorf@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
It seems raylib does not properly export its dependencies in cmake configs and pkg-config when statically linked.
Raylib does include math.h
in header src/rlgl.h
, so this is a direct dependency of Raylib.
I don't have this issue on fedora 39 (where raylib is provided as a shared object):
baylej@fedora39 ~/Projects/tmx/examples/raylib/build $ make
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/baylej/Projects/tmx/examples/raylib/build
[ 50%] Building C object CMakeFiles/raylib_example.dir/raylib.c.o
[100%] Linking C executable raylib_example
/usr/bin/cc -g CMakeFiles/raylib_example.dir/raylib.c.o -o raylib_example /home/baylej/.local/lib64/libtmx.a /usr/lib64/libraylib.so /usr/lib64/libX11.so /usr/lib64/libz.so /usr/lib64/libxml2.so -L/usr/lib64 -lraylib
[100%] Built target raylib_example
So, on ubuntu24 I tried to reinstall raylib as a shared object And then the raylib_example does build:
root@ubuntu24.04:~/tmx/examples/raylib/build# make
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /root/tmx/examples/raylib/build
[ 50%] Building C object CMakeFiles/raylib_example.dir/raylib.c.o
[100%] Linking C executable raylib_example
/usr/bin/cc CMakeFiles/raylib_example.dir/raylib.c.o -o raylib_example -Wl,-rpath,/usr/local/lib /usr/local/lib/libtmx.a /usr/local/lib/libraylib.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libxml2.so -L/usr/local/lib -lraylib
[100%] Built target raylib_example
To my understanding, the issue lies in the export files of raylib, not in the build configuration of the raylib example. But I may be wrong! so maybe the maintainer of Raylib (@raysan5) could share his input on this issue (thanks).
To compile the example on Ubuntu 24.04 I had to add lib
m