lifting-bits/sleigh

Tests failing on Linux

Closed this issue · 5 comments

System: Endeavour os, kernel 5.18.11-arch1-1
Cmake version: 3.23.2
Commit: 5ee2f2c

Following steps at Build section

git clone https://github.com/lifting-bits/sleigh.git
cd sleigh
# Configure CMake
cmake -B build -S .
# Build SLEIGH
cmake --build build -j

results in compilation failure

Expected behavior:
Tests passed without error messages and failures
Actual behavior:
Tests failing with the following message:

Consolidate compiler generated dependencies of target sla
[ 41%] Built target sla
/usr/include/c++/12.1.0/bits/stl_vector.h:1206: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::front() [with _Tp = cmGccStyleDependency; _Alloc = std::allocator<cmGccStyleDependency>; reference = cmGccStyleDependency&]: Assertion 'this->empty()' failed.
make[2]: *** [CMakeFiles/decomp.dir/build.make:1421: CMakeFiles/decomp.dir/depend] Aborted (core dumped)
make[1]: *** [CMakeFiles/Makefile2:1217: CMakeFiles/decomp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 41%] Linking CXX executable ghidra_test_dbg
[ 55%] Built target ghidra_test_dbg
make: *** [Makefile:146: all] Error 2

However, I am not expirienced user of cmake, so maybe there is some error from my side

Hmmm. Your error message indicates there's an issue in the standard c++ header stl_vector.h at line 1206 and there doesn't seem to be any sort of traceback to a location in Ghidra/sleigh files other than the error message comes during decomp target 🤔

Can you try running without parallelism, increase the verbosity, and paste the failing line, please:

cmake --build build --verbose
[ 55%] Built target sla
/sbin/make  -f CMakeFiles/decomp.dir/build.make CMakeFiles/decomp.dir/depend
make[2]: Entering directory '/home/jus/git/sleigh/build'
cd /home/jus/git/sleigh/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jus/git/sleigh /home/jus/git/sleigh /home/jus/git/sleigh/build /home/jus/git/sleigh/build /home/jus/git/sleigh/build/CMakeFiles/decomp.dir/DependInfo.cmake --color=
Dependencies file "CMakeFiles/decomp.dir/_deps/ghidrasource-src/Ghidra/Features/Decompiler/src/decompile/cpp/crc32.cc.o.d" is newer than depends file "/home/jus/git/sleigh/build/CMakeFiles/decomp.dir/compiler_depend.internal".
Dependencies file "CMakeFiles/decomp.dir/_deps/ghidrasource-src/Ghidra/Features/Decompiler/src/decompile/cpp/rulecompile.cc.o.d" is newer than depends file "/home/jus/git/sleigh/build/CMakeFiles/decomp.dir/compiler_depend.internal".
/usr/include/c++/12.1.0/bits/stl_vector.h:1206: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::front() [with _Tp = cmGccStyleDependency; _Alloc = std::allocator<cmGccStyleDependency>; reference = cmGccStyleDependency&]: Assertion '!this->empty()' failed.
make[2]: *** [CMakeFiles/decomp.dir/build.make:1421: CMakeFiles/decomp.dir/depend] Aborted (core dumped)
make[2]: Leaving directory '/home/jus/git/sleigh/build'
make[1]: *** [CMakeFiles/Makefile2:1217: CMakeFiles/decomp.dir/all] Error 2
make[1]: Leaving directory '/home/jus/git/sleigh/build'
make: *** [Makefile:146: all] Error 2

stl_vector.h:1206 _glibcxx_requires_nonempty();

Honestly, I'm at a bit of a loss to figure this out. It almost seems like an issue with CMake itself?

Does running the following command produce the error?

cd /home/jus/git/sleigh/build && \
  /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jus/git/sleigh /home/jus/git/sleigh /home/jus/git/sleigh/build /home/jus/git/sleigh/build /home/jus/git/sleigh/build/CMakeFiles/decomp.dir/DependInfo.cmake --color=

if so, then afaik, it's not a compiler error with the sleigh source code but an assertion error when running CMake. You could try maybe getting a stacktrace with gdb?

cd /home/jus/git/sleigh/build && \
  gdb --args /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jus/git/sleigh /home/jus/git/sleigh /home/jus/git/sleigh/build /home/jus/git/sleigh/build /home/jus/git/sleigh/build/CMakeFiles/decomp.dir/DependInfo.cmake --color=

It builds in CI on Ubuntu and Mac, and I can also build on Fedora 36, so it might just be an Endeavour OS issue 😕

  1. Yes

image
(further debugging is difficult because when I switch to f 4 gdb hangs...)
Probalby I could try disabling CXX assertions?

Probalby I could try disabling CXX assertions?

Yeah, I would try that. I'm really not sure what's causing the issue, and I don't think it's anything I'm able to fix in the code for this project, unfortunately.