问题描述
我使用 python 创建自定义编程语言,PLY 作为词法分析器和解析器,LLVMlite 作为低级中间语言来进行代码生成。 我已经使用 Python pip 安装了 PLY 和 LLC
我使用 LLC 创建目标文件 output.o,并使用 GCC 创建最终的可执行文件,如下所示。
$ llc -filetype=obj output.ll
$ gcc output.o -o output
当我执行 llc -filetype=obj output.ll
时我得到
llc : The term 'llc' is not recognized as the name of a cmdlet,function,script file,or operable program. Check the spelling of the name,or if a path was included,verify that the path is correct and try again.
At line:1 char:1
+ llc -filetype=obj output.ll
+ CategoryInfo : ObjectNotFound: (llc:String) [],CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我花了几个小时做这件事,但无法弄清楚。怎么了?
解决方法
PyPi package llc 与 LLVM 的 llc
工具无关。您不能通过 pip
安装后者,因为它不是 Python 包。您需要安装 LLVM 工具才能获得它。