在Mac OS X上使用LLVM安装和编译
Installing & Compiling with LLVM on Mac OS X
我有一个项目(有效),我正试图在Mac上编译。它使用了很多东西,包括LLVM,这是我唯一没有安装的。所以我按照这里的说明:http://www.isi.edu/~pedro/教学/CSI565-Spring15/Projects/Project1LLVM/LLVMInstructions-MacOSX10.9.pdf
这似乎奏效了,但我的makefile要求我安装LLVM 3.3,而该教程适用于LLVM 3.5。现在,在安装之前和之后,当我运行make时,我都会得到以下错误:
$ make
compiling cpp yacc file: expr-codegen.y
output file: expr-codegen
bison -b expr-codegen -d expr-codegen.y
/bin/mv -f expr-codegen.tab.c expr-codegen.tab.cc
flex -oexpr-codegen.lex.cc expr-codegen.lex
clang -g -c decaf-stdlib.c
clang++ -o ./expr-codegen expr-codegen.tab.cc expr-codegen.lex.cc decaf-stdlib.o `llvm-config-3.3 --cppflags --ldflags --libs core jit native` -ly -ll
/bin/sh: llvm-config-3.3: command not found
In file included from expr-codegen.y:6:
./decafdefs.h:5:10: fatal error: 'llvm/IR/DerivedTypes.h' file not found
#include "llvm/IR/DerivedTypes.h"
^
1 error generated.
In file included from expr-codegen.lex:2:
./decafdefs.h:5:10: fatal error: 'llvm/IR/DerivedTypes.h' file not found
#include "llvm/IR/DerivedTypes.h"
^
1 error generated.
make: *** [expr-codegen] Error 1
这是我的制作文件:
lexlib=l
yacclib=y
bindir=.
rm=/bin/rm -f
mv=/bin/mv -f
targets=
#cpptargets=type-inherit decaf-sym
#llvmtargets=factorial
#llvmcpp=sexpr2-codegen expr-codegen
#llvmfiles=rec_add
#llvmcpp=decaf-sym expr-codegen sexpr2-codegen
llvmcpp=expr-codegen
all: $(targets) $(cpptargets) $(llvmfiles) $(llvmcpp)
$(targets): %: %.y
@echo "compiling yacc file:" $<
@echo "output file:" $@
bison -o$@.tab.c -d $<
flex -o$@.lex.c $@.lex
clang -o $(bindir)/$@ $@.tab.c $@.lex.c -l$(yacclib) -l$(lexlib)
$(rm) $@.tab.c $@.tab.h $@.lex.c
$(cpptargets): %: %.y
@echo "compiling cpp yacc file:" $<
@echo "output file:" $@
bison -b $@ -d $<
$(mv) $@.tab.c $@.tab.cc
flex -o$@.lex.cc $@.lex
clang++ -o $(bindir)/$@ $@.tab.cc $@.lex.cc -l$(yacclib) -l$(lexlib)
$(rm) $@.tab.h $@.tab.cc $@.lex.cc
$(llvmcpp): %: %.y
@echo "compiling cpp yacc file:" $<
@echo "output file:" $@
bison -b $@ -d $<
$(mv) $@.tab.c $@.tab.cc
flex -o$@.lex.cc $@.lex
clang -g -c decaf-stdlib.c
clang++ -o $(bindir)/$@ $@.tab.cc $@.lex.cc decaf-stdlib.o `llvm-config-3.3 --cppflags --ldflags --libs core jit native` -l$(yacclib) -l$(lexlib)
$(rm) $@.tab.h $@.tab.cc $@.lex.cc
$(llvmtargets): %: %.ll
@echo "using llvm to compile file:" $<
llvm-as $<
`llvm-config-3.3 --bindir`/llc -disable-cfi $@.bc
clang $@.s ../decaf-stdlib.c -o $(bindir)/$@
$(llvmfiles): %: %.ll
@echo "using llvm to compile file:" $<
llvm-as $<
`llvm-config-3.3 --bindir`/llc -disable-cfi $@.bc
clang $@.s decaf-stdlib.c -o $(bindir)/$@
clean:
$(rm) $(targets) $(cpptargets) $(llvmtargets) $(llvmcpp) $(llvmfiles)
$(rm) *.tab.h *.tab.c *.lex.c
$(rm) *.bc *.s *.o
$(rm) -r *.dSYM
作为LLVM的新手,我不知道为什么我不能让编译器识别LLVM并使用它。任何帮助都将不胜感激。谢谢
来自llvm配置文档:
dzur:~/tmp> llvm-config
usage: llvm-config <OPTION>... [<COMPONENT>...]
Get various configuration information needed to compile programs which use
LLVM. Typically called from 'configure' scripts. Examples:
llvm-config --cxxflags
llvm-config --ldflags
llvm-config --libs engine bcreader scalaropts
这正是您所需要的:)
相关文章:
- 在Ubuntu 16.04上安装Cilk时出现问题
- 在CMakeLists.txt的安装功能中使用.cmake文件有什么用
- 如何将 I->getType() 作为参数传递给 llvm 中的 CreateCall?
- C++:如何在CLion IDE中安装Boost
- 将尾部调用void(i32,..)位转换为llvm::函数以获取FnAttribute
- 是否可以将llvm::FunctionType转换为C/C++原始函数指针
- llvm构建器向基本块添加终止符
- 安装opencv失败-粘贴CMakeError.log的内容
- 在cygwin中测试新的boost安装时出现cpp错误
- 正在LLVM中检测整数比较条件
- 有人安装"IITB Simplecpp in mac"吗?
- 如何在LLVM中dyn_cast以识别StoreInst?
- 使用 cmake 的 LLVM 构建在 tsan_libdispatch_mac.cc 期间失败; "Error: conflicting types for ..."
- 如何使用 llvm-10 库在C++定义 LLVM 全局值变量?
- 用Cmake和Visual Stuidio构建LLVM无法安装
- 在Mac OS X上使用LLVM安装和编译
- 使用 llvm-gcc 4.x 安装 srilm 1.6.0 时出现问题
- 在apt-get安装后没有找到LLVM头文件
- 无法为Eclipse CDT安装LLVM工具链
- LLVM 和安装时间优化