Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7724 Discussions

Removing dependancy of from program compiled by ICC(11.1.069) compiler

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 & 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:

int main(){ std::cout<<"Hi"<<:ENDL>---------------------------------------------------

bash-3.00$ source /usr/local/packages/icc_remote/11.1.069/bin/ intel64
bash-3.00$ icpc hello.cpp
bash-3.00$ ldd a.out => /lib64/tls/ (0x000000308d000000) => /usr/lib64/ (0x000000308f600000) => /lib64/ (0x000000308f400000) => /lib64/tls/ (0x000000308cd00000) => /lib64/ (0x000000308d200000)
/lib64/ (0x000000308c900000)

0 Kudos
3 Replies
Black Belt
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.

Thanks for reply. Some more queries:

1. Is there any way to build 64-bit binary without having dependancy on & 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- #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.
Black Belt
Look in your gcc installation for libstdc++.a in the same directory , and named consistently with the which you link against by default.
ldd ./a.out will show you the path for the, 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.