• Create Account

## Build problem with VS 11

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

11 replies to this topic

### #1 wood_brian   Banned

193
Like
0Likes
Like

Posted 08 June 2012 - 09:14 PM

I'm in the process of updating this performance comparison page using the latest version of Boost and newer compilers. I've updated the Linux results already but am having a problem getting a test case to build on Windows. Previously with VS 10 I used:

cl -O2 -I /Users/Store/boost_1_50_0_beta1/ -EHsc bser.cc /link /nodefaultlib:msvcprt /nodefaultlib:libcmt libboost_serialization-vc110-1_50.lib


The include directory was different of course with an earlier version of Boost. When I use that command with VS 11 I get errors like this:
libboost_serialization-vc110-1_50.lib(basic_archive.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in bser.obj

I built the serialization library with this command:

This is on Windows 7. Thanks in advance.

Edited by wood_brian, 11 June 2012 - 02:57 PM.

### #2 wood_brian   Banned

193
Like
0Likes
Like

Posted 14 July 2012 - 03:20 PM

Sorry, but I still haven't figured this out.

### #3mrbastard  Members

1576
Like
0Likes
Like

Posted 14 July 2012 - 04:05 PM

The error message says you are trying to link something using the dynamic (MD) crt with something using the static (MT) one.

Either change your project to use the static crt or (better) build a version of boost dynamically linking the crt.

Edited by mrbastard, 14 July 2012 - 04:07 PM.

### #4 wood_brian   Banned

193
Like
0Likes
Like

Posted 14 July 2012 - 08:20 PM

The error message says you are trying to link something using the dynamic (MD) crt with something using the static (MT) one.

Either change your project to use the static crt or (better) build a version of boost dynamically linking the crt.

I'm using the command line and makefiles. I added /MT when compiling the test case (bser.cc) but got the same errors.

I've always been able to get the tests to build using the static version of the Boost library in the past...

### #5krippy2k8  Members

646
Like
1Likes
Like

Posted 14 July 2012 - 10:56 PM

link=static in your bjam command will build Boost as a static library, but by default I believe it will still use the dynamic CRT library. If you are using the /MT switch in your project, you need to add runtime-link=static to your bjam command so that your boost libraries reference the static version of the CRT.

### #6mrbastard  Members

1576
Like
1Likes
Like

Posted 15 July 2012 - 10:56 AM

And here is a bit more information on the choice of crt, in case you're still lost.

### #7 wood_brian   Banned

193
Like
1Likes
Like

Posted 15 July 2012 - 02:52 PM

link=static in your bjam command will build Boost as a static library, but by default I believe it will still use the dynamic CRT library. If you are using the /MT switch in your project, you need to add runtime-link=static to your bjam command so that your boost libraries reference the static version of the CRT.

I got my testcase to build by rebuilding the boost library with runtime-link=static and then using this command:

cl -O2 -I /Users/Store/boost_1_50_0 -EHsc bser.cc  /link libcpmt.lib  libboost_serialization-vc110-s-1_50.lib


However, the executable is 306176 bytes. The testcase hasn't changed and previously using VC 10, the executable was 160768 bytes. The new executable is also slower than the older version was. On the other hand, the Ebenezer testcase is faster when built with VC 11 than it was with VC 10. Should I do something differently? Why?

### #8mhagain  Members

12440
Like
2Likes
Like

Posted 16 July 2012 - 06:11 AM

In the days of 1TB+ hard disks a ~160k increase in executable size hardly seems worth worrying about, but...

The key difference is that you're now statically linking boost with the CRT. That's going to pull in a whole lot more object code and link it into your executable, so hence you get a bigger executable.

As regards performance, VC11 is more than just a different compiler - it adds new headers, new libs, new everything. This happened before with the jump from 9 to 10 where libcmt.lib (x86 version, for example) went from ~9mb to ~16mb, which means a lot more code, a lot more happening, and consequently different performance characteristics are to be expected.

There's also the matter of VC11 still being pre-release software, so oddities are also to be expected.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

### #9 wood_brian   Banned

193
Like
0Likes
Like

Posted 16 July 2012 - 03:22 PM

In the days of 1TB+ hard disks a ~160k increase in executable size hardly seems worth worrying about, but...

The key difference is that you're now statically linking boost with the CRT. That's going to pull in a whole lot more object code and link it into your executable, so hence you get a bigger executable.

Well, the Boost testcase is now between 2.8 and 3.0 times slower than the equivalent Ebenezer test. The link I referenced in the OP (as of today, still) says the Boost test was between 1.7 and 1.8 times slower than the Ebenezer using Boost 1.48 and VC 10. The testcase hasn't changed and from doing some diffs between Boost 1.48, 1.49 and 1.50, I haven't noticed any changes that would affect the performance of this test.

Iiuc, the way I used to build the boost testcase wasn't by dynamically linking anything, but isn't the same as what I did here either. I'm wondering if there's another way to build things that might yield better results for Boost. I'd like to avoid publishing flawed numbers here. If someone would like to check the numbers -- either on Linux or Windows -- that would be appreciated. I'll be happy to provide an archive of the tests and assistance in getting going.

### #10krippy2k8  Members

646
Like
1Likes
Like

Posted 16 July 2012 - 05:44 PM

FWIW I did a quick test with boost 1.50 on VS10 and VS11 on the same machine using the first Boost test code on your page, with the same settings.

I ran each version several times with a command line of 5000000 (500000 was too close and too small).

VS10
------
File size: 270,336
Clock range: 213-215

VS11
------
File size: 316,416
Clock range: 238-243

So VS11 is roughly 10% slower than VS10 for that test case. Can't say for sure why, but the fact that it is pre-release software as mentioned is likely to have something to do with it.

Edited by krippy2k8, 16 July 2012 - 05:45 PM.

### #11 wood_brian   Banned

193
Like
0Likes
Like

Posted 16 July 2012 - 08:46 PM

So VS11 is roughly 10% slower than VS10 for that test case. Can't say for sure why, but the fact that it is pre-release software as mentioned is likely to have something to do with it.

Thanks. Here VS11 is over 15% slower than VS10 with 5 million for input. The point about the pre-release software may have something to do with it, but I'd like to point out again that the numbers are reversed on the Ebenezer side -- the Ebenezer test with VS10 is over 20% slower than when built with VS11.

Edited by wood_brian, 16 July 2012 - 09:04 PM.

### #12krippy2k8  Members

646
Like
0Likes
Like

Posted 16 July 2012 - 11:40 PM

Obviously you're using different C++ language features and/or library functions. Boost tends to reach into the deeper, darker recesses of C++ metaprogramming, which while inherently fast, typically gets less developer time for optimizations.

Edited by krippy2k8, 16 July 2012 - 11:44 PM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.