ptitSeb / Serious-Engine

A port to the OpenPandora (and working fine on plain Linux) of the open source version of a game engine developed by Croteam for the classic Serious Sam games. Status: Working (for both FE and SE).
https://pyra-handheld.com/boards/threads/serious-sam-first-encounter.77225/
GNU General Public License v2.0
74 stars 22 forks source link

undefined symbol "_nss_cache_cycle_prevention_function" on FreeBSD 13 #32

Open PaddyMac opened 3 years ago

PaddyMac commented 3 years ago

It's been a while since I've used your source port, but I figured I'd break it out again. I've successfully built and run it on FreeBSD before, but maybe something has changed in the latest FreeBSD 13-RELEASE. I'm currently trying TFE, and I can start the program with no trouble. But when I choose the option to start a new game and choose my difficulty level, I get the following error at the top of the screen:

network is off CUnixDynamicLoader error: Undefine symbol "_nss_cache_cycle_prevention_function" Cannot load DLL file '/usr/home/patrick/Serious-Engine/Bin/libEntities.so': Undefined symbol "_nss_cache_cycle_prevention_function"

If I try to start a new game a second time, the program crashes with a segfault. Though now that I look a little closer, the undefined reference error might be a red herring. Yes it's an error, but it might not be causing the segfault. I ran the game through gdb, and this is what caused the segfault:

Thread 1 received signal SIGSEGV, Segmentation fault. CFogMarker::GetFog (this=0x0, fpFog=...) at /usr/home/patrick/Serious-Engine/Sources/Entities/FogMarker.es:64 64 fpFog.fp_vFogDir(1) = m(1,2);

brynet commented 3 years ago

I'm eventually hitting the same SIGSEGV on OpenBSD 6.9-current as well, compiled with clang 10.0.1.

It appears that clang is optimizing out some very important NULL pointer checks in the entity class files. I'm not familiar enough with C++ to figure out why this is happening, but it certainly is alarming. I was able to solve this with the -fno-delete-null-pointer-checks flag, but this should be looked at.

+ add_compile_options(-fno-delete-null-pointer-checks)