[cfe-dev] clang and Crypto++

Douglas Gregor dgregor at apple.com
Wed Jan 5 09:31:14 PST 2011


On Jan 5, 2011, at 9:06 AM, Marshall Clow wrote:

> After Doug fixed bug #7851 yesterday (thanks, Doug!), I decided to see if crypto++ <http://www.cryptopp.com/> would build with clang TOT.
> 
> Answer: No, it does not.
> 
> There are three problems:
> 
> 1) the crypto++ sources make unqualified calls to member functions in base classes; clang flags this as an error.
> 
>> clang++ -DNDEBUG -g -O2 -arch x86_64 -arch i386 -DCRYPTOPP_DISABLE_ASM -pipe -c panama.cpp
>> panama.cpp:425:2: error: use of undeclared identifier 'PadLastBlock'
>>       PadLastBlock(this->BLOCKSIZE, 0x01);
>>       ^
>>       this->
>> panama.cpp:500:22: note: in instantiation of member function
>>     'CryptoPP::Weak::PanamaHash<CryptoPP::EnumToType<CryptoPP::ByteOrder, 1>
>>> ::TruncatedFinal' requested here
>> template class Weak::PanamaHash<BigEndian>;
>>                    ^
>> In file included from panama.cpp:9:
>> In file included from ./panama.h:5:
>> ./iterhash.h:38:7: note: must qualify identifier to find this declaration in dependent
>>     base class
>>       void PadLastBlock(unsigned int lastBlockSize, byte padFirst=0x80);
>>            ^
>> panama.cpp:425:2: error: no member named 'PadLastBlock' in
>>     'CryptoPP::Weak::PanamaHash<LittleEndian>'
>>       PadLastBlock(this->BLOCKSIZE, 0x01);
>>       ^~~~~~~~~~~~
>> panama.cpp:501:22: note: in instantiation of member function
>>     'CryptoPP::Weak::PanamaHash<CryptoPP::EnumToType<CryptoPP::ByteOrder, 0>
>>> ::TruncatedFinal' requested here
>> template class Weak::PanamaHash<LittleEndian>;
>>                    ^
>> In file included from panama.cpp:9:
>> In file included from ./panama.h:4:
>> In file included from ./strciphr.h:31:
>> In file included from ./seckey.h:9:
> 
> This is easy to fix in crypto++; just follow the fixit hint (and I have submitted these changes to the crypto++ project)
> 
> 2) clang asserts when compiling vmac.cpp <http://llvm.org/bugs/show_bug.cgi?id=8913>

This looks like an easy fix for someone familiar with LLVM's debug info generator.

> 3) clang is much, much slower than gcc 4.2.1 when building crypto++.
> On my 2007 MacPro:
> 	gcc takes 8m40s to build.
> 	clang (TOT this morning) takes much longer; there is one file - sha.cpp which takes over 30 minutes, if it ever does finish, but all the other files combined take more than 45 minutes.


Naturally, we'd like to know where in clang this time is going. Is it the front end (-fsyntax-only)? The optimizer (> -O0), and if so, which one(s)?

  - Doug



More information about the cfe-dev mailing list