Unable to build clang in MacOS 10.5.3

Hi,

I'm trying to build clang on MacOS 10.5.3 (XCode 3.0, i686-apple-darwin9-gcc-4.0.1) but I get the following error:
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const __gnu_debug::_Safe_iterator<_Iterator, _Sequence>&, const char*, __gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:214: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h:220: error: cannot use typeid with -fno-rtti

I commented all the CXX.flags = -fno-rtti and it built. I'm now testing it but I'm checking with you to see if it's a known bug (in llvm's IRC channel no-one knew about the bug, only suggested commenting the -fno-rtti).

Thanks for the help,

   - Filipe Cabecinhas

Hi,

I'm trying to build clang on MacOS 10.5.3 (XCode 3.0, i686-apple-
darwin9-gcc-4.0.1) but I get the following error:
/usr/include/c++/4.0.0/debug/formatter.h: In constructor
'__gnu_debug::_Error_formatter::_Parameter::_Parameter(const
__gnu_debug::_Safe_iterator<_Iterator, _Sequence>&, const char*,
__gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:214: error: cannot use typeid
with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h:220: error: cannot use typeid
with -fno-rtti

I'm not familiar with debug/formatter.h. Can you please include the full error message from the compiler?

-Chris

Hi,

I'm not familiar with debug/formatter.h. Can you please include the full error message from the compiler?

-Chris

Here it is. I uncommented Driver/Makefile and tried to rebuild clang:
...
llvm[1]: Compiling ASTConsumers.cpp for Debug+Checks build
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const __gnu_debug::_Safe_iterator<_Iterator, _Sequence>&, const char*, __gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:214: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h:220: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const _Type*&, const char*, __gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:243: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(_Type*&, const char*, __gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:256: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const _Iterator&, const char*, __gnu_debug::_Error_formatter::_Is_iterator)':
/usr/include/c++/4.0.0/debug/formatter.h:269: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const __gnu_debug::_Safe_sequence<_Sequence>&, const char*, __gnu_debug::_Error_formatter::_Is_sequence)':
/usr/include/c++/4.0.0/debug/formatter.h:285: error: cannot use typeid with -fno-rtti
/usr/include/c++/4.0.0/debug/formatter.h: In constructor '__gnu_debug::_Error_formatter::_Parameter::_Parameter(const _Sequence&, const char*, __gnu_debug::_Error_formatter::_Is_sequence)':
/usr/include/c++/4.0.0/debug/formatter.h:294: error: cannot use typeid with -fno-rtti
make[1]: *** [/Users/filcab/dev/stuff/llvm/llvm/tools/clang/Driver/Debug+Checks/ASTConsumers.o] Error 1
make: *** [all] Error 1

Thanks for the help,

   - Filipe Cabecinhas

You have to turn STL debug mode off, as it requires rtti.

Hi,

Probably related to a line like:

   llvm/Makefile.rules: CPP.Defines += -D_GLIBCXX_DEBUG

if I had to randomly guess. I build on 10.6 and it usually works just fine. Building on 10.5 wasn't much different. If you can explain how exactly you built, maybe someone can spot what you might have done wrong.

I build in separate trees and have clang checked out in the llvm build tree, or something strange like that.

This should only happen if you build with ENABLE_EXPENSIVE_CHECKS=1. Filipe, are you doing this?

-Chris

Hi,

This should only happen if you build with ENABLE_EXPENSIVE_CHECKS=1. Filipe, are you doing this?

-Chris

There it is!

Yes, I enabled expensive checks:

./configure --enable-assertions --enable-expensive-checks --prefix=$HOME/llvm

I'm now doing a ./configure --enable-optimized --prefix=$HOME/llvm
and will report on success or failure.

Thanks for the help,

   - Filipe Cabecinhas

Hi,

It worked. But maybe it would be nice to mention the problem in the documentation. :slight_smile:

Thanks for all the help,

   - Filipe Cabecinhas