Build error for Release+Asserts with a clean repo from clang

I started seeing this a few days back, it is probably related to my setup.

Debug+Asserts builds fine.
But for Release+Asserts, I got:
Undefined symbols for architecture x86_64:
  "clang::Decl::dump() const", referenced from:
      clang::ASTContext::DumpRecordLayout(clang::RecordDecl const*, llvm::raw_ostream&, bool) const in libclangAST.a(RecordLayoutBuilder.o)
      clang::arcmt::trans::MigrationContext::dumpGCAttrs() in libclangARCMigrate.a(TransGCAttrs.o)
      clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) in libclangCodeGen.a(CGRecordLayoutBuilder.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any idea how to fix this?

Thanks,
Manman

+alexfh

I started seeing this a few days back, it is probably related to my setup.

Debug+Asserts builds fine.
But for Release+Asserts, I got:
Undefined symbols for architecture x86_64:
  "clang::Decl::dump() const", referenced from:
      clang::ASTContext::DumpRecordLayout(clang::RecordDecl const*, llvm::raw_ostream&, bool) const in libclangAST.a(RecordLayoutBuilder.o)
      clang::arcmt::trans::MigrationContext::dumpGCAttrs() in libclangARCMigrate.a(TransGCAttrs.o)
      clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::StructType*) in libclangCodeGen.a(CGRecordLayoutBuilder.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Alex, this might be related to your change? It looks like
http://llvm-reviews.chandlerc.com/rL160788 was intended to fix this?

Cheers,
/Manuel

+alexfh

>
> I started seeing this a few days back, it is probably related to my
setup.
>
> Debug+Asserts builds fine.
> But for Release+Asserts, I got:
> Undefined symbols for architecture x86_64:
> "clang::Decl::dump() const", referenced from:
> clang::ASTContext::DumpRecordLayout(clang::RecordDecl const*,
llvm::raw_ostream&, bool) const in libclangAST.a(RecordLayoutBuilder.o)
> clang::arcmt::trans::MigrationContext::dumpGCAttrs() in
libclangARCMigrate.a(TransGCAttrs.o)
>
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*) in libclangCodeGen.a(CGRecordLayoutBuilder.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Alex, this might be related to your change? It looks like
http://llvm-reviews.chandlerc.com/rL160788 was intended to fix this?

This commit was intended to fix debug-time issue and shouldn't affect
builds. But it may be a problem with stale .o files. Manman, did you try to
run *make clean* before building?

Err, didn’t notice the “with a clean repo” part in the message title. But still I can’t see how my change can affect builds.

+alexfh

>
> I started seeing this a few days back, it is probably related to my
> setup.
>
> Debug+Asserts builds fine.
> But for Release+Asserts, I got:
> Undefined symbols for architecture x86_64:
> "clang::Decl::dump() const", referenced from:
> clang::ASTContext::DumpRecordLayout(clang::RecordDecl const*,
> llvm::raw_ostream&, bool) const in libclangAST.a(RecordLayoutBuilder.o)
> clang::arcmt::trans::MigrationContext::dumpGCAttrs() in
> libclangARCMigrate.a(TransGCAttrs.o)
>
> clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
> llvm::StructType*) in libclangCodeGen.a(CGRecordLayoutBuilder.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)

Alex, this might be related to your change? It looks like
http://llvm-reviews.chandlerc.com/rL160788 was intended to fix this?

This commit was intended to fix debug-time issue and shouldn't affect
builds.

But it may be a problem with stale .o files. Manman, did you try to run
make clean before building?

Err, didn't notice the "with a clean repo" part in the message title. But
still I can't see how my change can affect builds.

Just tested it on linux, and it works for me (all I passed to
configure was --enable-optimized.

Cheers,
/Manuel

Thanks for the replies.

I got a clean repo for llvm+clang+… and created build directories for Debug and Release. For Release, I used "../llvm/configure --enable-optimized --with-externals=/Users/mren/llvm-mren/llvm/projects/external-tests/".

I also did "make clean" and "make update"
make clean
llvm[1]: Constructing LLVMBuild project information.
Manmans-MacBook-Air:build-opt mren$ make update
svn update /Users/mren/llvm-mren/llvm
U /Users/mren/llvm-mren/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll
A /Users/mren/llvm-mren/llvm/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/break-sse-dep.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/vec_compare.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/sse-minmax.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/fold-load.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/2012-05-19-avx2-store.ll
U /Users/mren/llvm-mren/llvm/test/CodeGen/X86/fold-pcmpeqd-1.ll
U /Users/mren/llvm-mren/llvm/include/llvm/Target/TargetInstrInfo.h
U /Users/mren/llvm-mren/llvm/include/llvm/ADT/APInt.h
U /Users/mren/llvm-mren/llvm/utils/TableGen/X86RecognizableInstr.cpp
U /Users/mren/llvm-mren/llvm/lib/Analysis/ConstantFolding.cpp
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrInfo.h
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrExtension.td
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrMMX.td
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrInfo.cpp
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrSSE.td
U /Users/mren/llvm-mren/llvm/lib/Target/X86/X86InstrFormats.td
U /Users/mren/llvm-mren/llvm/lib/CodeGen/PeepholeOptimizer.cpp
Updated to revision 160960.
Password:
At revision 474.
At revision 160960.
U /Users/mren/llvm-mren/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_clock.cc
U /Users/mren/llvm-mren/llvm/projects/compiler-rt/lib/asan/asan_mac.cc
Updated to revision 160960.
U /Users/mren/llvm-mren/llvm/tools/clang/test/Driver/freebsd.c
U /Users/mren/llvm-mren/llvm/tools/clang/test/Driver/linux-ld.c
U /Users/mren/llvm-mren/llvm/tools/clang/test/SemaCXX/microsoft-cxx0x.cpp
U /Users/mren/llvm-mren/llvm/tools/clang/include/clang/Basic/SourceManager.h
U /Users/mren/llvm-mren/llvm/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
U /Users/mren/llvm-mren/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp
U /Users/mren/llvm-mren/llvm/tools/clang/lib/Sema/SemaExprObjC.cpp
U /Users/mren/llvm-mren/llvm/tools/clang/lib/Driver/Tools.cpp
U /Users/mren/llvm-mren/llvm/tools/clang/lib/ASTMatchers/ASTMatchFinder.cpp
Updated to revision 160960.
Manmans-MacBook-Air:build-opt mren$ make -j2

Still got the same error :slight_smile:

I figured it is probably related to my setup, since nobody else has complained.

Thanks,
Manman

I tried about 6 ways just now of trying to duplicate this and failed so I'll come over and take a look if you'd like :slight_smile:

-eric

Thanks a lot, Eric.

My Pro works fine. Please come over if you have time.

Manman