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

ICC fails in link but G++ can link

joshi__himanshu
Beginner
864 Views

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.

0 Kudos
8 Replies
Viet_H_Intel
Moderator
864 Views

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

0 Kudos
joshi__himanshu
Beginner
864 Views

hmbp:~ hima$ icc --version

icc (ICC) 19.0.5.281 20190816

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

On OSX Mojave: 10.14.6 (18G1012)

0 Kudos
Viet_H_Intel
Moderator
864 Views

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? 

0 Kudos
John_G_8
Beginner
864 Views

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.

0 Kudos
joshi__himanshu
Beginner
864 Views

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?

0 Kudos
Viet_H_Intel
Moderator
864 Views

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.

0 Kudos
Viet_H_Intel
Moderator
864 Views

typo: over=older

0 Kudos
John_G_8
Beginner
864 Views

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.

0 Kudos
Reply