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

Linker error: undefined reference to `__builtin_fpclassify'

bay3255
Beginner
2,616 Views
I am getting an error while trying to compile next source:

$ cat icctest.cpp
[cpp]#include [/cpp]
[cpp]#include 

int main(int argc, char *argv[])
{
    std::cout << std::fpclassify(7.6) << "\n";
    return 0;
}
[/cpp]
$ icpc --version
icpc (ICC) 12.0.5 20110719
$ icc -o icctest icctest.cpp
/tmp/icch3LO8h.o: In function `main':
icctest.cpp:(.text+0x4a): undefined reference to `__builtin_fpclassify'
GCC compiles this successfully. If I use other version of compiler I got another error(this seems to be fixed):
$ icpc --version
icpc (ICC) 11.1 20091130
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
$ icc -o icctest icctest.cpp
/usr/include/c++/4.4.4/cmath(500): error: identifier "__builtin_fpclassify" is undefined
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
^
detected during instantiation of "__gnu_cxx::__enable_if<:__IS_ARITHMETIC><_Tp>::__value, int>::__type std::fpclassify(_Tp) [with _Tp=double]" at line 6 of "icctest.cpp"
Seems compiler didn't see that__builtin_fpclassify function is internal and trying to find it in libraries.
0 Kudos
1 Solution
Judith_W_Intel
Employee
2,616 Views

No it is not fixed yet. A call to __builtin_fpclassify() will still be unresolved by the linker since the Intel compiler is not yet recognizing it as an intrinsic. This is not consistent with g++ 4.4.1 and later.

View solution in original post

0 Kudos
7 Replies
TimP
Honored Contributor III
2,616 Views
It doesn't work at all for me until I add
#include
using namespace std;
after which it works fine when either gcc 4.4.4 or 4.5.1 is on PATH.

I had to look up FAQ; even if you are used to some past version of C++, an FAQ check can't hurt.
0 Kudos
Judith_W_Intel
Employee
2,616 Views

This is a known problem when using thegcc 4.4 and later system headers. It is currently entered in our cq database as defect cq #169510.
0 Kudos
bay3255
Beginner
2,616 Views
Is it fixed in some version of compiler?
0 Kudos
TimP
Honored Contributor III
2,616 Views
What do you mean by "fixed?" The behavior is consistent with the active g++, whose developers have decided this is the correct behavior. In some cases, icpc is stricter than g++ default, but this is not one of them.
0 Kudos
Judith_W_Intel
Employee
2,617 Views

No it is not fixed yet. A call to __builtin_fpclassify() will still be unresolved by the linker since the Intel compiler is not yet recognizing it as an intrinsic. This is not consistent with g++ 4.4.1 and later.
0 Kudos
Sukruth_H_Intel
Employee
2,616 Views
Quoting bay3255
I am getting an error while trying to compile next source:

$ cat icctest.cpp
[cpp]#include [/cpp]
  1. #include
  2. intmain(intargc,char*argv[])
  3. {
  4. std::cout<<:FPCLASSIFY>"\n";
  5. return0;
  6. }
[cpp]#include 

int main(int argc, char *argv[])
{
    std::cout << std::fpclassify(7.6) << "n";
    return 0;
}
[/cpp]
$ icpc --version
icpc (ICC) 12.0.5 20110719
$ icc -o icctest icctest.cpp
/tmp/icch3LO8h.o: In function `main':
icctest.cpp:(.text+0x4a): undefined reference to `__builtin_fpclassify'
GCC compiles this successfully. If I use other version of compiler I got another error(this seems to be fixed):
$ icpc --version
icpc (ICC) 11.1 20091130
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
$ icc -o icctest icctest.cpp
/usr/include/c++/4.4.4/cmath(500): error: identifier "__builtin_fpclassify" is undefined
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
^
detected during instantiation of "__gnu_cxx::__enable_if<:__IS_ARITHMETIC><_Tp>::__value, int>::__type std::fpclassify(_Tp) [with _Tp=double]" at line 6 of "icctest.cpp"
Seems compiler didn't see that__builtin_fpclassify function is internal and trying to find it in libraries.

shv@dpd20:~> icpc --version

icpc (ICC) 12.0.5 20110719

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

i encountered a new problem when i was executing the icctest.cpp file:

The program works fine with intel64 architecture and when i ran it using the ia32 architecture i got an catastrophic error:

/usr/include/gnu/stubs.h(7): catastrophic error: cannot open source file "gnu/stubs-32.h"

# include

^

compilation aborted for fpclassify.cpp (code 4)

so i was not able to reproduce the problem with either of the architecture.

can i know which architecture you using? intel64 or ia32?

Thanks and Regards,
Sukruth.H.V

0 Kudos
Judith_W_Intel
Employee
2,616 Views

This looks like a completely different issue.

Question: Do you have a stubs-32.h file in /usr/include/gnu? I see one on my RH5 ia32 operating system. What operating system are you using? Are you using any compilation flags?

Judy
0 Kudos
Reply