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

std::align_val_t error with c++17 on Mac

seidel__daniel
Beginner
3,464 Views

Dear Intel-Community,

I’m having trouble compiling any project with std=c++17 on Mac with the latest Intel Compiler 18 Update 2. Even a fresh hello world console project gives me the error:

enum "std::align_val_t" was previously declared with a different base type
  enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
                              ^


Are there any additional flags that need to be set in order to compile it with the latest C++ language features?

System specs:
Intel Compiler 18 Update 2
Xcode 9.2 (9C40b)
Mac OS Sierra 10.12.6

Best regards,
Daniel

0 Kudos
14 Replies
Viet_H_Intel
Moderator
3,464 Views

Hi Daniel,

You have already set -std=c++17 to use C++17 features. Did you get the error you mentioned above with just helloworld program? Can you please provide us a preprocess file to investigate further?

Thanks,

Viet

0 Kudos
seidel__daniel
Beginner
3,464 Views

Hi Viet,

thank you very much for your response.

I get the error I've mentioned with ANY XCode-Project when I choose the Intel Compiler and set the std=c++17. It isn't even restricted to XCode. The Boost C++ Libraries, for example, also give me the same error when compiled in the command line with std=c++17.

The Hello world project and Boost work fine when I set it to std=c++14, but of course, I will need C++17 in my framework so I definitely need c++17. I use a lot of C++17 features including constexpr if and so on...

I've recently switched from MSVC on Windows and LLVM on Mac to the Intel Compiler.  The Windows version compiles without any problems, but the Mac version always gives me this error.

I've attached the preprocess infos for the version with c++14 activated. If I want to pre process the c++17 version XCode tells me "Unable to Generate Content".

Hope you can help me!

Thanks!

0 Kudos
Viet_H_Intel
Moderator
3,464 Views

Hi Daniel,

Thanks for the preprocess file but since it generated with -std=c++14 it doesn't really help in C++17 case.

We just have 19.0 Beta released, which I think better support C++17 features. Can you give it a try?

Regards,

Viet

0 Kudos
seidel__daniel
Beginner
3,464 Views

Hi Viet,

thank you very much. The Intel Compiler 19 Beta does indeed compile the Hello World project and other simple projects. How ever in my important SDK project, there's now a new error that occurs exactly where the std::align_val_t occured in the first place. But now I just get a plain: 

Command /usr/local/bin/icc-19.0.0.041 failed with exit code 2

message with no further information. And again a preprocessed file is not possible, because XCode can't generate it. Very strange. Do you have any idea how to get more concrete information about this error than just "exit code 2". I didn't find any description of the error codes on the Intel page.

Kind Regards,

Daniel

0 Kudos
Viet_H_Intel
Moderator
3,464 Views

Hi Daniel,

I don't have enough info to know what happened. Can you look around line std::align_val_t and try to construct a test case for us?

Thanks,

Viet

0 Kudos
seidel__daniel
Beginner
3,464 Views

Hi Viet,

I now managed to isolate the error better. It happens every time an objective c file (.mm) is present in the project. Even if it's completely empty. I've attached the XCode-Project to this post.

The error message I get now is:

clang: error: unknown argument: '-fp-model'
clang: error: no such file or directory: 'no-except'
problem occurred when compiling '/Users/daniel/Desktop/intel19objectivec/intel19objectivec/empty.mm' with the clang compiler (code 1)
Command /usr/local/bin/icc-19.0.0.041 failed with exit code 1

I've already tried to change the settings regarding the floating point model and other objective c related settings but nothing worked.

Best Regards,

Daniel

0 Kudos
Vaughn__James
Beginner
3,464 Views

seidel, daniel wrote:

The error message I get now is:

clang: error: unknown argument: '-fp-model'
clang: error: no such file or directory: 'no-except'
problem occurred when compiling '/Users/daniel/Desktop/intel19objectivec/intel19objectivec/empty.mm' with the clang compiler (code 1)
Command /usr/local/bin/icc-19.0.0.041 failed with exit code 1

Hello. I get the exact same errors when compiling any *.mm file in XCode 9.0.1. Tried the latest 2018 as well as 2019 update 1 version of the compiler. Please guys fix this asap! I can't compile code with a tool I've paid for...

Could you at least please hint us to things we could try? Why is there a clang error when compiling with ICC?

Kind regards, James

0 Kudos
Judith_W_Intel
Employee
3,464 Views

This looks like a configuration/setup problem. -fp-model is an Intel specific compiler switch - why is it being used with clang? The Intel compiler does not support Objective C.

0 Kudos
seidel__daniel
Beginner
3,464 Views

Hi Judith, Hi James,

I totally agree that it's a configuration problem but unfortunately we still can't figure out how to solve it in XCode. We have hundreds of cpp's in our framework which should be compiled with the Intel compiler and only five .mm files. Clang doesn't ignore the -fp-model flag for some unknown reason and we can't omit the flag for these few files. We use the last available XCode9 version (9.4.1) with Intel Compiler 19 Update 1 and we can't use XCode 10 because we need to be 32-bit compatible. Is there a possibility to omit the -fp-model flag in general?

Looking forward to the opinion of both of you. Any help is highly appreciated!

Cheers,

0 Kudos
Vaughn__James
Beginner
3,464 Views

Hi Daniel & Judith,

it may be a mis-configuration, but I don't know what's causing it nor how to solve it. Tried it several times the past weeks. And it's not like I've changed any settings, only created a new XCode project, switched to ICC and added 1 mm file.

It says "clang error" on one side but "icc-19.0.0.041 failed with exit code 1" on the other. Compiling with Clang doesn't give any error, so may the Intel Compiler pass forward the flags to clang? If so, can it just omit flags? Can anyone else reproduce this bug at all?

I feel quite lost and there's not even the slightest chance of support from Apple's side. And what I've read so far in here it seems this is a dead end either.

0 Kudos
seidel__daniel
Beginner
3,464 Views

Hi,

it would be great if we could at least get some infos about the following: Does the Intel compiler get the .mm file and then forwards it to Clang or is this handled by XCode?

@ James: I suggest we combine our efforts to find a solution for this problem. Could you please write me an email at contact (at) forward-audio (dot) de?

0 Kudos
Vaughn__James
Beginner
3,464 Views

Hi Daniel,

I'm sorry but I'm not a single step further with this problem and I don't have the time anymore to put more effort in. Haven't heard anything from Apple or Clang devs regarding this and Intel seems to ignore this, obviously thinking it's not their business. Wanted to try other IDEs but the Intel Compiler integration is often not possible.

Right now I'm about to switch to free available/stock compilers and not going to extend my Parallel Studio license another year. Though I have some project which ran smoother compiled with Intel, it's not worth the hassle anymore.

Still wishing you all the best with this! Waiting for support of 3 companies of which no one seems to care leaves no other choice than to avoid them I think.

0 Kudos
Gokul_H_
Beginner
3,464 Views

I faced the same issue. This worked for me. I am not an expert, try at your own risk, if this causes other problems, please don't catch on me!

go to:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new(163)

i.e., line 163 in this file new and replace 

162 #else
163 enum align_val_t { __zero = 0, __max = (size_t)-1 }; 

with

162 #elif defined __INTEL_COMPILER
163 #else
164 enum align_val_t { __zero = 0, __max = (size_t)-1 };

 

You may want to save a copy elsewhere of the original new file just in case intel addresses this bug in the future and you need to revert back to the original form. Apparently align_val_t is already defined somewhere in the intel compiler that's causing this problem.

0 Kudos
AxS
Beginner
2,275 Views

Stumbled about this issue using visual studio on a windows machine. For me the solution was to deactivate precompiled headers. If there is a similar feature on mac, this may be worth a try.

0 Kudos
Reply