MacOS 的M芯片下编译项目到 release 报错:libunwind: malformed __unwind_info
情况如下:
背景:
- 相同的代码
- 项目是 rust 写的 AI 机器视觉项目,内部设计调用 opencv 和 onnxruntime的 rust 绑定
- 开发电脑为 mac 的 m3 max 芯片
- rust 版本为 1.79.0, cargo 1.81.0-nightly (4ed7bee47 2024-06-25)
- llvm 的版本为 18.1.8
- clang 版本:Homebrew clang version 18.1.8
- gcc 版本 Apple clang version 15.0.0 (clang-1500.3.9.4)
报错问题:
libunwind: malformed __unwind_info at 0x198D02AAC bad second level page
基本问题描述:
- 使用mac intel 芯片编译为 debug 或者 release 都可以正常运行,
- 使用mac 的M 芯片编译为 debug 可以正常运行,编译为 release 出现这样的错误。
- 后来尝试使用 python 做其他AI项目时,运行 python 项目也出现了同样的问题,
python 代码如下:pip install diffusers transformers accelerate torch
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
prompt = "Spiderman is surfing"
video_frames = pipe(prompt, num_inference_steps=25).frames
video_path = export_to_video(video_frames)
有没有同学遇到过类似问题,请教分享,谢谢
Apple Mac Book pro M3 Max
啊,太有钱了吧,我上次遇到了个类似的问题,最后选择让github的action替我编译的
已经解决了,原因是因为编译工具问题,我在安装 rust 的之前安装了 llvm,与 MacOS 下的 C/C++ 编译器不兼容, 原本 MacOS 的 Xcode 是拥有整套编译工具。解决方法就是把手动安装的 llvm 卸载就可以了。