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

icpc 14.0.0 + boost 1.54 causes undefined reference to `__builtin_signbit'

Arnstein_R_
Beginner
1,168 Views

The following code fails to link when using icpc 14.0.0 and boost 1.54 or 1.53:

[cpp]

#include <boost/lexical_cast.hpp>
#include <string>

int main()
{
  const float f(0.123f); 
  boost::lexical_cast<std::string>(f);
  return 0;
}

[/cpp]

Commmand line:

icpc -std=c++11  -I boost_1_54_0/ icpc_14_builtin_signbit_failure.cpp

Output:

/tmp/icpcZV9IvT.o: In function `main':
icpc_14_builtin_signbit_failure.cpp:(.text+0x65): undefined reference to `__builtin_signbit'
icpc_14_builtin_signbit_failure.cpp:(.text+0xa8): undefined reference to `__builtin_signbit'

It compiles fine if -std=c++11 is not specified. It also compiles fine with icpc 13.1.3 and -std=c++11 defined.

I have attached a file with the complete source for reproduction.

This is a showstopper for upgrading to the new compilers.

0 Kudos
14 Replies
Melanie_B_Intel
Employee
1,168 Views

Thanks for the report, (and the test case!) DPD200295115 is tracking the issue.

0 Kudos
René_M_
Beginner
1,168 Views

Is there any workaround I can employ while we wait for the fix/update? Downgrading my boost to an earlier version is not an option for me.

0 Kudos
Melanie_B_Intel
Employee
1,168 Views

As a workaround, can you change your source program to use double instead of float?

const double df(0.123f);

boost::lexical_cast<std::string>(df);

0 Kudos
René_M_
Beginner
1,168 Views

Succeed using c++11 string conversion as a workaround. Thanks.

0 Kudos
Arnstein_R_
Beginner
1,168 Views

Was this fixed with the new release 14.0.1 ?

0 Kudos
SergeyKostrov
Valued Contributor II
1,168 Views
>>...icpc_14_builtin_signbit_failure.cpp:(.text+0x65): undefined reference to `__builtin_signbit' >>...icpc_14_builtin_signbit_failure.cpp:(.text+0xa8): undefined reference to `__builtin_signbit' I'd like to suggest to try to add cmath header file simply for verification if it could fix the problem since this is how a set of sign functions is defined in the header: ... constexpr bool signbit(float __x){ return __builtin_signbit(__x); } constexpr bool signbit(double __x){ return __builtin_signbit(__x); } constexpr bool signbit(long double __x){ return __builtin_signbit(__x); } ...
0 Kudos
Arnstein_R_
Beginner
1,168 Views

 

I have verified that this not work with 14.0.1 either. I tried to include the cmath header both before and after the other headers, but the error is still the same.

0 Kudos
Melanie_B_Intel
Employee
1,168 Views

The fix isn't available yet. (the compiler issue is that __builtin_signbit is available for double, but not float). Are you able to use the workaround where you change the type from float to double?

const double d(0.123f);

boost::lexical_cast<:STRING>(d);

0 Kudos
Arnstein_R_
Beginner
1,168 Views

Thanks for the reply. I'm aware of this workaround, but it will require a significant amount of work for an issue that will go away (hopefully soon). I'll wait for a new update before moving to a new version of the compiler.

 

0 Kudos
Arnstein_R_
Beginner
1,168 Views

This bug is still not fixed in 14.0.2.

0 Kudos
Rich_F_1
New Contributor I
1,168 Views

I can confirm this is still a problem in
Version 14.0.2.144 Build 20140120

undefined reference to `__builtin_signbit' showed up
in the compile of qtwebkit Qt 5.2.1
qtwebkit/Source/WTF/wtf/MediaTime.cpp

Luckily the workaround from MathExtras.h for SOLARIS can be
easily applied in this case.

Change the two instances of signbit to copysign
from
return std::signbit(floatTime) ? negativeInfiniteTime() : positiveInfiniteTime();
to
return (std::copysign(1.0, floatTime) < 0) ? negativeInfiniteTime() : positiveInfiniteTime();

 

0 Kudos
mchajdas
Beginner
1,168 Views

I'm affected by the same issue, it's also triggered by other boost routines like the floating point classification.

As a workaround, I tried to implement a custom builtin using:

bool sb (float f) asm ("__builtin_signbit");
bool sb (float f) { return f >= 0.0f; }

Which resolves the linker errors, but the function is not called at runtime (incorrect calling convention, maybe?)

0 Kudos
Judith_W_Intel
Employee
1,168 Views

 

This was fixed on 2/7/2014 so it should be fixed in the next 14.0 update. Sorry for the inconvenience.

0 Kudos
Brandon_H_Intel
Employee
1,168 Views
HI all, Update 3 is now available and resolves this problem with __builtin_signbit, at least with the test cases I've got.
0 Kudos
Reply