未定义符号SystemRuntimeMacOSX::Initialize和SystemRuntimeMacOSX::Te

Undefined symbols SystemRuntimeMacOSX::Initialize and SystemRuntimeMacOSX::Terminate

本文关键字:SystemRuntimeMacOSX Te 未定义 符号 Initialize      更新时间:2023-10-16

我正在尝试构建LLDB作为Clang/LLVM的一部分。LLVM, Clang, Compiler-RT和Extras可以构建。但是,LLVM在与其他组件一起构建时存在一个问题。

目录结构是根据LLVM/Clang/LLDB指令设置的。有关LLDB的文档位于Building 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

EDIT:按照下面Matt的指示,我能够避免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 recipe的shell脚本中有一个pastebin。这个食谱使用Missing-Makefile, Matt在下面提供了它。该配方修补了makefile,因此您不需要手动操作。

150赏金编辑: 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

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

/lib/Makefile: lldb"lldbPluginSystemRuntimeMacOSX。需要在第98行

之后添加一个"

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

完成所有这些后,我就能够完成构建并获得一个功能正常的libdb版本。dylib,这就是我想要的。希望这对你有帮助!

我通常在MacOS x上使用Xcode项目构建。只需获取lldb源代码,并执行:

cd lldb
xcodebuild -configuration Debug

或者如果你想调试Clang方面的东西:

xcodebuild -configuration DebugClang

你甚至不需要获得llvm源代码,如果它们不存在,Xcode项目会为你检查出来(但不会覆盖你的版本,如果你想尝试构建一个分支或其他…)

tottldb现在对我来说很好。

在lldb-dev邮件列表中还有其他人使用Makefile构建,如果你出于某种原因想要这样构建,你可以在那里询问。some

相关文章:
  • 没有找到相关文章