[lldb-dev] Building LLDB when LLVM is built with threading disabled

Keno Fischer kfischer at college.harvard.edu
Wed Sep 10 10:09:45 PDT 2014


This is copied from a user who sent me his error message, but I saw
the same (the errors can be fixed by linking in -lpthread manually, so
it's probably just a make system issue):

llvm[6]: Linking Release+Asserts Shared Library liblldb.so
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbExpression.a(ClangExpressionParser.o):
In function `lldb_private::ClangExpressionParser::Parse(lldb_private::Stream&)':
ClangExpressionParser.cpp:(.text._ZN12lldb_private21ClangExpressionParser5ParseERNS_6StreamE+0x397):
warning: the use of `mktemp' is dangerous, better use `mkstemp' or
`mkdtemp'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::OperationArgs::OperationArgs(lldb_private::NativeProcessLinux*)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux13OperationArgsC2EPS0_+0x1a):
undefined reference to `sem_init'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::OperationArgs::~OperationArgs()':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux13OperationArgsD2Ev+0x9):
undefined reference to `sem_destroy'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::ServeOperation(lldb_private::NativeProcessLinux::OperationArgs*)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14ServeOperationEPNS0_13OperationArgsE+0xd):
undefined reference to `sem_post'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14ServeOperationEPNS0_13OperationArgsE+0x24):
undefined reference to `sem_wait'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14ServeOperationEPNS0_13OperationArgsE+0x6c):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::DoOperation(void*)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux11DoOperationEPv+0x36):
undefined reference to `sem_post'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux11DoOperationEPv+0x4e):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::StopMonitor()':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux11StopMonitorEv+0x19):
undefined reference to `sem_destroy'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux11StopMonitorEv+0x26):
undefined reference to `sem_destroy'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::LaunchInferior(lldb_private::Module*,
char const**, char const**, char const*, char const*, char const*,
char const*, lldb_private::ProcessLaunchInfo const&,
lldb_private::Error&)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14LaunchInferiorEPNS_6ModuleEPPKcS5_S4_S4_S4_S4_RKNS_17ProcessLaunchInfoERNS_5ErrorE+0xd1):
undefined reference to `sem_init'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14LaunchInferiorEPNS_6ModuleEPPKcS5_S4_S4_S4_S4_RKNS_17ProcessLaunchInfoERNS_5ErrorE+0xe1):
undefined reference to `sem_init'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14LaunchInferiorEPNS_6ModuleEPPKcS5_S4_S4_S4_S4_RKNS_17ProcessLaunchInfoERNS_5ErrorE+0x116):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::AttachToInferior(unsigned
long, lldb_private::Error&)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux16AttachToInferiorEmRNS_5ErrorE+0x1bb):
undefined reference to `sem_init'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux16AttachToInferiorEmRNS_5ErrorE+0x1cc):
undefined reference to `sem_init'
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux16AttachToInferiorEmRNS_5ErrorE+0x222):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::LaunchOpThread(void*)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14LaunchOpThreadEPv+0x25):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(NativeProcessLinux.o):
In function `lldb_private::NativeProcessLinux::AttachOpThread(void*)':
NativeProcessLinux.cpp:(.text._ZN12lldb_private18NativeProcessLinux14AttachOpThreadEPv+0x25):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::OperationArgs::OperationArgs(ProcessMonitor*)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor13OperationArgsC2EPS_+0x1a):
undefined reference to `sem_init'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::OperationArgs::~OperationArgs()':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor13OperationArgsD2Ev+0x9):
undefined reference to `sem_destroy'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::ServeOperation(ProcessMonitor::OperationArgs*)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor14ServeOperationEPNS_13OperationArgsE+0xd):
undefined reference to `sem_post'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor14ServeOperationEPNS_13OperationArgsE+0x24):
undefined reference to `sem_wait'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor14ServeOperationEPNS_13OperationArgsE+0x69):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::DoOperation(Operation*)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor11DoOperationEP9Operation+0x2a):
undefined reference to `sem_post'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor11DoOperationEP9Operation+0x3e):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::StopMonitor()':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor11StopMonitorEv+0x16):
undefined reference to `sem_destroy'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor11StopMonitorEv+0x20):
undefined reference to `sem_destroy'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::ProcessMonitor(ProcessPOSIX*,
lldb_private::Module*, char const**, char const**, char const*, char
const*, char const*, char const*, lldb_private::ProcessLaunchInfo
const&, lldb_private::Error&)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXPN12lldb_private6ModuleEPPKcS7_S6_S6_S6_S6_RKNS2_17ProcessLaunchInfoERNS2_5ErrorE+0xd3):
undefined reference to `sem_init'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXPN12lldb_private6ModuleEPPKcS7_S6_S6_S6_S6_RKNS2_17ProcessLaunchInfoERNS2_5ErrorE+0xe0):
undefined reference to `sem_init'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXPN12lldb_private6ModuleEPPKcS7_S6_S6_S6_S6_RKNS2_17ProcessLaunchInfoERNS2_5ErrorE+0x116):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::ProcessMonitor(ProcessPOSIX*, unsigned
long, lldb_private::Error&)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXmRN12lldb_private5ErrorE+0x50):
undefined reference to `sem_init'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXmRN12lldb_private5ErrorE+0x5d):
undefined reference to `sem_init'
ProcessMonitor.cpp:(.text._ZN14ProcessMonitorC2EP12ProcessPOSIXmRN12lldb_private5ErrorE+0xae):
undefined reference to `sem_wait'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::LaunchOpThread(void*)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor14LaunchOpThreadEPv+0x25):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbPluginProcessLinux.a(ProcessMonitor.o):
In function `ProcessMonitor::AttachOpThread(void*)':
ProcessMonitor.cpp:(.text._ZN14ProcessMonitor14AttachOpThreadEPv+0x25):
undefined reference to `sem_post'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `MonitorChildProcessThreadFunction(void*)':
Host.cpp:(.text._ZL33MonitorChildProcessThreadFunctionPv+0xf3):
undefined reference to `pthread_testcancel'
Host.cpp:(.text._ZL33MonitorChildProcessThreadFunctionPv+0x10b):
undefined reference to `pthread_testcancel'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadCreate(char const*, void*
(*)(void*), void*, lldb_private::Error*)':
Host.cpp:(.text._ZN12lldb_private4Host12ThreadCreateEPKcPFPvS3_ES3_PNS_5ErrorE+0x63):
undefined reference to `pthread_create'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadCancel(unsigned long,
lldb_private::Error*)':
Host.cpp:(.text._ZN12lldb_private4Host12ThreadCancelEmPNS_5ErrorE+0xa):
undefined reference to `pthread_cancel'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadDetach(unsigned long,
lldb_private::Error*)':
Host.cpp:(.text._ZN12lldb_private4Host12ThreadDetachEmPNS_5ErrorE+0xa):
undefined reference to `pthread_detach'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadJoin(unsigned long, void**,
lldb_private::Error*)':
Host.cpp:(.text._ZN12lldb_private4Host10ThreadJoinEmPPvPNS_5ErrorE+0xa):
undefined reference to `pthread_join'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadLocalStorageCreate(void
(*)(void*))':
Host.cpp:(.text._ZN12lldb_private4Host24ThreadLocalStorageCreateEPFvPvE+0xd):
undefined reference to `pthread_key_create'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadLocalStorageGet(unsigned int)':
Host.cpp:(.text._ZN12lldb_private4Host21ThreadLocalStorageGetEj+0x1):
undefined reference to `pthread_getspecific'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Host.o):
In function `lldb_private::Host::ThreadLocalStorageSet(unsigned int,
void*)':
Host.cpp:(.text._ZN12lldb_private4Host21ThreadLocalStorageSetEjPv+0x1):
undefined reference to `pthread_setspecific'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Mutex.o):
In function `lldb_private::Mutex::Mutex(lldb_private::Mutex::Type)':
Mutex.cpp:(.text._ZN12lldb_private5MutexC2ENS0_4TypeE+0x4c): undefined
reference to `pthread_mutexattr_init'
Mutex.cpp:(.text._ZN12lldb_private5MutexC2ENS0_4TypeE+0x7a): undefined
reference to `pthread_mutexattr_destroy'
Mutex.cpp:(.text._ZN12lldb_private5MutexC2ENS0_4TypeE+0xa9): undefined
reference to `pthread_mutexattr_settype'
Mutex.cpp:(.text._ZN12lldb_private5MutexC2ENS0_4TypeE+0xd6): undefined
reference to `pthread_mutexattr_settype'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(Mutex.o):
In function `lldb_private::Mutex::TryLock(char const*)':
Mutex.cpp:(.text._ZN12lldb_private5Mutex7TryLockEPKc+0x1): undefined
reference to `pthread_mutex_trylock'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::ProcessRunLock()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLockC2Ev+0x7):
undefined reference to `pthread_rwlock_init'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::~ProcessRunLock()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLockD2Ev+0x1):
undefined reference to `pthread_rwlock_destroy'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::ReadTryLock()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock11ReadTryLockEv+0x5):
undefined reference to `pthread_rwlock_rdlock'
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock11ReadTryLockEv+0x24):
undefined reference to `pthread_rwlock_unlock'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::ReadUnlock()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock10ReadUnlockEv+0x5):
undefined reference to `pthread_rwlock_unlock'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::SetRunning()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock10SetRunningEv+0x5):
undefined reference to `pthread_rwlock_wrlock'
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock10SetRunningEv+0x11):
undefined reference to `pthread_rwlock_unlock'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::TrySetRunning()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock13TrySetRunningEv+0xa):
undefined reference to `pthread_rwlock_trywrlock'
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock13TrySetRunningEv+0x20):
undefined reference to `pthread_rwlock_unlock'
/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldbHostCommon.a(ProcessRunLock.o):
In function `lldb_private::ProcessRunLock::SetStopped()':
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock10SetStoppedEv+0x5):
undefined reference to `pthread_rwlock_wrlock'
ProcessRunLock.cpp:(.text._ZN12lldb_private14ProcessRunLock10SetStoppedEv+0x11):
undefined reference to `pthread_rwlock_unlock'
collect2: error: ld returned 1 exit status
make[6]: *** [/mnt/hdd/mlubin/julia-0.4/deps/llvm-svn/build_Release+Asserts/Release+Asserts/lib/liblldb.so]
Error 1

On Wed, Sep 10, 2014 at 1:00 PM, Zachary Turner <zturner at google.com> wrote:
> Threading should be enabled by default in LLVM, you have to go out of your
> way to disable it.
>
>
> On Tue, Sep 9, 2014 at 5:12 PM, Greg Clayton <gclayton at apple.com> wrote:
>>
>> Because LLVM enables threading manually, this is the main reason we didn't
>> use their locking primitives.
>>
>> I am not sure if we recently started using any of LLVM threading stuff
>> that gets disabled (Zach's changes?) when threading isn't enabled in LLVM,
>> but I don't believe we have enabled threading in LLVM builds.
>>
>> Can you elaborate on what is making the build fail now after you disable
>> threads?
>>
>> > On Sep 9, 2014, at 4:50 PM, Keno Fischer <kfischer at college.harvard.edu>
>> > wrote:
>> >
>> > We build LLVM with threads disabled by default (using make&configure).
>> > Recently this started causing the LLDB build to fail. I'm not sure if
>> > this is because of changes to LLDB or the LLVM build system in general
>> > but it brings me to two questions. First, is it now necessary to build
>> > LLVM with threads enabled to build LLDB? And, second, if not, is it
>> > reasonable to link in pthread even when --disable-threads is passed to
>> > ./configure, since I don't believe LLDB can be built without threading
>> > support entirely?
>> >
>> > Thanks,
>> > Keno
>> > _______________________________________________
>> > lldb-dev mailing list
>> > lldb-dev at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>>
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>



More information about the lldb-dev mailing list