[FIXED] 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

[FIXED] 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

[FIXED] 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

Post by SpliFF »

Code: Select all

g++ -o build/rts/Lua/LuaSyncedCtrl.o -c -fsingle-precision-constant -frounding-math -fsignaling-nans -mieee-fp -O2 -pipe -fno-strict-aliasing -fvisibility=hidden -mfpmath=387 -pthread -fsingle-precision-constant -frounding-math -fsignaling-nans -mieee-fp -O2 -pipe -fno-strict-aliasing -fvisibility=hidden -mfpmath=387 -pthread -D_SZ_ONE_DIRECTORY -D_GNU_SOURCE=1 -D_REENTRANT -DSTREFLOP_X87 -DSYNCCHECK -DNO_AVI -DDIRECT_CONTROL_ALLOWED -Irts -Irts/System -Irts/lib/luabind -Irts/lib/lua/include -I/usr/include -I/usr/include/GL -I/usr/include/freetype2 -I/usr/include/SDL -I/usr/include/ogg -I/usr/include/vorbis -I/usr/include/python2.5 -I/usr/include/python2.4 -I/usr/lib64/jvm/sun-jdk-1.6/include -I/usr/lib64/jvm/sun-jdk-1.6/include/linux rts/Lua/LuaSyncedCtrl.cpp
In file included from rts/Lua/LuaSyncedCtrl.cpp:55:
rts/System/myMath.h: In function 'shortint2 GetHAndPFromVector(const float3&)':
rts/System/myMath.h:89: error: call of overloaded 'asin(const float&)' is ambiguous
/usr/include/bits/mathcalls.h:57: note: candidates are: double asin(double)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.4/include/g++-v4/cmath:123: note:                 long double std::asin(long double)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.4/include/g++-v4/cmath:119: note:                 float std::asin(float)
rts/lib/streflop/SMath.h:528: note:                 streflop::Extended streflop::asin(streflop::Extended)
rts/lib/streflop/SMath.h:420: note:                 streflop::Double streflop::asin(streflop::Double)
rts/lib/streflop/SMath.h:230: note:                 streflop::Simple streflop::asin(streflop::Simple)
rts/Lua/LuaSyncedCtrl.cpp: In static member function 'static int LuaSyncedCtrl::SetUnitCloak(lua_State*)':
rts/Lua/LuaSyncedCtrl.cpp:1226: error: call of overloaded 'fabsf(const float&)' is ambiguous
/usr/include/bits/mathcalls.h:182: note: candidates are: float fabsf(float)
rts/lib/streflop/SMath.h:353: note:                 streflop::Simple streflop::fabsf(streflop::Simple)
scons: *** [build/rts/Lua/LuaSyncedCtrl.o] Error 1
scons: building terminated because of errors.

ERROR: games-strategy/spring-0.76_p1-r2 failed.
My system is 64bit. Not sure what other info you need. My Gentoo is pretty up-to-date and I just followed the step-by-step instructions found on the official site
Last edited by SpliFF on 30 Jul 2008, 11:24, edited 1 time in total.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

Post by BrainDamage »

looks likce gcc is becoming overpicky, could you show the faulty lines of code?
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

Post by SpliFF »

I believe GCC 4.2/4.3 is enforcing the rules of C99 or it's a namespace thing (rather than a bug in the compiler). It is even more complicated because asin is also being overloaded by the streflop library.

I thought it would be simple enough to fix. I changed

rts/System/myMath:89

Code: Select all

int iy = (int) (asin(vec.y)*(SHORTINT_MAXVALUE/PI));
to

Code: Select all

int iy = (int) (asin(static_cast<float>(vec.y))*(SHORTINT_MAXVALUE/PI));
I also tried double and Simple (a float type defined by streflop) but I kept getting variations on the same error.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: 0.76_p1-r2 compile error on Gentoo (ambiguous asin)

Post by SpliFF »

I've just discovered this is fixed in SVN.

Code: Select all

int iy = (int) (streflop::asin(vec.y) * (SHORTINT_MAXVALUE / PI));
Post Reply

Return to “Help & Bugs”