Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently found that when I build my C++ software, I get about a 10% speedup by using the g++ march=native option. When compiling gcc and libstc++, is it possible to tune the libstdc++ library to the native architecture as well? I couldn't find any mention of this in the gcc install configuration documentation. (I'm building gcc 4.6.2 on Linux Mint 11 with an Intel Core i7 Sandy Bridge-E processor.)


I normally build libstc++ when I build gcc, e.g. here is exactly what I'm doing and I'm looking to add some tuning options:

$ wget 
$ tar -xzf gcc-4.6.2.tar.gz 
$ mkdir gcc-4.6.2-objdir 
$ cd gcc-4.6.2-objdir/ 
$ ../gcc-4.6.2/configure 
$ make
# make install
share|improve this question
Good question, but it may be better on Stack Overflow. – Hassan Jun 8 '12 at 3:57
@Hassan, not sure it is on topic there, but it is certainly on topic here. – soandos Jun 8 '12 at 3:58

Unless you compiled libstc++ yourself, you likely just downloaded the object files. If that is the case then you will be unable to change anything about it.

To get the performance that you are looking you, you might have to download the source code and compile it with the options that you want to use.


Having more than one version of libstc++ installed on a system can get tricky (I had a few issues with this on Ubuntu, and to took a full removal of one of the version to get resolved, though I am sure there is a way to manage it).

If you compile code with the -mtune=generic flag, but the wrong version of the library, you should not expect the resulting binary to run on the target machine (assuming that it is a different machine).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .