我正在尝试将LLDB构建为Clang/LLVM的一部分.LLVM,Clang,Compiler-RT和Extras构建正常.但是,LLVM在使用其他组件构建时存在问题.
目录结构根据LLVM/Clang/LLDB指令设置.LLDB的文档位于LLDB 大楼.下面是从build
目录旁边运行的llvm
目录(llvm
所有源都被解压缩的地方):
$ cd build $ ../llvm/configure --enable-optimized --enable-cxx11 --enable-libcpp --prefix=/usr/local ... $ make -j4 ... llvm[4]: Compiling ARM_DWARF_Registers.cpp for Release+Asserts build llvm[4]: Compiling KQueue.cpp for Release+Asserts build llvm[4]: Compiling PseudoTerminal.cpp for Release+Asserts build llvm[4]: Compiling Range.cpp for Release+Asserts build llvm[4]: Compiling SharingPtr.cpp for Release+Asserts build llvm[4]: Compiling StringExtractor.cpp for Release+Asserts build llvm[4]: Compiling StringExtractorGDBRemote.cpp for Release+Asserts build llvm[4]: Compiling TimeSpecTimeout.cpp for Release+Asserts build llvm[4]: Building Release+Asserts Archive Library liblldbUtility.a llvm[3]: Linking Release+Asserts Shared Library liblldb.dylib Undefined symbols for architecture x86_64: "SystemRuntimeMacOSX::Initialize()", referenced from: lldb_private::Initialize() in liblldbInitAndLog.a(lldb.o) "SystemRuntimeMacOSX::Terminate()", referenced from: lldb_private::Terminate() in liblldbInitAndLog.a(lldb.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [/Users/jwalton/Clang-3.4.2/build/Release+Asserts/lib/liblldb.dylib] Error 1 make[2]: *** [all] Error 1 make[1]: *** [all] Error 1 make: *** [all] Error 1
编辑:按照下面马特的说明,我能够避免Undefined symbols SystemRuntimeMacOSX::Initialize and SystemRuntimeMacOSX::Terminate
.但构建仍然死于:
llvm[4]: Compiling ARM_DWARF_Registers.cpp for Release+Asserts build llvm[4]: Compiling KQueue.cpp for Release+Asserts build llvm[4]: Compiling PseudoTerminal.cpp for Release+Asserts build llvm[4]: Compiling Range.cpp for Release+Asserts build llvm[4]: Compiling SharingPtr.cpp for Release+Asserts build llvm[4]: Compiling StringExtractor.cpp for Release+Asserts build llvm[4]: Compiling StringExtractorGDBRemote.cpp for Release+Asserts build llvm[4]: Compiling TimeSpecTimeout.cpp for Release+Asserts build llvm[4]: Building Release+Asserts Archive Library liblldbUtility.a make[3]: *** No rule to make target `/Users/jwalton/Clang-3.4.2/build/Release+Asserts/lib/liblldbPluginSystemRuntimeMacOSX.a', needed by `/Users/jwalton/Clang-3.4.2/build/Release+Asserts/lib/liblldb.dylib'. Stop.
奇怪的是,lldbPluginSystemRuntimeMacOSX
处理方式和其他插件一样lldbPluginProcessMachCore
.相同的指令出现在相同的地方,如Cmake.txt
.
主机平台是OS X 10.8.5,x64,完全打补丁.Xcode版本是5.1.1(5B1008)(这是最新的).
有谁知道我应该执行什么神奇的步骤来让lldb用LLVM和Clang编译?
100 BOUNTY EDIT:在Clang 3.4.2配方的shell脚本中有一个带有我的食谱的pastebin .配方使用Missing-Makefile
,Matt在下面提供.配方修补了makefile,因此您无需手动执行此操作.
150 BOUNTY EDIT:Cos的答案是最后一步.这个问题需要Matt的回答和Cos的回答.Cos提供了更新的食谱.它可以在Clang 3.4.2 Recipe(Final)中找到.
您需要在脚本中添加以下补丁:
sed -i '' '\|DIRS += Process/mach-core|a\ DIRS += SystemRuntime/MacOSX\ ' llvm/tools/lldb/source/Plugins/Makefile
你更新的食谱
我相信Jim的建议可能是最好的选择.但是,我也遇到了试图构建llvm + clang + lldb 3.4的问题.
我将问题缩小到一个特定的插件,特定于OS X,而不是通过Make构建.这是一个构建系统错误,由此提交修复:
https://github.com/llvm-mirror/lldb/commit/7a53199e140843235d2bd2b12182ceb764419c8a
您可以使用上面的提交作为指南.实际上只需要进行两次更改即可成功构建.我刚修补了我的本地副本.
lldb/lib/Makefile:第98行后需要添加"lldbPluginSystemRuntimeMacOSX.a"
需要使用以下内容创建 lldb/source/Plugins/SystemRuntime/MacOSX/Makefile :
##===- source/Plugins/SystemRuntime/MacOSX/Makefile ---------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## LLDB_LEVEL := ../../../.. LIBRARYNAME := lldbPluginSystemRuntimeMacOSX BUILD_ARCHIVE = 1 include $(LLDB_LEVEL)/Makefile
完成所有这些后,我能够完成构建并获得liblldb.dylib的功能版本,这就是我所追求的.希望这可以帮助!