Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7779 Discussions

identifier "MB_LEN_MAX" is undefined when -ffreestanding

Alexey_S_Intel2
Employee
433 Views

Hi! 

Why the following program fails to compile with the option -ffreestanding? (Without -ffreestanding there is no errors.)

//test.cpp

#include <climits>

int main() {

char buf[MB_LEN_MAX];

return 0;

}

Command:  icpc test.cpp -ffreestanding -o test.exe

Output:

 error: identifier "MB_LEN_MAX" is undefined

 

0 Kudos
4 Replies
Viet_H_Intel
Moderator
433 Views

Seems like a compiler issue. I will report it to the compiler team.

Can you #include"/usr/include/limits.h" as a workaround?

Thanks,

Viet

Viet_H_Intel
Moderator
433 Views

I've reported this case CMPLRLIBS-2739

Alexey_S_Intel2
Employee
433 Views

Viet Hoang (Intel) wrote:

Can you #include"/usr/include/limits.h" as a workaround?

Hi, Viet!

No, I'm not sure that we can do it. But we may refrain from using the option -ffreestanding.

Our goal is to drop the dependency on libirc.so. The icpc optimizes some code and places the calls to __intel_fast_memcpy (as well as some other __intel_fast_-functions) in our library, which in turn bring us the unacceptable dependency on libirc.so.

So we just need to find a way to drop the dependency on the libirc.so (and we can not link in the static version of libirc library as well). Could you please provide us with any solution?

Viet_H_Intel
Moderator
433 Views

You can try  -fno-builtin to see if it helps; but to avoid dependency on Intel shared libs, you would need to link in statically (-static-intel)

Reply