fprime icon indicating copy to clipboard operation
fprime copied to clipboard

Seg Fault While Running Unit Test

Open Steph41 opened this issue 2 years ago • 2 comments

F´ Version 3.3.3
Affected Component Unit Testing


Problem Description

A description of the problem with sufficient detail to understand the issue.

Ran into a seg fault while attempting to run the Unit Tests of the LED Blinker workshop.

Output when running prime-unit check

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 0.29 sec

The following tests FAILED: 1 - Components_Led_ut_exe (SEGFAULT)

Output from lldb

(other-venv) $ lldb ../../build-fprime-automatic-native-ut/bin/Darwin/Components_Led_ut_exe (lldb) target create "../../build-fprime-automatic-native-ut/bin/Darwin/Components_Led_ut_exe" Current executable set to '.../workshop/build-fprime-automatic-native-ut/bin/Darwin/Components_Led_ut_exe' (x86_64). (lldb) run Process 25141 launched: '.../workshop/build-fprime-automatic-native-ut/bin/Darwin/Components_Led_ut_exe' (x86_64) Process 25141 stopped

  • thread # 1, stop reason = EXC_BAD_ACCESS (code=1, address=0x7ff800000000) frame #0: 0x0000000100eb696c dyld -> 0x100eb696c: movl (%rax), %edx 0x100eb696e: andl $-0x2, %edx 0x100eb6971: cmpl $0xfeedface, %edx ; imm = 0xFEEDFACE 0x100eb6977: jne 0x100eb6930 Target 0: (Components_Led_ut_exe) stopped. (lldb) bt
  • thread # 1, stop reason = EXC_BAD_ACCESS (code=1, address=0x7ff800000000)

@LeStarch said it's due to an incompatibility in my GCC version. He commented out the sanitizers in fprime and it compiled correctly

(other-venv) $ gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x86_64-apple-darwin22.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Steph41 avatar Oct 18 '23 21:10 Steph41

We've seen this before where the sanitizer libraries linked in are not compatible with the clang compiler versions. This causes a segfault before main() is even run. Previously the fix was to upgrade the compilers, but in this case it was not possible.

LeStarch avatar Oct 19 '23 17:10 LeStarch

I had the same issue, See #1964 for more details. Clang 12 long deprecated, but macos doesn't always seem to upgrade xcode tools when upgrading, so you have to manually trigger an xcode tools upgrade.

Joshua-Anderson avatar Oct 20 '23 00:10 Joshua-Anderson

I am going to close this, as the solution would be to turn off the sanitizers

LeStarch avatar Mar 28 '24 00:03 LeStarch