swiftlang / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.12k stars 330 forks source link

[SR-9179] Linux lldb-mi debug build liblldb.so.7.0.0: undefined reference #4619

Open swift-ci opened 6 years ago

swift-ci commented 6 years ago
Previous ID SR-9179
Radar None
Original Reporter joekiller (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | LLDB for Swift | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 6007bd26e86121ecc65d9bd2299ff587

Issue Description:

When building swift in debug mode on linux (arch linux in my case) Linking CXX executable bin/lldb-mi failed to build saying the following. Be prepared to have a 40GB Swap to complete this build. I saw utilization around 36 GB of memory for the test libs being linked.

Commit was swift-DEVELOPMENT-SNAPSHOT-2018-11-01-a-56-gb2f60bf978

Build command is:

./utils/build-script --assertions --no-swift-stdlib-assertions --swift-enable-ast-verifier=0 --llbuild --swiftpm --xctest --libicu --build-ninja --install-swift --install-lldb --install-llbuild --install-swiftpm --install-xctest --install-libicu --install-prefix=/usr '--swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc' '--llvm-install-components=llvm-cov;llvm-profdata;IndexStore' --build-swift-static-stdlib --build-swift-static-sdk-overlay --build-swift-stdlib-unittest-extra --test-installable-package --install-destdir=/home/jlawson/build/swift-source/swift/swift-nightly-install --installable-package=/home/jlawson/build/swift-source/swift/swift-LOCAL-2018-11-04-a-osx.tar.gz --build-subdir=buildbot_linux --lldb --debug --test --validation-test --long-test --stress-test --test-optimized --foundation --libdispatch --lit-args=-v --lldb-test-swift-only --install-foundation --install-libdispatch --reconfigure --skip-test-cmark --skip-test-lldb --skip-test-swift --skip-test-llbuild --skip-test-swiftpm --skip-test-xctest --skip-test-foundation --skip-test-libdispatch --skip-test-playgroundsupport --skip-test-libicu '--extra-cmake-options=-DPYTHON_EXECUTABLE=/usr/bin/python2.7 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so -DPYTHON_RELEASE_LIB=/usr/lib/libpython2.7.so' | tee ../result.txt
[942/945] Linking CXX executable bin/lldb-mi
FAILED: bin/lldb-mi 
: && /usr/bin/clang++  -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -w -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g  -Wl,-rpath-link,/home/jlawson/build/swift-source/build/buildbot_linux/lldb-linux-x86_64/./lib tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgContext.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgSet.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValBase.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValConsume.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValFile.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValListBase.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValListOfN.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValNumber.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValOptionLong.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValOptionShort.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValPrintValues.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValString.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdArgValThreadGrp.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdBase.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCommands.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmd.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdBreak.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdData.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdEnviro.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdExec.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdFile.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdGdbInfo.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdGdbSet.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdGdbShow.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdGdbThread.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdMiscellanous.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdStack.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdSupportInfo.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdSupportList.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdSymbol.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdTarget.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdThread.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdTrace.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdVar.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdData.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdFactory.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdInterpreter.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdInvoker.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdMgr.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdMgrSetCmdDeleteCallback.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnBase.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBBroadcaster.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBDebugger.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBDebuggerHandleEvents.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBDebugSessionInfo.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBDebugSessionInfoVarObj.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBProxySBValue.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLLDBUtilSBValue.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLog.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnLogMediumFile.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIOutOfBandRecord.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIResultRecord.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIValue.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIValueConst.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIValueList.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIValueResult.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnMIValueTuple.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnResources.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnStreamStderr.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnStreamStdin.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnStreamStdout.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmnThreadMgrStd.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIDriver.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIDriverBase.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIDriverMain.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIDriverMgr.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilDateTimeStd.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilDebug.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilFileStd.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilMapIdToVariant.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilString.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilThreadBaseStd.cpp.o tools/lldb-mi/CMakeFiles/lldb-mi.dir/MIUtilVariant.cpp.o  -o bin/lldb-mi  -Wl,-rpath,"\$ORIGIN/../lib:/home/jlawson/build/swift-source/build/buildbot_linux/llvm-linux-x86_64/lib" /home/jlawson/build/swift-source/build/buildbot_linux/llvm-linux-x86_64/lib/libLLVMSupport.a /home/jlawson/build/swift-source/build/buildbot_linux/llvm-linux-x86_64/lib/libLLVMSupport.a -lpthread lib/liblldb.so.7.0.0 -lz -lrt -ldl -ltinfo -lpthread -lm /home/jlawson/build/swift-source/build/buildbot_linux/llvm-linux-x86_64/lib/libLLVMDemangle.a && :
/usr/bin/ld: lib/liblldb.so.7.0.0: undefined reference to `(anonymous namespace)::Selector::ForSetter'
/usr/bin/ld: lib/liblldb.so.7.0.0: undefined reference to `(anonymous namespace)::Selector::ForGetter'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
belkadan commented 6 years ago

cc jingham@apple.com (JIRA User)

swift-ci commented 6 years ago

Comment by Jim Ingham (JIRA)

The missing symbols are from the swift compiler - from GenObjC.cpp - they are from:

namespace {
  class Selector {

    llvm::SmallString<80> Buffer;
    StringRef Text;

  public:

    static constexpr struct ForGetter_t { } ForGetter{};
    static constexpr struct ForSetter_t { } ForSetter{};
...
}

Those shouldn't be exported symbols, however. Not sure why the linker thinks it needs to resolve those.

belkadan commented 6 years ago

Ah, this might be what we ran into with Swift: a copy constructor takes a value by reference by default, which makes it look like accessing these things needs a stable address.