This is an archive of the discontinued LLVM Phabricator instance.

Fix cmake build by linking LLVMSupport
AbandonedPublic

Authored by chilledheart on Nov 14 2014, 9:50 AM.

Details

Diff Detail

Event Timeline

chilledheart retitled this revision from to fix cmake build by linking LLVMSupport.
chilledheart updated this object.
chilledheart edited the test plan for this revision. (Show Details)
chilledheart added a subscriber: Unknown Object (MLST).

I am not sure if other platforms than OS X have the same issue.

zturner added inline comments.
CMakeLists.txt
293–296 ↗(On Diff #16223)

I don't think we should be hardcoding support here in the llvm_config call. I'm also not sure why this is needed on lldb executables. Is there an exe which is directly using LLVMSupport? I thought we only used it from lldb libraries, which are then linked into the executables, and the libraries already correctly depend on LLVMSupport.

Hi Zachary,

Yeah, hardcoding support library here is sort of bad style here.
These three lines you mentioned previously are used to fix build issue with lldb-platform which should be linked with LLVMSupport because llvm::Triple::getOSName() is needed there. I think it was the problem from tools/lldb-platform.

Cheers,
Chilledheart

[1/3] cd /Users/chilledheart/llvm-trunk/build-lldb/tools/lldb/scripts && echo -n
-n
[2/3] : && /usr/bin/clang++  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual -fno-omit-frame-pointer -g -O0 -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register  -fno-exceptions -fno-rtti -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -stdlib=libc++     -Wl,-dead_strip tools/lldb/tools/lldb-platform/CMakeFiles/lldb-platform.dir/lldb-platform.cpp.o  -o bin/lldb-platform-3.6.0  lib/liblldb.3.6.0.dylib lib/liblldbBreakpoint.a lib/liblldbCommands.a lib/liblldbDataFormatters.a lib/liblldbHost.a lib/liblldbCore.a lib/liblldbExpression.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbUtility.a lib/liblldbPluginDisassemblerLLVM.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFileSymtab.a lib/liblldbPluginDynamicLoaderStatic.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginDynamicLoaderHexagonDYLD.a lib/liblldbPluginObjectFileMachO.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginSymbolVendorELF.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectContainerMachOArchive.a lib/liblldbPluginProcessGDBRemote.a lib/liblldbPluginProcessMachCore.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginPlatformGDB.a lib/liblldbPluginPlatformFreeBSD.a lib/liblldbPluginPlatformKalimba.a lib/liblldbPluginPlatformLinux.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginPlatformWindows.a lib/liblldbPluginPlatformMacOSX.a lib/liblldbPluginDynamicLoaderMacOSXDYLD.a lib/liblldbPluginUnwindAssemblyInstEmulation.a lib/liblldbPluginUnwindAssemblyX86.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginCXXItaniumABI.a lib/liblldbPluginABIMacOSX_arm.a lib/liblldbPluginABIMacOSX_arm64.a lib/liblldbPluginABIMacOSX_i386.a lib/liblldbPluginABISysV_x86_64.a lib/liblldbPluginABISysV_hexagon.a lib/liblldbPluginABISysV_ppc.a lib/liblldbPluginABISysV_ppc64.a lib/liblldbPluginInstructionARM.a lib/liblldbPluginInstructionARM64.a lib/liblldbPluginObjectFilePECOFF.a lib/liblldbPluginOSPython.a lib/liblldbPluginMemoryHistoryASan.a lib/liblldbPluginInstrumentationRuntimeAddressSanitizer.a lib/liblldbAPI.a lib/liblldbPluginDynamicLoaderDarwinKernel.a lib/liblldbPluginProcessMacOSXKernel.a lib/liblldbPluginSymbolVendorMacOSX.a lib/liblldbPluginSystemRuntimeMacOSX.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginJITLoaderGDB.a lib/libclangAnalysis.dylib lib/libclangAST.dylib lib/libclangBasic.dylib lib/libclangCodeGen.dylib lib/libclangDriver.dylib lib/libclangEdit.dylib lib/libclangFrontend.dylib lib/libclangLex.dylib lib/libclangParse.dylib lib/libclangRewrite.dylib lib/libclangRewriteFrontend.dylib lib/libclangSema.dylib lib/libclangSerialization.dylib -Wl,-rpath,@executable_path/../lib && :
FAILED: : && /usr/bin/clang++  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual -fno-omit-frame-pointer -g -O0 -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register  -fno-exceptions -fno-rtti -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -stdlib=libc++     -Wl,-dead_strip tools/lldb/tools/lldb-platform/CMakeFiles/lldb-platform.dir/lldb-platform.cpp.o  -o bin/lldb-platform-3.6.0  lib/liblldb.3.6.0.dylib lib/liblldbBreakpoint.a lib/liblldbCommands.a lib/liblldbDataFormatters.a lib/liblldbHost.a lib/liblldbCore.a lib/liblldbExpression.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbUtility.a lib/liblldbPluginDisassemblerLLVM.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFileSymtab.a lib/liblldbPluginDynamicLoaderStatic.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginDynamicLoaderHexagonDYLD.a lib/liblldbPluginObjectFileMachO.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginSymbolVendorELF.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectContainerMachOArchive.a lib/liblldbPluginProcessGDBRemote.a lib/liblldbPluginProcessMachCore.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginPlatformGDB.a lib/liblldbPluginPlatformFreeBSD.a lib/liblldbPluginPlatformKalimba.a lib/liblldbPluginPlatformLinux.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginPlatformWindows.a lib/liblldbPluginPlatformMacOSX.a lib/liblldbPluginDynamicLoaderMacOSXDYLD.a lib/liblldbPluginUnwindAssemblyInstEmulation.a lib/liblldbPluginUnwindAssemblyX86.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginCXXItaniumABI.a lib/liblldbPluginABIMacOSX_arm.a lib/liblldbPluginABIMacOSX_arm64.a lib/liblldbPluginABIMacOSX_i386.a lib/liblldbPluginABISysV_x86_64.a lib/liblldbPluginABISysV_hexagon.a lib/liblldbPluginABISysV_ppc.a lib/liblldbPluginABISysV_ppc64.a lib/liblldbPluginInstructionARM.a lib/liblldbPluginInstructionARM64.a lib/liblldbPluginObjectFilePECOFF.a lib/liblldbPluginOSPython.a lib/liblldbPluginMemoryHistoryASan.a lib/liblldbPluginInstrumentationRuntimeAddressSanitizer.a lib/liblldbAPI.a lib/liblldbPluginDynamicLoaderDarwinKernel.a lib/liblldbPluginProcessMacOSXKernel.a lib/liblldbPluginSymbolVendorMacOSX.a lib/liblldbPluginSystemRuntimeMacOSX.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginJITLoaderGDB.a lib/libclangAnalysis.dylib lib/libclangAST.dylib lib/libclangBasic.dylib lib/libclangCodeGen.dylib lib/libclangDriver.dylib lib/libclangEdit.dylib lib/libclangFrontend.dylib lib/libclangLex.dylib lib/libclangParse.dylib lib/libclangRewrite.dylib lib/libclangRewriteFrontend.dylib lib/libclangSema.dylib lib/libclangSerialization.dylib -Wl,-rpath,@executable_path/../lib && :
Undefined symbols for architecture x86_64:
  "llvm::Triple::getOSName() const", referenced from:
      CreateProcessInfoResponse_DebugServerStyle(lldb_private::ProcessInstanceInfo const&, lldb_private::StreamString&) in liblldbPluginProcessGDBRemote.a(GDBRemoteCommunicationServer.cpp.o)
  "llvm::Triple::getVendorName() const", referenced from:
      CreateProcessInfoResponse_DebugServerStyle(lldb_private::ProcessInstanceInfo const&, lldb_private::StreamString&) in liblldbPluginProcessGDBRemote.a(GDBRemoteCommunicationServer.cpp.o)
  "llvm::Triple::isArch64Bit() const", referenced from:
      CreateProcessInfoResponse_DebugServerStyle(lldb_private::ProcessInstanceInfo const&, lldb_private::StreamString&) in liblldbPluginProcessGDBRemote.a(GDBRemoteCommunicationServer.cpp.o)
  "llvm::Triple::isArch32Bit() const", referenced from:
      CreateProcessInfoResponse_DebugServerStyle(lldb_private::ProcessInstanceInfo const&, lldb_private::StreamString&) in liblldbPluginProcessGDBRemote.a(GDBRemoteCommunicationServer.cpp.o)
  "llvm::Triple::isArch16Bit() const", referenced from:
      CreateProcessInfoResponse_DebugServerStyle(lldb_private::ProcessInstanceInfo const&, lldb_private::StreamString&) in liblldbPluginProcessGDBRemote.a(GDBRemoteCommunicationServer.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

update lldb-platform

zturner accepted this revision.Nov 14 2014, 7:34 PM
zturner added a reviewer: zturner.
zturner added inline comments.
tools/lldb-platform/CMakeLists.txt
9–14

This looks better. Should liblldb also be a dependency instead of just a link library? In other words, I wonder if all this could be merged into the following:

add_dependencies(lldb-platform liblldb ${LLVM_COMMON_DEPENDS})

Otherwise it looks like no dependency is created between lldb-platform and liblldb.

This revision is now accepted and ready to land.Nov 14 2014, 7:34 PM
chilledheart retitled this revision from fix cmake build by linking LLVMSupport to Fix cmake build by linking LLVMSupport.Dec 21 2014, 8:24 AM
chilledheart edited edge metadata.
chilledheart added a comment.EditedFeb 4 2015, 8:22 AM

I think commit 226039 has fix this compilation error when BUILD_SHARED_LIBS=on.

We can close it now.

Edited:

I meant we can abandon it now.

tools/lldb-platform/CMakeLists.txt
9–14

target_link_libraries is sufficient to declare a dependency of liblldb (in a implicit way).

I failed when replacing

if (LLVM_COMMON_DEPENDS)
 add_dependencies(lldb-platform ${LLVM_COMMON_DEPENDS})
endif()

target_link_libraries(lldb-platform liblldb)

with the line

add_dependencies(lldb-platform liblldb ${LLVM_COMMON_DEPENDS})

errors are post below:

[1/1] Re-running CMake...
-- Target triple: x86_64-apple-darwin13.4.0
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx enabled.
-- Go bindings enabled.
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting AArch64
-- Targeting ARM
-- Targeting CppBackend
-- Targeting Hexagon
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting R600
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting X86
-- Targeting XCore
-- Clang version: 3.6.0
-- LLDB version: 3.6.0
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/chilledheart/llvm-trunk/build-lldb
[1/3] cd /Users/chilledheart/llvm-trunk/build-lldb/tools/lldb/scripts && echo -n
-n
[2/3] Linking CXX executable bin/lldb-platform-3.6.0
FAILED: : && /usr/bin/clang++  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual  -stdlib=libc++ -march=native -fdiagnostics-format=vi -fdiagnostics-show-category=name -fcolor-diagnostics -pedantic -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Woverloaded-virtual -fno-omit-frame-pointer -g -O0 -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register  -fno-exceptions -fno-rtti -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -stdlib=libc++     -Wl,-dead_strip tools/lldb/tools/lldb-platform/CMakeFiles/lldb-platform.dir/lldb-platform.cpp.o  -o bin/lldb-platform-3.6.0  lib/libLLVMSupport.dylib -Wl,-rpath,@executable_path/../lib && :
Undefined symbols for architecture x86_64:
  "lldb_private::Mutex::Locker::Locker(lldb_private::Mutex&)", referenced from:
      lldb_private::StreamTee::GetStreamAtIndex(unsigned int) in lldb-platform.cpp.o
  "lldb_private::Error::Error()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Debugger::Initialize(llvm::sys::DynamicLibrary (*)(std::__1::shared_ptr<lldb_private::Debugger> const&, lldb_private::FileSpec const&, lldb_private::Error&))", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Debugger::SetOutputFileHandle(__sFILE*, bool)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Debugger::CreateInstance(void (*)(char const*, void*), void*)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Debugger::SetInputFileHandle(__sFILE*, bool)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::CommandReturnObject::CommandReturnObject()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, lldb_private::ExecutionContext*, bool, bool)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::OptionParser::GetShortOptionString(option*)", referenced from:
      _main in lldb-platform.cpp.o
  "GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(bool)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::ConnectionFileDescriptor::ConnectionFileDescriptor()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Communication::SetConnection(lldb_private::Connection*)", referenced from:
      _main in lldb-platform.cpp.o
  "GDBRemoteCommunicationServer::HandshakeWithClient(lldb_private::Error*)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Error::~Error()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Communication::IsConnected() const", referenced from:
      _main in lldb-platform.cpp.o
  "GDBRemoteCommunicationServer::GetPacketAndSendResponse(unsigned int, lldb_private::Error&, bool&, bool&)", referenced from:
      _main in lldb-platform.cpp.o
  "GDBRemoteCommunicationServer::~GDBRemoteCommunicationServer()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Debugger::SetErrorFileHandle(__sFILE*, bool)", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::CommandReturnObject::~CommandReturnObject()", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Host::SystemLog(lldb_private::Host::SystemLogType, char const*, ...)", referenced from:
      signal_handler(int) in lldb-platform.cpp.o
  "lldb_private::Error::AsCString(char const*) const", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Error::Fail() const", referenced from:
      _main in lldb-platform.cpp.o
  "lldb_private::Mutex::Locker::~Locker()", referenced from:
      lldb_private::StreamTee::GetStreamAtIndex(unsigned int) in lldb-platform.cpp.o
  "lldb_private::StreamString::GetData() const", referenced from:
      lldb_private::CommandReturnObject::GetOutputData() in lldb-platform.cpp.o
  "lldb_private::Debugger::Terminate()", referenced from:
      _main in lldb-platform.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
9–14

ping?

chilledheart abandoned this revision.Mar 21 2015, 10:58 AM