rust运行时symbol not found - Wed, Apr 7, 2021
rust运行时libgcc符号未找到
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /device-iec61850-rust)
Error relocating /device-iec61850-rust: _Unwind_Backtrace: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetIPInfo: symbol not found
Error relocating /device-iec61850-rust: _Unwind_RaiseException: symbol not found
Error relocating /device-iec61850-rust: _Unwind_SetGR: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetDataRelBase: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetIP: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetTextRelBase: symbol not found
Error relocating /device-iec61850-rust: _Unwind_DeleteException: symbol not found
Error relocating /device-iec61850-rust: _Unwind_GetRegionStart: symbol not found
Error relocating /device-iec61850-rust: _Unwind_Resume: symbol not found
Error relocating /device-iec61850-rust: _Unwind_SetIP: symbol not found
由于在编译时使用docker+alpine的环境编译,所以需要使用动态链接库进行链接。
RUSTFLAGS=-Ctarget-feature=-crt-static
https://github.com/rust-lang/rust/issues/31322
默认RUST使用C runtime静态链接?但是alpine musl不能使用静态链接,所以需要去掉编译时静态连接特性。
动态链接库使用时必须要有libgcc
The dynamic linker must be able to find libgcc
解决方法:
apk add --update --no-cache libgcc