swift-backtrace
swift-backtrace copied to clipboard
Swift 5.0 Raspbian linker fail
Swift version 5.0 (swift-5.0-RELEASE) Target: armv6-unknown-linux-gnueabihf
linker LOG:
$ swift build -c release -Xswiftc -g -v
which clang
/usr/local/bin/swiftc -sdk / -g -L /home/pi/Swish/ProjectFolder/.build/armv6-unknown-linux-gnueabihf/debug -o /home/pi/Swish/ProjectFolder/.build/armv6-unknown-linux-gnueabihf/debug/ProjectFolder -module-name Project -emit-executable -Xlinker '-rpath=$ORIGIN' @/home/pi/Swish/ProjectFolder/.build/armv6-unknown-linux-gnueabihf/debug/ProjectFolder/Objects.LinkFileList
/home/pi/Swish/ProjectFolder/.build/checkouts/swift-backtrace/Sources/CBacktrace/backtrace.c:75: error: undefined reference to '_Unwind_GetIPInfo'
/home/pi/Swish/ProjectFolder/.build/checkouts/swift-backtrace/Sources/CBacktrace/simple.c:70: error: undefined reference to '_Unwind_GetIPInfo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
@AleyRobotics could you try adding a -Xswiftc -lunwind
to the command line? And do you have libunwind installed?
@weissi I'm working through the same issue on a Raspberry Pi 4. I was able to install libunwind8 but get:
/usr/bin/ld.gold: error: cannot find -lunwind
I can build without -Xswiftc -lunwind
by commenting out #define HAVE_GETIPINFO 1
, but then when there's something to report it calls an illegal instruction:
Current stack trace:
Illegal instruction
This is the output of swift test
at 54a65d6 with #define HAVE_GETIPINFO 1
commented out. Should I see a stack trace?
dan@pi4:~/swift-backtrace $ swift test [5/5] Linking swift-backtracePackageTests.xctest Test Suite 'All tests' started at 2021-06-02 13:38:15.549 Test Suite 'debug.xctest' started at 2021-06-02 13:38:15.552 Test Suite 'BacktraceTests' started at 2021-06-02 13:38:15.553 Test Case 'BacktraceTests.testBacktrace' started at 2021-06-02 13:38:15.553 Fatal error: 9053EA13-E81B-44CB-B892-864CD6C72724: file /home/dan/swift-backtrace/Sources/Sample/main.swift, line 19 Current stack trace:
Test Case 'BacktraceTests.testBacktrace' passed (0.509 seconds) Test Suite 'BacktraceTests' passed at 2021-06-02 13:38:16.062 Executed 1 test, with 0 failures (0 unexpected) in 0.509 (0.509) seconds Test Suite 'debug.xctest' passed at 2021-06-02 13:38:16.063 Executed 1 test, with 0 failures (0 unexpected) in 0.509 (0.509) seconds Test Suite 'All tests' passed at 2021-06-02 13:38:16.063 Executed 1 test, with 0 failures (0 unexpected) in 0.509 (0.509) second