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

Intel C++ 18 link error: cannot find -lgcc


Background: I am compiling "lubridate" package for R using Intel compiler on a shared HPC cluster, and I am facing an issue at the linking stage of the library.

Lubridate package:

Here is the icpc invocation at the linking stage, and the error message:

icpc -std=gnu++11 -shared -L/cm/shared/applications/R/3.4.3/lib64/R/lib -Wl,-z,relro,-z,now -qopenmp -L/cm/shared/applications/zlib/1.2.8/lib -L/cm/shared/applications/bzip2/1.0.6/lib -L/cm/shared/applications/xz/5.2.3/lib -L/cm/shared/applications/build_essential/1.0/lib -o RcppExports.o datetime.o period.o tparse.o update.o utils.o -L. -lcctz -L/cm/shared/applications/R/3.4.3/lib64/R/lib -lR
ipo: warning #11012: unable to find -lgcc
ipo: warning #11012: unable to find -lgcc
ld: error: cannot find -lgcc
ld: error: cannot find -lgcc
ld: error: cannot find -lgcc
ld: error: cannot find -lgcc
make: *** [] Error 1
ERROR: compilation failed for package ‘lubridate’

Software versions: Intel compiler suite version 18.0.3, g++ version 6.4.0. Note that the g++ located in a non-default location because we have multiple GCC versions on the system. FWIW, the g++ path is: /cm/shared/applications/gcc/6.4.0/bin/g++ .

After some digging (with "icpc -v", and experimenting on that computer), I found that there is one "-L" path missing. On my site, the missing path was:


which was not included in g++ search path (as evidenced when I invoked `g++ -print-search-dirs`). I could do ad-hoc solution by adding the directory above to LIBRARY_PATH environment variable. But I wonder if there is a better solution. (What was started as a Intel C++ problem seem to end up being a GCC problem, but I want to post this anyway because somebody else may have run into the same issue. I could not find any discussion on this on the internet.)


0 Kudos
1 Reply


Would it help if you compile with -gxx-name=/cm/shared/applications/gcc/6.4.0/bin/g++ ?