[Botan-devel] Concise MSVS Build Instructions?

Jack Lloyd lloyd at randombit.net
Thu Jun 3 08:21:43 EDT 2010


On Thu, Jun 03, 2010 at 05:38:50AM +0000, larry_lindstrom at comcast.net wrote:
> 1>C:...\headers\botan/symkey.h(43) : warning C4251: 'Botan::OctetString::bits' : class 'Botan::SecureVector<T>' needs to have dll-interface to be used by clients of class 'Botan::OctetString' 
> 1> with 
> 1> [ 
> 1> T=Botan::byte 
> 1> ] 
> 1>C:...\headers\botan/sym_algo.h(49) : warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) 

These are both harmless as far as I've been able to determine; 4251 is
basically saying we didn't mark the template as dllexport, but you
wouldn't actually want to do this for a template. This warning is
suppressed in development releases with a pragma.

4290 is basically just saying that throw specifications are being
ignored, which is harmless enough. And actually due to problems with
using C++ exception specifications, they have also been removed in 1.9
releases.

You can disable them using the /wNNNN command line option, or with a
pragma.

> 1>Linking... 
> 1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$?HDU?$char_traits at D@std@@V?$allocator at D@1@@std@@YA?AV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0 at PBDABV10@@Z) already defined in libbotan.lib(stream_cipher.obj) 
> 
> 1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::operator+<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (??$?HDU?$char_traits at D@std@@V?$allocator at D@1@@std@@YA?AV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0 at ABV10@PBD at Z) already defined in libbotan.lib(stream_cipher.obj) 
> 
> 1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "protected: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Myptr(void)const " (?_Myptr@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@IBEPBDXZ) already defined in libbotan.lib(stream_cipher.obj) 
> 
> What am I doing wrong? 

Double definition errors like this are almost always due to using
different C++ runtime libraries between the library and some other
application. It doesn't particularly matter which one you use, but
they must be the same or it doesn't work. A basic rundown of the
options:
  http://msdn.microsoft.com/en-us/library/abx4dbyh%28VS.80%29.aspx

> The documentation that accompanies 1.8.8 seems a bit dated.

This is the nice way of putting it. :(

> Should I expect to see a DLL after running this script? I searched,
> and found no DLLs in the Botan folder. There is a file at >
> src/build-data/cc/msvc.txt that looks like it might be providing
> some direction on building a DLL, but I don't know Python, or nmake,
> so I don't know if I need to do something with this file.

No, not in 1.8 currently. In 1.9 a DLL is built by default (unless you
use --disable-shared). This hasn't been backported to 1.8 yet, though.
The msvc.txt file is read by configure.py

I'm getting the sense that 1.8 is maybe actually somewhat broken on
Windows right now, with some half-finished DLL work that I never got
around to backporting. Since there is no reason to set
declspec(dllexport) in a static build...

-Jack



More information about the botan-devel mailing list