ICC fails in link but G++ can link

TCE Options

TCE Open Date: 

Wednesday, November 27, 2019 - 01:33

ICC fails in link but G++ can link

Simple hello world program(bottom of post) when I try to compile & link using ICC:

hmbp:nnCPPProf hima$ icpc -o test test.cpp 
Undefined symbols for architecture x86_64:
  "__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Emc", referenced from:
      _main in icpcIBtuRJ.o
ld: symbol(s) not found for architecture x86_64

but g++ can do it:

hmbp:nnCPPProf hima$ g++ -o test test.cpp 
hmbp:nnCPPProf hima$ ./test 
Hello World.


The program:

hmbp:nnCPPProf hima$ cat test.cpp 
#include <iostream>
using namespace std;
int main(int argc, const char* argv[])
  cout<<"Hello World."<<endl;
  return 0;
hmbp:nnCPPProf hima$ 


I am missing some kind of setup but I ran the setup script suggested by the installer and still no difference.

9 posts / 0 new

what ICC version are you using? And also what OS? It definitely has something to do with your missing setup. 

hmbp:~ hima$ icc --version

icc (ICC) 20190816

Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

On OSX Mojave: 10.14.6 (18G1012)

Seems like you are using the OS that released (October 29, 2019) after the compiler released (August 16, 2019)

And what is your Xcode version? 

This is exactly the same problem I reported on 11/26, under Forum heading "Update for Forum topic: icpc totally broken Apple". Almost the same test program too.

Viet, here is my xcode version:

hmbp:src hima$ /usr/bin/xcodebuild -version

Xcode 11.2.1

Build version 11B500


I am still facing this problem.


John: Were you able to figure out what is happening? Did you resolve the issue?

Since we weren't able to test any OS/Xcode versions which released after the compiler released date, you may run into some issues.

Is it possible for you to use over OS/Xcode versions? or wait for the next compiler version.

typo: over=older

The problem is that Intel can't keep up with Apple Xcode releases. My security plan requires we use the latest version. I think it may be possible to revert to an older version of Xcode and this might get icpc working again.  My likely solution will be to no longer purchase the Intel compiler for my Apple computers as I am getting very little utility out of them due to issues of this type. In case you care, Macports GCC is broken for a similar reason, namely Apple no longer installs headers and libraries in standard places. Fortunately GCC provides a compile line workaround via the --sysroot option, e.g.

g++ --sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk hello.cc

that works around this problem

while icc and icpc also have a --sysroot option, it doesn't fix this problem. For g++ the issue was that it couldn't find the header files and using --sysroot allowed these to be located. For icpc the headers seem to be found, but not relevant dynamic or static libraries needed to build C++ code.

Leave a Comment

Please sign in to add a comment. Not a member? Join today