You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS下使用openclc --migrate迁移代码时触发Illegal instruction:4崩溃

问题:openclc --migrate命令执行时触发Illegal instruction:4崩溃

我有一个可正常运行的OpenCL Hello World程序,取自公开示例代码。尝试执行命令:

openclc --migrate hello.c

将其迁移为Metal代码,但执行时触发Illegal instruction:4崩溃,堆栈信息如下:

0  libLLVMContainer.dylib   0x00007ffa3257fc95 PrintStackTrace(void*) + 37
1  libLLVMContainer.dylib   0x00007ffa325800bd SignalHandler(int) + 493
2  libsystem_platform.dylib 0x00007ff81c9d9c1d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370100843520
4  openclc                  0x00000001029b246c cc1_main(char const**, char const**, char const*, void*) + 1564
5  openclc                  0x00000001029b4006 main + 1395
6  dyld                     0x00000002034a9310 start + 2432
Stack dump:
0.  Program arguments: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/openclc -cc1 -triple x86_64-apple-macosx10.18.0 -migrate -disable-free -disable-llvm-verifier -main-file-name ocl.c -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 133.3 -resource-dir /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/../lib/clang/3.2 -fmodule-cache-path /var/folders/qy/3y6k069d0h58zd4wkb53ksnh0000gn/T/clang-module-cache -fdebug-compilation-dir /Users/risner/Documents/stackoverflow/winterbash -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.18.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -o ocl.remap -x c ocl.c
openclc: error: unable to execute command: Illegal instruction: 4
openclc: error: clang frontend command failed due to signal (use -v to see invocation)
LLVM version 3.2
Target: x86_64-apple-darwin22.1.0
Thread model: posix
openclc: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
openclc: note: diagnostic msg: Error generating preprocessed source(s).

我的需求是通过Apple提供的openclc工具将OpenCL代码转换为原生Metal代码。补充说明:openclc是系统自带工具,并非自行安装,其路径为:

/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/Libraries/openclc

Xcode编译OpenCL代码为二进制文件时会自动调用该工具。

内容的提问来源于stack exchange,提问作者James Risner

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 17:25:17