[Botan-devel] Fwd: Linking with botan makes my application crash?

Jack Lloyd lloyd at randombit.net
Tue Jan 12 07:31:45 EST 2010

On Tue, Jan 12, 2010 at 07:38:57AM +0100, Steven Van Ingelgem wrote:

> I am using WinXP/SP3, VS2008 express and botan 1.9.3.
> I recompiled botan with these switches: configure.py --cpu=ia32 --cc=msvc
> *1) *The first thing I noticed compared to the "configure.py"-autoguessing
> way is that the configure says the target is "msvc-windows-ia32-ia32"
> instead of "msvc-windows-ia32-i686". And suddenly "cpu_counter" is not
> incompatible anymore with (the same version of) MSVC?

This is a change in configure.py vs configure.pl's behavior. If
given a generic architecture name, like x86/ia32, configure.pl
would assume this means some particular common submodel of the
arch (in this case 686); it was not possible to target an
architecture in general, compiling to work on all implementations
of said arch. So given just ia32, configure assumes that the CPU
doesn't have RDTSC (since that wasn't added until Pentium
MMX/Pentium Pro, IIRC), and doesn't load cpu_counter. If you want
specifically i686, say so with --cpu=i686.

However, something else perhaps is going on, because cpu_counter
actually is not compatible with MSVC at all; it uses GCC-style
inline asm, which VC does not support. Testing a local copy,
going from --cpu=ia32 to --cpu=i686 just changes the reason for
cpu_counter being disabled from "Skipping mod because CPU
incompatible" to "Skipping mod because compiler incompatible".

> *2)* After linking with my program, the program just crashes even before it
> enters "main()". When compiling with botan 1.8.8 (with the slight
> modification of using "cl.exe /MD" instead of "cl.exe"), it at least let me
> enter the main() function in my program.

Hm. That's pretty unpleasant. Did the self-test program build/run
correctly? This smells like another obnoxious runtime A vs runtime B
problem. Did some part get compiled with debug on and some part not?
Apparently MS' runtimes can't even handle something that simple
without recompiling everything.


More information about the botan-devel mailing list