Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.)

Clarification:

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 http://mirrors-us.seosue.com/gcc/releases/gcc-4.6.2/gcc-4.6.2.tar.gz 
$ 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

1 Answer 1

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.

Notes:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.