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

identifier "MB_LEN_MAX" is undefined when -ffreestanding

Alexey_S_Intel2
Employee
764 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
764 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

0 Kudos
Viet_H_Intel
Moderator
764 Views

I've reported this case CMPLRLIBS-2739

0 Kudos
Alexey_S_Intel2
Employee
764 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?

0 Kudos
Viet_H_Intel
Moderator
764 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)

0 Kudos
Reply