Problem building llvm after r109996 (Add InitializeNativeTargetAsmPrinter())


After I try making a clean build and got the following error:

llvm[3]: Compiling EDDisassembler.cpp for Release build
In file included from /llvm/include/llvm/Target/TargetSelect.h:38,
                 from /llvm/lib/MC/MCDisassembler/EDDisassembler.cpp:37:
/llvm/stage1/include/llvm/Config/AsmPrinters.def: In function ‘void LLVMInitializeX86TargetAsmPrinter()’:
/llvm/stage1/include/llvm/Config/AsmPrinters.def:27: error: redefinition of ‘void LLVMInitializeX86TargetAsmPrinter()’
/llvm/stage1/include/llvm/Config/AsmPrinters.def:27: error: ‘void LLVMInitializeX86TargetAsmPrinter()’ previously defined here
make[3]: *** [/llvm/stage1/lib/MC/MCDisassembler/Release/EDDisassembler.o] Error 1

==== config

Darwin10 x86_64 (and llvm-gcc from Xcode 3.2.3).

../configure --prefix=/opt/llvm-selfhost --without-llvmgcc --without-llvmgxx --disable-bindings --disable-assertions --enable-optimized --enable-targets=x86,x86_64 CC=llvm-gcc CXX=llvm-g++

Hi Jean-Daniel,

My fault, I'm sure, but I don't see the problem yet.

Is it possible your version of llvm/Config/AsmPrinters.def has X86 listed twice?

- Daniel

The problem is with llvm/Config/Targets.def

If you pass --enable-targets=x86,x86_64 in the configure invocation, the generated Targets.def file contains 2 times LLVM_TARGET(X86) as they map both to the same native target.

If you don't use the '--enable-targets=' option while configuring LLVM, LLVM_TARGET(X86) is inserted only once, that's why it works.

I guess that until the change introduce by r109996, all files where gracefully handling the duplicate entry.

I think I can safely workaround this issue by removing either x86 or x86_64 in my configure invocation.