Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Bo_Jensen
Beginner
472 Views

Using -static-libstdc++ on linux

I am using the newest version of composer :

[bash]icpc -v icpc version 12.1.3 (gcc version 4.6.0 compatibility)[/bash]
but when I run :

[bash]icpc test.cpp -gcc-name=gcc-4.6 -gxx-name=g++-4.6 -static-intel -static-libgcc -static-libstdc++ icpc: command line warning #10006: ignoring unknown option '-static-libstdc++'[/bash] but running g++ directly there's no problem at all :

[bash]g++ test.cpp -static-libgcc -static-libstdc++[/bash]
So since the version states "(gcc version 4.6.0 compatibility)", I ask how can I pass this option to the linker ?

Thanks

/Bo



0 Kudos
8 Replies
TimP
Black Belt
472 Views

You could name the static libstdc++ specifically in your link line (if it's present). Compatibility doesn't extend to processing many of the g++ command line options (I haven't seen that one).
Bo_Jensen
Beginner
472 Views

It's not as simple as that, avoiding the shared link can be troublesome, especially if it's to be incoorporated into a larger build system. Would definitely be better to support the -static-libstdc++ in future releases.
Bo_Jensen
Beginner
472 Views

Besides the trouble of locating the correct static lib, then linking directly with it via -L option has the disadvantage of blowing up the shared library size. Using the -static-libstdc++ option with gcc gives a minimum of overhead, but the direct way with intel seem just to insert the whole library no matter how much you use of it.
Kittur_G_Intel
Employee
472 Views

Hi Bo,
One suggestion is, you can use -Bstatic -l option which should pull in the entire static library by ld. The -static-libstdc++ option was introduced with g++ 4.5recently soI'll file a feature request to support that option with the developers Of course, I'll update you as soon as that is supported.

Regards,
Kittur
Bo_Jensen
Beginner
472 Views

Kittur, thanks for the suggestions and filing the feature request. Adding -Bstatic does not do it, ld finds the library and links it in, which can be seen by the increase in size of the library, but it does still have a dependence on libstdc++.so. I remember reading about it some time ago, it's tricky what goes on, one thing that works is to put a symbolic link in a directory and link with -Lsomedir/.
Kittur_G_Intel
Employee
472 Views

Interesting, I thought -Bstatic should pull in the library you indicate statically, after that you can specify -Bdynamic explicitly on other libs you may want to pull in dynamically. I'll have to try that out and see what's going on.

Atleast you brought up a good issue for which I've filed a feature request, thanks.

Regards,
Kittur
Bo_Jensen
Beginner
472 Views

I have confirmed that library gets included in total i.e 3MB extra, if you just use one function from libstdc++. Besides as said -static-libstdc++ in gcc is much more clever and include only a minimum, so it makesgood sense to me to support this option.
Kittur_G_Intel
Employee
472 Views

Hi, This issue has been fixed in the latest 2013 release that you can download from the Intel Registration Center... Regards, Kittur
Reply