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

Intel compilers Toolchain for CLion

SMehrp
New Contributor I
3,628 Views

I am trying to compile a project using CLion and Intel compilers but I can't seem to make it work.

SMehrp_0-1636444182063.png

As this figure I am pointing at the intel compiler but I get the following errors when CLion tries to compile a test program:

    Building CXX object CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o
    /usr/local/bin/icc-2021.4.0    -MD -MT CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o -c /Users/saeid/CLionProjects/oorbs/cmake-build-oa_release/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_cacd3
    /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cacd3.dir/link.txt --verbose=1
    /usr/local/bin/icc-2021.4.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o -o cmTC_cacd3 
    ld: library not found for -lc++
    make[1]: *** [cmTC_cacd3] Error 1
    make: *** [cmTC_cacd3/fast] Error 2

 

I know that OneAPI does not officially support CLion but what I want to do is quite simple and universal. I appreciate if someone could give me some hint.

0 Kudos
1 Solution
SMehrp
New Contributor I
3,109 Views

The following solution suggested by Lev will resolve the toolchain problem:

can you please run  sudo xcode-select -p and see which XCode is used by your terminal?
If that's CommandLineTools then please run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer (with this path or path to xcode you have installed) and then reset Cache and reload your cmake project, this should resolve your issue...

View solution in original post

0 Kudos
12 Replies
NoorjahanSk_Intel
Moderator
3,585 Views

Hi,


Thanks for reaching out to us.


>> OneAPI does not officially support CLion but what I want to do is quite simple and universal

We will check with the internal team and get back to you soon.


Thanks & Regards,

Noorjahan.


0 Kudos
SMehrp
New Contributor I
3,545 Views

Dear Noorjahan,

Thank you very much, I forgot to mention that I am using MacOS.

regards,

0 Kudos
NoorjahanSk_Intel
Moderator
3,527 Views

Hi,


Sorry for the inconvenience. As Intel oneAPI does not officially support CLion we could not provide further support to this thread.

Could you please let us know whether you have any other issues? If not, could you please confirm whether to close this issue from our end?


Thanks & Regards,

Noorjahan.


0 Kudos
SMehrp
New Contributor I
3,509 Views

Hello, I think CLion is simply running this compilation command on terminal and returning the response from Intel compiler.

    /usr/local/bin/icc-2021.4.0    -MD -MT CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_cacd3.dir/testCXXCompiler.cxx.o -c /Users/saeid/CLionProjects/oorbs/cmake-build-oa_release/CMakeFiles/CMakeTmp/testCXXCompiler.cxx

The error occurs when linking libraries: "Linking CXX executable cmTC_cacd3" because "lc++" library is not found.

I suppose if I copy and past it in the terminal I will get same error. (I can confirm this when I have access to my Mac station).

 

A similar command works fine with GCC and Clang compilers.

I appreciate it if you could correct me if there is anything wrong with this command to compile a program. e.g. whether it is using the right compiler (/usr/local/bin/icc-2021.4.0) and flags.

0 Kudos
NoorjahanSk_Intel
Moderator
3,464 Views

Hi,

 

>> compilation command on terminal and returning the response from Intel compiler

 

Could you please provide a sample reproducer(steps if any to reproduce the issue)? so that it will help us to investigate more on your issue.

Also please provide the MacOS version that you are using.

 

Thanks & Regards,

Noorjahan.

0 Kudos
NoorjahanSk_Intel
Moderator
3,401 Views

Hi,


 Could you please provide the above-requested details? so that it will help us to investigate more on your issue.


Thanks & Regards

Noorjahan


0 Kudos
SMehrp
New Contributor I
3,388 Views

Dear Noorjahan,

 

I could not recreate this issue with Xcode, so I contacted CLion developers.

 

I leave the link here for the reference of the other OpenAPI users who are having same problem as me:

https://youtrack.jetbrains.com/issue/CPP-27488

 

According to the response, I need to provide "environment script" that is provided by Intel.

If you know about this script and whether it comes with OneAPI it can be a great help.

 

Best,

S. Mehr

0 Kudos
NoorjahanSk_Intel
Moderator
3,305 Views

Hi,


>>I need to provide "environment script" that is provided by Intel.


Intel provides " setvars.sh " script file that comes with oneAPI which helps to set the environment variables for use with the oneAPI toolkits.

you can find the script in below path:

opt/intel/oneapi/setvars.sh


You can refer to the below link for more details:

https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-hpc-macos/top/before-you-begin.html#before-you-begin


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
3,211 Views

Hi,


Has the information provided above helped? If yes, could you please confirm whether we can close this thread from our end?



Thanks & Regards

Noorjahan.


0 Kudos
SMehrp
New Contributor I
3,158 Views

Hi,

I couldn't resolve the issue yet, but we also have compiler ABI info detection issue with CMake and it seems that it's an intel compiler issue that will be resolved in 2021.5 release version of the intel compiler. So we are waiting for the next release before continuing to work on this problem.

0 Kudos
SMehrp
New Contributor I
3,110 Views

The following solution suggested by Lev will resolve the toolchain problem:

can you please run  sudo xcode-select -p and see which XCode is used by your terminal?
If that's CommandLineTools then please run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer (with this path or path to xcode you have installed) and then reset Cache and reload your cmake project, this should resolve your issue...

0 Kudos
NoorjahanSk_Intel
Moderator
3,096 Views

Hi,


Glad to know that your issue is resolved.

If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Noorjahan.


0 Kudos
Reply