Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrew_R_
Beginner
439 Views

icpc cannot find libstdc++ for alternate install of GCC

I am on a cluster running CentOS 6.5 with an old version of GCC (4.4.7) and several versions of icpc (14.0.2, 14.0.1 and older). I have installed a local copy of GCC (4.8.3) in order to be able to use C++11 features. I have created a personal module file to load my version of GCC into my path; it is included at the end of this post.

I run into a problem whenever I compile a program (even the simplest hello.cpp from this link) using icpc when my GCC module is loaded:

icpc: error #10001: could not find directory in which the set of libstdc++ include files resides

I have googled this error but none of the proposed problems/solutions have worked for me. The error is reproducible with icpc 14.0.1 and 14.0.2.

Below is a list of problems I think I have eliminated. What am I missing?

g++ is not installed properly:

$ which g++
~/bin/gcc-4.8.3/bin/g++

GXX_ROOT is not set properly:

$ echo $GXX_ROOT
/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/
$ g++ -print-search-dirs
install: /home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/
programs: =/home/andyras/bin/gcc-4.8.3/libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/libexec/gcc/x86_64-unknown-linux-gnu/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/bin/
libraries: =/home/andyras/bin/gcc-4.8.3/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/../lib64/:/home/andyras/bin/gcc-4.8.3/lib64/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib64/../lib64/:/home/andyras/bin/dynamix-ga-2014-07-28-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/dynamix-ga-2014-07-28-intel-14.0.2/lib/../lib64/:/home/andyras/bin/GAlib-mpi-openmpi-1.8.1-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/GAlib-mpi-openmpi-1.8.1-intel-14.0.2/lib/../lib64/:/home/andyras/bin/openmpi-1.8.1-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/openmpi-1.8.1-intel-14.0.2/lib/../lib64/:/home/andyras/bin/dynamix-2014-07-28-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/dynamix-2014-07-28-intel-14.0.2/lib/../lib64/:/home/andyras/bin/boost-1.54.0-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/boost-1.54.0-intel-14.0.2/lib/../lib64/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/x86_64-unknown-linux-gnu/4.8.3/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/../lib64/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/x86_64-unknown-linux-gnu/4.8.3/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/../lib64/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/x86_64-unknown-linux-gnu/4.8.3/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/../lib64/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/x86_64-unknown-linux-gnu/4.8.3/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/../lib64/:/home/andyras/bin/cvode-2.7.0-intel-14.0.2/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/cvode-2.7.0-intel-14.0.2/lib/../lib64/:/home/andyras/bin/git-2.0.3/lib64/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/git-2.0.3/lib64/../lib64/:/home/andyras/bin/git-2.0.3/libexec/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/git-2.0.3/libexec/../lib64/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/lib/../lib64/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../x86_64-unknown-linux-gnu/4.8.3/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../lib64/:/lib/x86_64-unknown-linux-gnu/4.8.3/:/lib/../lib64/:/usr/lib/x86_64-unknown-linux-gnu/4.8.3/:/usr/lib/../lib64/:/home/andyras/bin/gcc-4.8.3/lib/:/home/andyras/bin/gcc-4.8.3/lib64/:/home/andyras/bin/dynamix-ga-2014-07-28-intel-14.0.2/lib/:/home/andyras/bin/GAlib-mpi-openmpi-1.8.1-intel-14.0.2/lib/:/home/andyras/bin/openmpi-1.8.1-intel-14.0.2/lib/:/home/andyras/bin/dynamix-2014-07-28-intel-14.0.2/lib/:/home/andyras/bin/boost-1.54.0-intel-14.0.2/lib/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/home/andyras/bin/cvode-2.7.0-intel-14.0.2/lib/:/home/andyras/bin/git-2.0.3/lib64/:/home/andyras/bin/git-2.0.3/libexec/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/lib/:/home/andyras/bin/gcc-4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../:/lib/:/usr/lib/

I have also provided my module file at the end for inspection of which paths I changed.

language environment variables are set improperly:

$ export LANGUAGE=C; export LC_MESSAGES=C; export LC_ALL=C

This problem is supposedly for non-English Linuces, and the solution has no effect on my error.

missing -cxxlib flag

I tried setting adding the flag `-cxxlib=/home/andyras/bin/gcc-4.8.3` to CXXFLAGS with no effect.

-gxx-name flag

I tried setting `-gxx-name=/home/andyras/bin/gcc-4.8.3/bin/g++` in CXXFLAGS with no effect.

References:

  1. https://software.intel.com/en-us/forums/topic/486698
  2. https://software.intel.com/en-us/articles/intel-c-compiler-for-linux-iccicpc-error-could-not-find-di...
  3. https://software.intel.com/en-us/forums/topic/366102

Module file:

#%Module

# for simple packages, this line is all that needs to change
set VER 4.8.3
set PKG /home/andyras/bin/gcc-$VER

setenv GXX_ROOT /home/andyras/bin/gcc-4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/

setenv CC gcc
setenv CXX g++
setenv FC gfortran
setenv F77 gfortran

# standard paths
set PKGBIN $PKG/bin
set PKGLIB $PKG/lib:$PKG/lib64
set PKGINC $PKG/include:$PKG/include/c++/$VER/:$PKG/include/c++/$VER/x86_64-unknown-linux-gnu/
set PKGMAN $PKG/share/man
set PKGINF $PKG/share/info
set PKGCFG $PKG/share/lib/pkgconfig

# comment out unnecessary paths, but leave them in so future module files
# can be easily copied and modified

prepend-path PATH $PKGBIN
prepend-path LIBRARY_PATH $PKGLIB
prepend-path LD_LIBRARY_PATH $PKGLIB
prepend-path CPATH $PKGINC
prepend-path C_INCLUDE_PATH $PKGINC
prepend-path CPLUS_INCLUDE_PATH $PKGINC
prepend-path MANPATH $PKGMAN
prepend-path INFOPATH $PKGINF
prepend-path PKG_CONFIG_PATH $PKGCFG

 

0 Kudos
8 Replies
Andrew_R_
Beginner
439 Views

The GXX_ROOT line in the module file should be

setenv GXX_ROOT /home/andyras/bin/gcc-$VER/lib/gcc/x86_64-unknown-linux-gnu/$VER/
Kittur_G_Intel
Employee
439 Views

Hi Andrew,
That's strange as all you need to ensure is the right GNU version is used.  The compiler (icc/icpc) by default gets the path to where gcc is on your system by looking at gcc or g++ in your path and uses that version. Since you have installed your own locally in your home directory, you can  force to that version by setting -gcc-name=<full path to gcc> / -gcc-version=483. 

Try the below and see if it works:

1) %export PATH=home/andyras/bin/gcc-4.8.3/bin:$PATH 
Check to make sure gcc is invoked from the path you expected.
2) %which gcc
3) Execute the iccvars.sh file found in the bin directory of where the compiler (icc) is installed in your cluster install on your system
      % <install-dir>/bin/iccvars.sh intel64  (since your system is 64-bit arch?)
This should set the compiler environment for ICC.

4) %export CC=icc; CXX=icpc
5)% which icc
<This should give the path to icc which you'll be using>
 

6) % cat hello.cpp

#include <iostream>
int main(int argc, char *argv[]) {
    std::cout <<"Hello World!" << std::endl;  
}

7)Compile with icpc 
%icpc hello.cpp
%./a.out
Hello World!

============================

_Kittur

Kittur_G_Intel
Employee
439 Views

Hi Andrew,
Was browsing the threads and found this one. I know it's been quite a while and assume the issue is resolved? Please let me know otherwise, appreciate much.
_Kittur

perfwise
Beginner
439 Views

Hello,

   I am having a similar issue with composer_xe_2015.1.133.  I'm trying to build 32-bit code, but running into the following issue:

 

host~> icc -m32 -o a.out main.c
ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8//libstdc++.so when searching for -lstdc++
ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8//libstdc++.a when searching for -lstdc++
ld: cannot find -lstdc++
ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8//libgcc.a when searching for -lgcc
ld: cannot find -lgcc
ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8//libgcc_s.so when searching for -lgcc_s
ld: cannot find -lgcc_s

I've got g++ installed:

g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and I'm just trying to compile 32-bit code via a hello world app which gcc does just fine.

I'm using:

Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:    trusty

 

Kittur_G_Intel
Employee
439 Views

Kittur_G_Intel
Employee
439 Views

@perfwise - did the issue get resolved based on the steps outlined in the reference articles on this I mentioned in my previous communication? Thanks for your input.

_Kittur 

perfwise
Beginner
439 Views

Kittur,

I was able to install the latest XE release.. but I'm unable to build -m32 binaries upon my 64-bit OS and run them.  I tried the following with a "hello world" example:

 

host:~> gcc -o a.out -m32 hello_world.c 
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

 

You can see it didn't build.  I'm able to build/run 64-bit code.. but what options are there for using Intel compilers with the latest ICC15 release to build 32-bit binaries upon Ubuntu 14.04.  I didn't see anything in the documents you directed me to which allowed me to do this.

Sometimes 32-bit binaries run faster.. primarily in pointer heavy applications due to the smaller cache footprint they have.  This is why I'm interested in building 32-bit binaries and running them upon a 64-bit OS for "specific applications".

Thanks.. perfwise

Kittur_G_Intel
Employee
439 Views

Hi (@perfwise)
Well, your command >host:~> gcc -o a.out -m32 hello_world.c    is using GCC and not "icc"  first of all.  That said, you need to know the following:

Presently, to build a 32 bit binary on a 64 bit system you should have installed the 32 bit Intel compiler as well by choosing the option from the install selection menus during the compiler installation in addition to the 64-bit compiler.  Reason,  to build the 32 bit binary the compiler will invoke the 32 bit compiler and will fail if not found   Also, you'll have to ensure the 32-bit libraries are installed and found on the 64 bit system as well.  That said, since I notice you're running on Ubuntu you should also note that Ubuntu has deprecated the 32bit libraries (14 and above). Therefore (like the article mentions) the packages for 32bit development are nearly impossible to find and suggest you just install the 64 bit only. Let me know if you need any further clarifications, appreciate much.

_Kittur 

Reply