Help with Square Root Errors?

Help with Square Root Errors?

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
rdragonrydr
Posts: 5
Joined: 14 Dec 2016, 02:41

Help with Square Root Errors?

Post by rdragonrydr »

Hello. I am new here, and I was hoping to avoid this, but I have a Raspberry Pi 3 (and an Odroid xu3, but I'll get to that later...) that I would like to build Spring RTS for. Of course, there is no such package for arm in the Ubuntu ARM or Raspbian repos.

I have downloaded a large number of packages, which are listed below. I have had no success in getting Java AWT and some other java items located (and I don't know what provides them), so I have disabled Java AIs.

Please also note that I needed to install boost dev and dbg manually, as they were apparently needed and not in the debian install programs command.

Code: Select all

sudo apt-get install sudo apt-get install build-essential zlib1g-dev libfreetype6-dev cmake libsdl2-dev libopenal-dev libglew-dev zip libvorbis-dev libxcursor-dev libdevil-dev libboost-system1.55-dev libboost-thread1.55-dev libboost-regex1.55-dev libboost-serialization1.55-dev libboost-program-options1.55-dev libboost-chrono1.55-dev libunwind-dev  libboost-filesystem1.55-dev libboost-signals1.55-dev libboost-test1.55-dev xsltproc libfontconfig1-dev libcurl4-openssl-dev
sudo apt-get install build-essential zlib1g-dev libfreetype6-dev cmake libsdl2-dev libopenal-dev libglew-dev zip libvorbis-dev libxcursor-dev libdevil-dev libboost-system1.55-dev libboost-thread1.55-dev libboost-regex1.55-dev libboost-serialization1.55-dev libboost-program-options1.55-dev libboost-chrono1.55-dev libunwind-dev  libboost-filesystem1.55-dev libboost-signals1.55-dev libboost-test1.55-dev xsltproc libfontconfig1-dev libcurl4-openssl-dev
sudo apt-get install cmake-gui
apt-cache search java
sudo apt-get install openjdk-8-jdk openjdk-8-jre
sudo apt-get install libboost-dev
sudo apt-get install libboost
apt-cache search libboost
sudo apt-get install libboost-dbg libboost-all-dev
sudo apt-get purge openjdk*
sudo apt-get install oracle-java8-jdk 
sudo apt-get install openjdk-8-jre

I have run Cmake Gui and have set march to armv8-a, the type that is used in the Pi 3 (Well, there's armv8-a-ecc [or very similar] too, but I don't know what that is). CmakeCache is attached.

If I run make now, it gets to six percent and stops while compiling assimp, with this error:

Code: Select all

In file included from /home/pi/spring_103.0/rts/lib/assimp/contrib/poly2tri/poly2tri/sweep/../common/utils.h:37:0,
                 from /home/pi/spring_103.0/rts/lib/assimp/contrib/poly2tri/poly2tri/sweep/sweep.cc:35:
/home/pi/spring_103.0/rts/System/FastMath.h: In function ‘float fastmath::sqrt_sse(float)’:
/home/pi/spring_103.0/rts/System/FastMath.h:82:16: error: ‘sqrt’ was not declared in this scope
   return sqrt(x);
                ^
/home/pi/spring_103.0/rts/System/FastMath.h:82:16: note: suggested alternatives:
In file included from /home/pi/spring_103.0/rts/lib/streflop/streflop.h:76:0,
                 from /home/pi/spring_103.0/rts/lib/streflop/streflop_cond.h:13,
                 from /home/pi/spring_103.0/rts/lib/assimp/contrib/poly2tri/poly2tri/sweep/../common/shapes.h:40,
                 from /home/pi/spring_103.0/rts/lib/assimp/contrib/poly2tri/poly2tri/sweep/advancing_front.h:35,
                 from /home/pi/spring_103.0/rts/lib/assimp/contrib/poly2tri/poly2tri/sweep/sweep.cc:34:
/home/pi/spring_103.0/rts/lib/streflop/SMath.h:425:16: note:   ‘streflop::sqrt’
  inline Double sqrt(Double x) {return streflop_libm::__ieee754_sqrt(x);}
                ^
/home/pi/spring_103.0/rts/lib/streflop/SMath.h:425:16: note:   ‘streflop::sqrt’
rts/lib/assimp/code/CMakeFiles/assimp.dir/build.make:2906: recipe for target 'rts/lib/assimp/code/CMakeFiles/assimp.dir/__/contrib/poly2tri/poly2tri/sweep/sweep.cc.o' failed
make[2]: *** [rts/lib/assimp/code/CMakeFiles/assimp.dir/__/contrib/poly2tri/poly2tri/sweep/sweep.cc.o] Error 1
CMakeFiles/Makefile2:468: recipe for target 'rts/lib/assimp/code/CMakeFiles/assimp.dir/all' failed
make[1]: *** [rts/lib/assimp/code/CMakeFiles/assimp.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I do not know what this code does, nor why it is failing. I am using the latest tar.lzma tarball from the compiling spring wiki page, since the git command stopped at the shard stage with a "could not find repository" error.




If for some reason this will not work at all on the Raspberry Pi, I can also try building on my Odroid, as I would also like to have this working there, and I suspect it would run there much better anyway. Be that as it may, I am unaware presently (if there is a reason, please let me know) as to why there might be any differences in the build process, so I am building on the Pi, since it is easier to clean up after.

Thank you!
Attachments
CMakeCache.txt
Settings for Cmake
(50.28 KiB) Downloaded 3 times
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Help with Square Root Errors?

Post by Kloot »

On line 82 of rts/System/FastMath.h, replace

Code: Select all

return sqrt(x);
by

Code: Select all

return streflop::sqrt(x);
but to save you some future disappointment, know that while the build may succeed you won't be able to play online with it on any non-x86 device.
rdragonrydr
Posts: 5
Joined: 14 Dec 2016, 02:41

Re: Help with Square Root Errors?

Post by rdragonrydr »

I did see that warning. Ah well. That does certainly explain why there isn't a version in the default repositories.

Thanks for letting me know how to fix the error. I have never seen such a fast and helpful response on the other forums I have visited!
rdragonrydr
Posts: 5
Joined: 14 Dec 2016, 02:41

Re: Help with Square Root Errors?

Post by rdragonrydr »

More compiling difficulties: (sorry to bother you again)

I am now getting a new error at 8%, compiling StreflopC.cpp

Code: Select all

[  0%] Built target minizip
[  7%] Built target assimp
[  8%] Built target squish
[  8%] Built target CUtils
  Configuring Version files ...
-- SPRING_ENGINE version fetched from VERSION file: 103.0
Spring engine version: 103.0 ()
[  8%] Built target generateVersionFiles
[  8%] Building CXX object rts/lib/streflop/CMakeFiles/streflop.dir/streflopC.cpp.o
{standard input}: Assembler messages:
{standard input}:53: Error: bad instruction `fstcw [sp,#6]'
{standard input}:64: Error: bad instruction `fclex '
{standard input}:65: Error: bad instruction `fldcw [sp,#6]'
{standard input}:69: Error: bad instruction `stmxcsr [sp,#8]'
{standard input}:81: Error: bad instruction `ldmxcsr [sp,#8]'
{standard input}:135: Error: bad instruction `fstcw [sp,#6]'
{standard input}:147: Error: bad instruction `fclex '
{standard input}:148: Error: bad instruction `fldcw [sp,#6]'
{standard input}:152: Error: bad instruction `stmxcsr [sp,#8]'
{standard input}:164: Error: bad instruction `ldmxcsr [sp,#8]'
rts/lib/streflop/CMakeFiles/streflop.dir/build.make:110: recipe for target 'rts/lib/streflop/CMakeFiles/streflop.dir/streflopC.cpp.o' failed
make[2]: *** [rts/lib/streflop/CMakeFiles/streflop.dir/streflopC.cpp.o] Error 1
CMakeFiles/Makefile2:394: recipe for target 'rts/lib/streflop/CMakeFiles/streflop.dir/all' failed
make[1]: *** [rts/lib/streflop/CMakeFiles/streflop.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
There don't seem to be any details as to the actual code involved. It just says that some instructions are bad. How on earth does that happen?

I thank you for any help you may give me in advance.
Attachments
streflopC.cpp
(467 Bytes) Downloaded 4 times
streflopC.h
(548 Bytes) Downloaded 3 times
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Help with Square Root Errors?

Post by Kloot »

Long story.

In the root CMakeLists.txt file, find the line

Code: Select all

add_definitions(-DSTREFLOP_SSE)
and comment it out by placing a # in front. Save, then rm -rf *all* generated (c)make data and rebuild from scratch. You must also pass NOT_USING_STREFLOP=1 as an argument to make or this won't work, as well as replace the streflop::sqrt change in FastMath.h with std::sqrt.
rdragonrydr
Posts: 5
Joined: 14 Dec 2016, 02:41

Re: Help with Square Root Errors?

Post by rdragonrydr »

I think I am *starting* to understand this.

Commenting that line disables the sse function of the earlier error (making that fix possibly irrelevant?) and replaces it with math:: from streflop_cond.h. (or I am an idiot...)

However, this seems to not actually include a sqrt function, so it fails:
// We are using fastmath::sqrt_sse instead!
//using std::sqrt;

Code: Select all

In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:496:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector2.inl: In member function ‘TReal aiVector2t<TReal>::Length() const’:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector2.inl:72:9: error: ‘sqrt’ is not a member of ‘math’
  return math::sqrt( SquareLength());
         ^
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector2.inl:72:9: note: suggested alternatives:
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note:   ‘sqrt’
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^

Changing that line does NOT fix the problem, though:


Code: Select all

In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:18:38: error: ‘float math::sqrt(float)’ conflicts with a previous declaration
  #define _const __attribute__((const))
                                      ^
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:280:22: note: in expansion of macro ‘_const’
  float sqrt(float x) _const;
                      ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:482:3: note: previous declaration ‘constexpr float std::sqrt(float)’
   sqrt(float __x)
   ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/texture.h:73:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/scene.h:49,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:138,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/./Compiler/pushpack1.h:28:61: warning: ‘gcc_struct’ attribute directive ignored [-Wattributes]
 # define PACK_STRUCT __attribute__ ((gcc_struct, __packed__))
                                                             ^
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/texture.h:106:3: note: in expansion of macro ‘PACK_STRUCT’
 } PACK_STRUCT;
   ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/material.h:483:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/scene.h:53,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:138,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/./Compiler/pushpack1.h:28:61: warning: ‘gcc_struct’ attribute directive ignored [-Wattributes]
 # define PACK_STRUCT __attribute__ ((gcc_struct, __packed__))
                                                             ^
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/material.h:527:3: note: in expansion of macro ‘PACK_STRUCT’
 } PACK_STRUCT;
   ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:499:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/quaternion.inl: In instantiation of ‘aiQuaterniont<TReal>::aiQuaterniont(const aiMatrix3x3t<TReal>&) [with TReal = float]’:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:512:27:   required from here
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/quaternion.inl:77:23: error: call of overloaded ‘sqrt(float&)’ is ambiguous
   TReal s = math::sqrt( t) * static_cast<TReal>(2.0);
                       ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:486:3: note: candidate: constexpr long double std::sqrt(long double)
   sqrt(long double __x)
   ^
/usr/include/c++/5/cmath:482:3: note: candidate: constexpr float std::sqrt(float)
   sqrt(float __x)
   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note: candidate: double sqrt(double)
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:281:15: note: candidate: float math::sqrt(float)
  inline float sqrt(float x) {
               ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:499:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/quaternion.inl:86:23: error: call of overloaded ‘sqrt(float)’ is ambiguous
   TReal s = math::sqrt( static_cast<TReal>(1.0) + pRotMatrix.a1 - pRotMatrix.b2 - pRotMatrix.c3) * static_cast<TReal>(2.0);
                       ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:486:3: note: candidate: constexpr long double std::sqrt(long double)
   sqrt(long double __x)
   ^
/usr/include/c++/5/cmath:482:3: note: candidate: constexpr float std::sqrt(float)
   sqrt(float __x)
   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note: candidate: double sqrt(double)
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:281:15: note: candidate: float math::sqrt(float)
  inline float sqrt(float x) {
               ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:499:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/quaternion.inl:95:23: error: call of overloaded ‘sqrt(float)’ is ambiguous
   TReal s = math::sqrt( static_cast<TReal>(1.0) + pRotMatrix.b2 - pRotMatrix.a1 - pRotMatrix.c3) * static_cast<TReal>(2.0);
                       ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:486:3: note: candidate: constexpr long double std::sqrt(long double)
   sqrt(long double __x)
   ^
/usr/include/c++/5/cmath:482:3: note: candidate: constexpr float std::sqrt(float)
   sqrt(float __x)
   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note: candidate: double sqrt(double)
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:281:15: note: candidate: float math::sqrt(float)
  inline float sqrt(float x) {
               ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:499:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/quaternion.inl:103:23: error: call of overloaded ‘sqrt(float)’ is ambiguous
   TReal s = math::sqrt( static_cast<TReal>(1.0) + pRotMatrix.c3 - pRotMatrix.a1 - pRotMatrix.b2) * static_cast<TReal>(2.0);
                       ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:486:3: note: candidate: constexpr long double std::sqrt(long double)
   sqrt(long double __x)
   ^
/usr/include/c++/5/cmath:482:3: note: candidate: constexpr float std::sqrt(float)
   sqrt(float __x)
   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note: candidate: double sqrt(double)
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:281:15: note: candidate: float math::sqrt(float)
  inline float sqrt(float x) {
               ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl: In instantiation of ‘TReal aiVector3t<TReal>::Length() const [with TReal = float]’:
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:99:17:   required from ‘aiVector3t<TReal>& aiVector3t<TReal>::Normalize() [with TReal = float]’
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/camera.h:191:51:   required from here
/home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:94:19: error: call of overloaded ‘sqrt(float)’ is ambiguous
  return math::sqrt( SquareLength());
                   ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:115,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/c++/5/cmath:486:3: note: candidate: constexpr long double std::sqrt(long double)
   sqrt(long double __x)
   ^
/usr/include/c++/5/cmath:482:3: note: candidate: constexpr float std::sqrt(float)
   sqrt(float __x)
   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:61,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/usr/include/arm-linux-gnueabihf/bits/mathcalls.h:156:1: note: candidate: double sqrt(double)
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 ^
In file included from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/vector3.inl:49:0,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/types.h:497,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/Logger.hpp:47,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/../include/assimp/DefaultLogger.hpp:46,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/AssimpPCH.h:135,
                 from /home/odroid/Downloads/spring_103.0/rts/lib/assimp/code/Assimp.cpp:45:
/home/odroid/Downloads/spring_103.0/rts/System/FastMath.h:281:15: note: candidate: float math::sqrt(float)
  inline float sqrt(float x) {
               ^
rts/lib/assimp/code/CMakeFiles/assimp.dir/build.make:62: recipe for target 'rts/lib/assimp/code/CMakeFiles/assimp.dir/Assimp.cpp.o' failed
make[2]: *** [rts/lib/assimp/code/CMakeFiles/assimp.dir/Assimp.cpp.o] Error 1
CMakeFiles/Makefile2:512: recipe for target 'rts/lib/assimp/code/CMakeFiles/assimp.dir/all' failed
make[1]: *** [rts/lib/assimp/code/CMakeFiles/assimp.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

How do I fix the square root problem there without further breaking the build?

Or do I take the hint and use the X86 version and give up on trying to make it work on ARM?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Help with Square Root Errors?

Post by Kloot »

I'm curious how far an r-pi build could get, but it seems compilation without streflop enabled is quite broken so for now I wouldn't try.
rdragonrydr
Posts: 5
Joined: 14 Dec 2016, 02:41

Re: Help with Square Root Errors?

Post by rdragonrydr »

What does streflop do? I can't figure out the names. :(

Would I need to track down exactly what sqrt function is needed for each and manually assign, or is there one that is somehow broken or disabled that serves all of them (Yes, it's probably the SSE one that normally does that, but why can't a different one be used)?

I can't imagine that it all depends on that; there have to be backups, right? Or did I step into a case where the alternative is no longer functional because it isn't normally tested?

I'd like to try to understand the problem and perhaps find a way to fix it, but I have no clue what anything does or what its name even means. :?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Help with Square Root Errors?

Post by FLOZi »

rdragonrydr wrote:What does streflop do? I can't figure out the names. :(
https://launchpad.net/~kip/+archive/ubuntu/streflop

tl;dr manages calculations in a cross-platform way required for synchronous game state.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Help with Square Root Errors?

Post by Kloot »

rdragonrydr wrote:Or did I step into a case where the alternative is no longer functional because it isn't normally tested?
Essentially.

However, if you know how to use git, you can instead clone and build the development branch of our repository (or just download this) which contains several fixes for compiling without streflop. Just set ENABLE_STREFLOP to FALSE in the root CMakeLists.txt and it should progress a lot further.
Post Reply

Return to “Help & Bugs”