Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

ICC fails in link but G++ can link

joshi__himanshu
Beginner
222 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
222 Views

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

joshi__himanshu
Beginner
222 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)

Viet_H_Intel
Moderator
222 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? 

John_G_8
Beginner
222 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.

joshi__himanshu
Beginner
222 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?

Viet_H_Intel
Moderator
222 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.

Viet_H_Intel
Moderator
222 Views

typo: over=older

John_G_8
Beginner
222 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.

Reply