LLVM build error

Hi,

While attempting to build the LLVM code from CVS today using gcc 4.1, I encountered the following error. Any idea how to proceed with the build?

llvm[2]: Linking Debug executable llvm-as
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMAsmParser.a(llvmAsmParser.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(Writer.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(Writer.o): In function `llvm::WriteBytecodeToFile(llvm::Module const*, std::basic_ostream<char, std::char_traits<char> >&, bool)':
/home/ll/repositories/cvs/llvm/lib/Bytecode/Writer/Writer.cpp:1224: undefined reference to `llvm::sys::Program::ChangeStdoutToBinary()'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(Writer.o): In function `StatisticBase':
/home/ll/repositories/cvs/llvm/include/llvm/ADT/Statistic.h:37: undefined reference to `vtable for llvm::StatisticBase'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(Writer.o): In function `~Statistic':
/home/ll/repositories/cvs/llvm/include/llvm/ADT/Statistic.h:73: undefined reference to `llvm::StatisticBase::~StatisticBase()'
/home/ll/repositories/cvs/llvm/include/llvm/ADT/Statistic.h:73: undefined reference to `llvm::StatisticBase::~StatisticBase()'
/home/ll/repositories/cvs/llvm/include/llvm/ADT/Statistic.h:73: undefined reference to `llvm::StatisticBase::~StatisticBase()'
/home/ll/repositories/cvs/llvm/include/llvm/ADT/Statistic.h:73: undefined reference to `llvm::StatisticBase::~StatisticBase()'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(Writer.o):(.rodata._ZTIN4llvm9StatisticIjEE[typeinfo for llvm::Statistic<unsigned int>]+0x10): undefined reference to `typeinfo for llvm::StatisticBase'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMBCWriter.a(SlotCalculator.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMCore.a(AsmWriter.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMCore.a(Function.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/IntrinsicInst.h:321: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMCore.a(InlineAsm.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMCore.a(IntrinsicInst.o): In function `__static_initialization_and_destruction_0':
/home/ll/repositories/cvs/llvm/include/llvm/IntrinsicInst.h:321: undefined reference to `llvm::IncludeFile::IncludeFile(void*)'
/home/ll/programs/source/scm/cvs/llvm/Debug/lib/libLLVMCore.a(Verifier.o):/home/ll/repositories/cvs/llvm/include/llvm/InlineAsm.h:133: more undefined references to `llvm::IncludeFile::IncludeFile(void*)' follow
collect2: ld returned 1 exit status
make[2]: *** [/home/ll/programs/source/scm/cvs/llvm/Debug/bin/llvm-as] Error 1
make[2]: Leaving directory `/home/ll/programs/source/scm/cvs/llvm/tools/llvm-as'
make[1]: *** [llvm-as/.makeall] Error 2
make[1]: Leaving directory `/home/ll/programs/source/scm/cvs/llvm/tools'
make: *** [all] Error 1

It looks to me like your libLLVMSupport.a didn't get built or you didn't
update all of LLVM. Please make sure you update from the root of the
tree with the command:

cvs update -ARPd

Reid.

Reid Spencer wrote:

It looks to me like your libLLVMSupport.a didn't get built or you didn't
update all of LLVM. Please make sure you update from the root of the
tree with the command:

cvs update -ARPd

Reid.

Thanks for the quick response.

I have resolved my problem already - basically I had "-s" in my CFLAGS/CXXFLAGS environment which configure put in the Makefiles and screwed up the build. libLLVMSupport did get build, with the IncludeFile.o object (verified with nm), but with -s it confused ld -r at some point! (Perhaps a configure check can be added for this flag to save future hair-pulling)

In any case, I removed the CFLAGS variable and am currently building (it seems to be going well).

Thanks for the help,
LL

I have resolved my problem already - basically I had "-s" in my
CFLAGS/CXXFLAGS environment which configure put in the Makefiles and
screwed up the build.

You mean the Makefile system honored your request to use non-standard
CFLAGS and CXXFLAGS. The build went fine. It just didn't produce what
you were hoping for.

libLLVMSupport did get build, with the
IncludeFile.o object (verified with nm), but with -s it confused ld -r
at some point!

The -s option tells the linker to strip *all* symbol information from
the file, not just debug symbols. Use -S (capital S) to remove debug
symbols. When you strip all symbols, there's nothing to link against
and I would expect it to produce the result you got, or worse.

(Perhaps a configure check can be added for this flag to
save future hair-pulling)

There are hundreds of options that can screw up a build. When
developer's stray from the recommended build procedures, they will have
to deal with the consequences themselves.

I'm sorry for the trouble it caused, but there isn't much we can do to
prevent you from shooting yourself in the foot. :slight_smile: I've been there,
done that kind of thing before and know about the wasted time, etc. I
usually just chalk it up to a learning experience.

In any event, what were you trying to accomplish with the use of the -s
flag? Perhaps there's another way to do it.

In any case, I removed the CFLAGS variable and am currently building (it
seems to be going well).

Great! Glad its working now.

Reid.

Reid Spencer wrote:

I'm sorry for the trouble it caused, but there isn't much we can do to
prevent you from shooting yourself in the foot. :slight_smile: I've been there,
done that kind of thing before and know about the wasted time, etc. I
usually just chalk it up to a learning experience.

In any event, what were you trying to accomplish with the use of the -s
flag? Perhaps there's another way to do it.

Heh, no I didn't add it there on purpose. The whole reason I am playing with LLVM is to try coax every last bit of performance out of this program I have been using a lot lately, and among my attempts to do so, I played with gcc flags, which I forgot to unset from my environment when I went on to build LLVM... silly mistake on my part.

(I am not in the habit of running stripped binaries, its just that for a program that takes 26 minutes to run each time, even a 1% speed boost is very welcome, which is why I employed more aggressive compiler optimizations.)

Anyway, LLVM is fantastic. Thanks to all the developers for the great work, and sorry for the noise on the mailing list. My problem has been resolved and I learned a lot about LLVM in the process. Now onto cachegrind...

Thanks for the help,
LL