Linker errors on MacOSX this morning?

I just updated all my repos and I’m seeing this when I build lldb-tool using the Xcode solution:

Undefined symbols for architecture x86_64:

“llvm::ConstantExpr::getGetElementPtr(llvm::Constant*, llvm::ArrayRefllvm::Value*, bool)”, referenced from:

llvm::ConstantExpr::getGetElementPtr(llvm::Constant*, llvm::ArrayRefllvm::Constant*, bool) in liblldb-core.a(IRForTarget.o)

(maybe you meant: __ZN4llvm12ConstantExpr16getGetElementPtrEPNS_8ConstantENS_8ArrayRefIPNS_5ValueEEEbPNS_4TypeE)

“llvm::ConstantExpr::getBitCast(llvm::Constant*, llvm::Type*)”, referenced from:

IRForTarget::RewriteObjCConstString(llvm::GlobalVariable*, llvm::GlobalVariable*) in liblldb-core.a(IRForTarget.o)

IRForTarget::RewriteObjCSelector(llvm::Instruction*) in liblldb-core.a(IRForTarget.o)

IRForTarget::BuildRelocation(llvm::Type*, unsigned long long) in liblldb-core.a(IRForTarget.o)

IRForTarget::ReplaceStrings() in liblldb-core.a(IRForTarget.o)

(maybe you meant: __ZN4llvm12ConstantExpr10getBitCastEPNS_8ConstantEPNS_4TypeEb)

“llvm::ConstantExpr::getIntToPtr(llvm::Constant*, llvm::Type*)”, referenced from:

IRForTarget::BuildFunctionPointer(llvm::Type*, unsigned long long) in liblldb-core.a(IRForTarget.o)

IRForTarget::RewriteObjCConstString(llvm::GlobalVariable*, llvm::GlobalVariable*) in liblldb-core.a(IRForTarget.o)

IRForTarget::RewriteObjCSelector(llvm::Instruction*) in liblldb-core.a(IRForTarget.o)

IRForTarget::HandleSymbol(llvm::Value*) in liblldb-core.a(IRForTarget.o)

IRForTarget::HandleObjCClass(llvm::Value*) in liblldb-core.a(IRForTarget.o)

IRForTarget::CompleteDataAllocation() in liblldb-core.a(IRForTarget.o)

(maybe you meant: __ZN4llvm12ConstantExpr11getIntToPtrEPNS_8ConstantEPNS_4TypeEb)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is anyone else seeing this?

You might want to nuke your lldb/llvm-build folder and try again. Sometimes when updating the dependencies aren't tracked 100% and can result in bad .a files from the llvm build.

I think Jason also mentioned in another thread that this was necessary and don’t waste time tracking it down.

Didn’t seem to fix it. Still getting the same errors.

Did you also do a Build|Clean?

So full steps:
(command line)
cd lldb
rm -rf llvm-build

(back in Xcode)
Product>Clean
Cmd-B

?

I will try that. One thing I did yesterday was try to make a change to llvm. To do this I went into my lldb/llvm directory, created a build directory, and from inside there generated an Xcode project for just the llvm / clang stuff, and built llvm using this. Is it possible that it installed itself somewhere in a way that conflicts what what I’m trying to do using the LLDB xcode build?

(above my pay grade… I defer…)

The Xcode project will check out the sources for you into:

lldb/llvm

If they aren't already there. Then it will create lldb/lldb-build and configure/build into that directory in a way that works for multiple architectures.

So making a build folder inside llvm might work for you, but it won't be used by Xcode. If you want to do manual builds you can cd into:

lldb/llvm-build/Release+Asserts/x86_64

Then run make from there.

It works now, after Todd’s suggestion. rm -rf llvm-build wasn’t sufficient, I also had to clean the Xcode project. Thanks!

Glad you’re up and running!

Jason actually saved me here. I would have otherwise investigated for the loss.

If header files change, Xcode has some dependency tracking issues that are being tracked by a bug report I filed and was able to help the Xcode team diagnose. So doing a Clean when you run into link errors is always a good idea.