Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

Removing dependancy of libstdc++.so.6 from program compiled by ICC(11.1.069) compiler

sandip_dongaregmail_
911 Views
I compiled simple program using ICC(11.1.069 on Linux 64 platform) compiler. When I excute "ldd" command on binary(a.out), it shows dependancy on libstdc++.so.6 & libgcc_s.so.1 libraries. I tried to use "-cxxlib-icc" option to remove this dependancy, but this option is not supported on 10.x onward version of icc complier(says product document as well), which is available with 9.1.046 version of ICC. I am new to ICC compiler(usually used GCC). I want to remove this dependancy, plz help me out. Actaully I want to build 64 bit binary on linux 64 machine using ICC compiler. Sample program & commands are as follows:

Hello.cpp
---------------------------------------------------
#include
int main(){ std::cout<<"Hi"<<:ENDL>---------------------------------------------------

Commands:
bash-3.00$ source /usr/local/packages/icc_remote/11.1.069/bin/iccvars.sh intel64
bash-3.00$ icpc hello.cpp
bash-3.00$ ldd a.out
libm.so.6 => /lib64/tls/libm.so.6 (0x000000308d000000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x000000308f600000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000308f400000)
libc.so.6 => /lib64/tls/libc.so.6 (0x000000308cd00000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000308d200000)
/lib64/ld-linux-x86-64.so.2 (0x000000308c900000)



-- DONG
0 Kudos
3 Replies
TimP
Honored Contributor III
911 Views
You're correct in that icc for x86_64 (and corresponding 32-bit) no longer include a Dinkumware STL. By "removing dependency," do you mean that you wish to be able to run on a system without a recent gcc installation? You could try a static link against the gcc libraries (e.g. by listing the specific .a libraries you require in your link step). You may find that the .a libraries didn't come in by default with your gcc installation.
0 Kudos
sandip_dongaregmail_
911 Views

Thanks for reply. Some more queries:

1. Is there any way to build 64-bit binary without having dependancy on libstdc++.so.6 & libgcc_s.so.1 using ICC compiler of version above 9.x(mainly 9.1.046patched) on linux 64 platform.
Output of uname -a on my machine:Linux testhost 2.6.9-89.0.0.0.1.ELxenU #1 SMP Tue May 19 05:44:57 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

2. As per your reply which specific .a I should list to remove this dependancy.
0 Kudos
TimP
Honored Contributor III
912 Views
Look in your gcc installation for libstdc++.a in the same directory , and named consistently with the libstdc++.so which you link against by default.
ldd ./a.out will show you the path for the libstdc++.so, or you can see the paths in use by
g++ -print-search-dirs
Similarly with libgcc.
If you stick to C code, you won't need to link libstdc++. I guess you said your old icpc still included its own (Dinkumware) STL library; that isn't supported/guaranteed to work on current linux installations, although it may work.
On current linux installations, you can install the old libstdc++, should you need compatibility with such an old icc; it's usually named libstdc++-33 (came with gcc 3.3). For the old icc for x86_64, you need both the .i386 and the .x86_64 versions of libstdc++-33.
0 Kudos
Reply