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

Server-only build with -fsanitize=undefined fails #5116

Closed
kimden opened this issue Jun 25, 2024 · 0 comments
Closed

Server-only build with -fsanitize=undefined fails #5116

kimden opened this issue Jun 25, 2024 · 0 comments

Comments

@kimden
Copy link
Contributor

kimden commented Jun 25, 2024

Description

Attempting to compile STK with -fsanitize=undefined (more precisely, cmake command line was cmake .. -DCMAKE_BUILD_TYPE=Debug -DSERVER_ONLY=ON -DUSE_SQLITE3=OFF -DNO_SHADERC=OFF -DUSE_USAN=ON, where I defined USAN analogously to other sanitizers) fails like this:

[ 43%] Linking CXX executable bin/supertuxkart
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/karts/controller/local_player_controller.cpp.o:(.data.rel+0x2258): undefined reference to `typeinfo for ParticleEmitter'
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/karts/kart.cpp.o:(.data.rel+0x1898): undefined reference to `typeinfo for ParticleEmitter'
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/karts/kart.cpp.o:(.data.rel+0x6a98): undefined reference to `typeinfo for ParticleEmitter'
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/karts/kart_gfx.cpp.o:(.data.rel+0x558): undefined reference to `typeinfo for ParticleEmitter'
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/karts/kart_gfx.cpp.o:(.data.rel+0x598): undefined reference to `typeinfo for ParticleEmitter'
/usr/bin/ld: CMakeFiles/supertuxkart.dir/src/tracks/track_object_presentation.cpp.o:(.data.rel+0x198): more undefined references to `typeinfo for ParticleEmitter' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/supertuxkart.dir/build.make:7101: bin/supertuxkart] Error 1
make[1]: *** [CMakeFiles/Makefile2:182: CMakeFiles/supertuxkart.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

It doesn't fail with -DSERVER_ONLY=OFF. From what I understand, the log above mentions almost all files where ParticleEmitter is mentioned, in some cases it's mentioned only within #ifndef SERVER_ONLY block, and its whole cpp file is inside #ifndef SERVER_ONLY too (but not the header file). However, I'm not familiar how exactly it works, and got confused trying to fix it myself.

Configuration

STK release version: latest git 84dff44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants