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

Thread 1 "Primary thread" received signal SIGILL, Illegal instruction. on FreeBSD 14.2 #1760

Open
Martinfx opened this issue Jan 3, 2025 · 8 comments
Labels
*BSD FreeBSD and other *BSDs Bug The issue in the run-time.

Comments

@Martinfx
Copy link
Contributor

Martinfx commented Jan 3, 2025

Describe the bug
Hi,
i compiled your source code and run game. The issue is illegal instruction

To Reproduce
Steps to reproduce the behavior:

  1. Go to Menu
  2. Load first save
  3. go in the map
  4. crash

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots, videos
If applicable, add screenshots to help explain your problem.

BugTrap error report

Thread 1 "Primary thread" received signal SIGILL, Illegal instruction.
Privileged opcode.
0x00000008ca50672d in ?? () from /usr/local/lib/xrRender_GL.so
(gdb) bt
#0  0x00000008ca50672d in ?? () from /usr/local/lib/xrRender_GL.so
#1  0x00000008ca50633f in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#2  0x00000008ca5063ef in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#3  0x00000008ca5063ef in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#4  0x00000008ca503ec0 in R_dsgraph_structure::render_graph(unsigned int) () from /usr/local/lib/xrRender_GL.so
#5  0x00000008ca5806f2 in CRender::Render() () from /usr/local/lib/xrRender_GL.so
#6  0x00000008025b99b2 in CLevel::OnRender() () from /usr/local/lib/xrGame.so
#7  0x00000008037c73de in MessageRegistry<pureRender>::Process() () from /usr/local/lib/xrEngine.so
#8  0x00000008037c5d0a in CRenderDevice::DoRender() () from /usr/local/lib/xrEngine.so
#9  0x00000008037c5fb5 in CRenderDevice::ProcessFrame() () from /usr/local/lib/xrEngine.so
#10 0x00000008037bb8d8 in CApplication::Run() () from /usr/local/lib/xrEngine.so
#11 0x000000000020228e in ?? ()
#12 0x0000000803c09c3a in __libc_start1 (argc=1, argv=0x7fffffffd928, env=0x7fffffffd938, cleanup=<optimized out>, mainX=0x202180) at /usr/src/lib/libc/csu/libc_start1.c:157
#13 0x0000000000202080 in ?? ()
(gdb) exit
A debugging session is active.

	Inferior 1 [process 5753] will be killed.


Desktop (please complete the following information):

  • OS: FreeBSD 14.2-RELEASE
  • OpenXRay build version : GH_TAGNAME= 34ef356

Additional context

FATAL ERROR
 
[error] Expression    : <no expression>
[error] Function      : handler_base
[error] File          : /usr/home/maxfx/Documents/FreeBSD-Ports/xray-16/work/xray-16-34ef356f76cb0ed1814d8b3027f1ff91b7f2e30b/src/xrCore/xrDebug.cpp
[error] Line          : 860
[error] Description   : illegal instruction
 

stack trace:

xrDebug::GatherInfo(char*, unsigned long, ErrorLocation const&, char const*, char const*, char const*, char const*)
xrDebug::Fail(bool&, ErrorLocation const&, char const*, char const*, char const*, char const*)
xrDebug::Finalize()
operator->
operator->
0x8202462d3 <???> at ???
 
FATAL ERROR
 
[error] Expression    : <no expression>
[error] Function      : handler_base
[error] File          : /usr/home/maxfx/Documents/FreeBSD-Ports/xray-16/work/xray-16-34ef356f76cb0ed1814d8b3027f1ff91b7f2e30b/src/xrCore/xrDebug.cpp
[error] Line          : 860
[error] Description   : illegal instruction
 

stack trace:

xrDebug::GatherInfo(char*, unsigned long, ErrorLocation const&, char const*, char const*, char const*, char const*)
xrDebug::Fail(bool&, ErrorLocation const&, char const*, char const*, char const*, char const*)
xrDebug::Finalize()
operator->
operator->
0x8202462d3 <???> at ???
fish: Job 2, 'xr_3da' has stopped
@Martinfx Martinfx added the Bug The issue in the run-time. label Jan 3, 2025
@Xottab-DUTY
Copy link
Member

I believe this shouldn't be related to the project code, but to compiler options.

@Martinfx
Copy link
Contributor Author

Martinfx commented Jan 3, 2025

I believe this shouldn't be related to the project code, but to compiler options.

which options ?

@Xottab-DUTY
Copy link
Member

I believe this shouldn't be related to the project code, but to compiler options.

which options ?

Those that enable enhanced instruction sets like AVX, AVX2, AVX512.
Maybe, the engine was compiled with some of these, but your CPU doesn't support it?

@Martinfx
Copy link
Contributor Author

Martinfx commented Jan 4, 2025

I believe this shouldn't be related to the project code, but to compiler options.

which options ?

Those that enable enhanced instruction sets like AVX, AVX2, AVX512. Maybe, the engine was compiled with some of these, but your CPU doesn't support it?

CPU: AMD Ryzen 5 1600 Six-Core Processor             (3200.24-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x800f11  Family=0x17  Model=0x1  Stepping=1
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x7ed8320b<SSE3,PCLMULQDQ,MON,SSSE3,FMA,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x35c233ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,SKINIT,WDT,TCE,Topology,PCXC,PNXC,DBE,PL2I,MWAITX>
  Structured Extended Features=0x209c01a9<FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  AMD Extended Feature Extensions ID EBX=0x1007<CLZERO,IRPerf,XSaveErPtr,IBPB>
  SVM: NP,NRIP,VClean,AFlush,DAssist,NAsids=32768
  TSC: P-state invariant, performance statistics

@Xottab-DUTY Xottab-DUTY moved this to To do in Roadmap Jan 14, 2025
@eagleivg
Copy link
Contributor

What combilator was used for the build? I've seen this behaviour in clang, try rebuilding gcc (or vice versa, what the hell)
Also try rebuilding with the -march=native flag, maybe it will eliminate generation of unsupported instructions.

@Martinfx
Copy link
Contributor Author

What combilator was used for the build? I've seen this behaviour in clang, try rebuilding gcc (or vice versa, what the hell) Also try rebuilding with the -march=native flag, maybe it will eliminate generation of unsupported instructions.

FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
Target: x86_64-unknown-freebsd14.2
Thread model: posix
InstalledDir: /usr/bin

@Martinfx
Copy link
Contributor Author

Thread 1 "Primary thread" received signal SIGILL, Illegal instruction.
Privileged opcode.
0x00000008ca5090bd in ?? () from /usr/local/lib/xrRender_GL.so
(gdb) bt
#0  0x00000008ca5090bd in ?? () from /usr/local/lib/xrRender_GL.so
#1  0x00000008ca508ccf in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#2  0x00000008ca508d7f in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#3  0x00000008ca508d7f in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, false>(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**, bool (*&)(xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&, xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>* const&), std::__1::iterator_traits<xr_fixed_map_node<SPass*, R_dsgraph::mapNormalItems>**>::difference_type, bool) () from /usr/local/lib/xrRender_GL.so
#4  0x00000008ca506850 in R_dsgraph_structure::render_graph(unsigned int) () from /usr/local/lib/xrRender_GL.so
#5  0x00000008ca583002 in CRender::Render() () from /usr/local/lib/xrRender_GL.so
#6  0x00000008025bd042 in CLevel::OnRender() () from /usr/local/lib/xrGame.so
#7  0x00000008037d787e in MessageRegistry<pureRender>::Process() () from /usr/local/lib/xrEngine.so
#8  0x00000008037d61aa in CRenderDevice::DoRender() () from /usr/local/lib/xrEngine.so
#9  0x00000008037d6455 in CRenderDevice::ProcessFrame() () from /usr/local/lib/xrEngine.so
#10 0x00000008037cbb98 in CApplication::Run() () from /usr/local/lib/xrEngine.so
#11 0x000000000020228e in ?? ()
#12 0x0000000803c27c3a in __libc_start1 (argc=1, argv=0x7fffffffd928, env=0x7fffffffd938, cleanup=<optimized out>, mainX=0x202180) at /usr/src/lib/libc/csu/libc_start1.c:157
#13 0x0000000000202080 in ?? ()

@Xottab-DUTY Xottab-DUTY added the *BSD FreeBSD and other *BSDs label Jan 14, 2025
@Xottab-DUTY
Copy link
Member

I suspect that it's not the problem about extended instruction sets like AVX, etc.
It seems that probably xr_fixed_map got corrupted or corrupted item was added to it.
Clang-compiled binaries are known to be less stable than GCC-compiled ones, because this code base was written for MSVC and GCC has better compatibility with MSVC quirks it seems. On other hand, Clang is more strict and probably because of that the compiled code breaks sometimes.
I saw that there are flags in Clang that enable better compatibility with MSVC. Maybe they can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*BSD FreeBSD and other *BSDs Bug The issue in the run-time.
Projects
Status: To do
Development

No branches or pull requests

3 participants