首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未定义符号SystemRuntimeMacOSX::Initialize和SystemRuntimeMacOSX::Terminate

未定义符号SystemRuntimeMacOSX::Initialize和SystemRuntimeMacOSX::Terminate
EN

Stack Overflow用户
提问于 2014-07-24 01:18:57
回答 3查看 618关注 0票数 2

我正在尝试将LLDB构建为Clang/LLVM的一部分。LLVM,Clang,Compiler和Extras build .但是,在使用其他组件进行构建时,LLVM存在问题。

目录结构是根据LLVM/Clang/LLDB指令设置的。LLDB上的文档位于建筑LLDB。下面是从build目录运行的,该目录位于llvm目录旁边(llvm是所有源代码被解压缩的地方):

代码语言:javascript
复制
$ 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

编辑:遵循Matt的以下说明,我能够避免Undefined symbols SystemRuntimeMacOSX::Initialize and SystemRuntimeMacOSX::Terminate。但是这个建筑仍然死了,因为:

代码语言:javascript
复制
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

主机平台为OSX10.8.5,x64,完全修补。Xcode版本为5.1.1 (5B1008) (这是最新版本)。

有人知道我应该执行哪些神奇的步骤来让lldb用LLVM和Clang编译吗?

100赏金编辑:在Clang 3.4.2配方的shell脚本中有一个带有我的菜谱的巴斯特宾。菜谱使用Missing-Makefile,Matt在下面提供了它。菜谱修补makefile,所以您不需要手动完成它。

150个赏金编辑:Cos的答案是最后一步。这个问题既需要马特的回答,也需要考斯的回答。Cos提供了一个更新的食谱。它可以在Clang 3.4.2配方(最终)上使用。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-08-17 00:21:49

您需要在脚本中添加以下修补程序:

代码语言:javascript
复制
sed -i '' '\|DIRS += Process/mach-core|a\
DIRS += SystemRuntime/MacOSX\
' llvm/tools/lldb/source/Plugins/Makefile

你最新的食谱

票数 5
EN

Stack Overflow用户

发布于 2014-08-02 11:53:46

我相信吉姆以上的建议可能是最好的选择。但是,我在构建llvm+clang+lldb 3.4时也遇到了这个问题。

我把问题缩小到一个特定的插件上,专门针对OS,而不是通过Make构建。这是一个构建系统错误,由此提交修复:

https://github.com/llvm-mirror/lldb/commit/7a53199e140843235d2bd2b12182ceb764419c8a

您可以使用上面的提交作为指南。要成功构建,实际上只需要进行两个更改。我只是修补了我的本地副本。

lldb/lib/Makefile:"lldbPluginSystemRuntimeMacOSX.a“需要添加到第98行之后

需要创建具有以下内容的lldb/source/Plugins/SystemRuntime/MacOSX/Makefile:

代码语言:javascript
复制
##===- 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版本,这正是我所追求的。希望这能有所帮助!

票数 5
EN

Stack Overflow用户

发布于 2014-07-24 20:09:40

我通常是在MacOS X上使用Xcode项目构建的,只需获取lldb源代码,然后执行以下操作:

代码语言:javascript
复制
cd lldb
xcodebuild -configuration Debug

或者,如果您也想调试Clang方面的内容:

代码语言:javascript
复制
xcodebuild -configuration DebugClang

您甚至不需要获取llvm源代码,如果它们不存在,Xcode项目将为您检查它们(但不会覆盖您想要在分支或其他地方构建的版本)。

托特·伊尔德现在为我做得很好。

在lldb-dev邮件列表中还有其他人确实使用Makefile构建,如果您出于某种原因想以这种方式构建它,您可能会问there.some。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24923650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档