View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004729 | Spring engine | General | public | 2015-04-08 19:53 | 2018-02-13 01:27 | ||||
Reporter | UnitedMarsupials | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | major | Reproducibility | have not tried | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 98.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0004729: Compiling with clang on FreeBSD dies because of math-functions | ||||||||
Description | Trying to build on FreeBSD-10.1 using clang-3.4.1 dies: ... In file included from /home/ports/games/spring/work/spring_98.0/rts/Rendering/Fonts/CFontTexture.h:5: In file included from /usr/include/c++/v1/unordered_map:350: In file included from /usr/include/c++/v1/__hash_table:19: /usr/include/c++/v1/cmath:641:9: error: no member named 'isinf' in the global namespace using ::isinf; ~~^ /usr/include/c++/v1/cmath:642:9: error: no member named 'isnan' in the global namespace; did you mean 'isnanf'? using ::isnan; ~~^ /usr/include/math.h:329:5: note: 'isnanf' declared here int isnanf(float) __pure2; ^ In file included from /home/ports/games/spring/work/spring_98.0/rts/aGui/Button.cpp:6: In file included from /home/ports/games/spring/work/spring_98.0/rts/Rendering/Fonts/glFont.h:10: In file included from /home/ports/games/spring/work/spring_98.0/rts/Rendering/Fonts/TextWrap.h:9: In file included from /home/ports/games/spring/work/spring_98.0/rts/Rendering/Fonts/CFontTexture.h:5: In file included from /usr/include/c++/v1/unordered_map:350: In file included from /usr/include/c++/v1/__hash_table:19: /usr/include/c++/v1/cmath:643:7: error: no member named 'isnormal' in the global namespace; did you mean 'math::isnormal'? using ::isnormal; /home/ports/games/spring/work/spring_98.0/rts/lib/streflop/SMath.h:291:13: note: 'math::isnormal' declared here inline int isnormal(Simple x) {return fpclassify(x) == STREFLOP_FP_NORMAL;} ... more errors listing other math-functions (isgreater, fpclassify ...) follow ... It is unclear, whether the implementations bundled with SpringRTS or the OS-provided functions should be used, though the latter seems more likely. | ||||||||
Steps To Reproduce | Try building the 0.98 release on FreeBSD-10 with clang (the default system compiler). | ||||||||
Additional Information | I'd be happy to offer access to my computer to a SpringRTS-developer to help resolve this issue. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
||||||
|
![]() |
|
abma (administrator) 2015-04-08 20:04 |
> It is unclear, whether the implementations bundled with SpringRTS or the OS-provided functions should be used, though the latter seems more likely. very likely the implementation of spring should be used because the lib streflop is used to maintain "sync" when playing over network. idk if its possible to fix this error by avoding including cmath in __hash_table:19. maybe a #include "lib/streflop/streflop_cond.h" in CFontTexture.h:4 fixes this. |
abma (administrator) 2015-04-08 20:09 |
reordering includes in Button.cpp could fix this, too |
UnitedMarsupials (reporter) 2015-04-08 20:15 Last edited: 2015-04-08 20:16 |
> very likely the implementation of spring should be used > because the lib streflop is used to maintain "sync" when > playing over network. I don't understand. Are you saying, streflop's implementation for isnan, fpclassify, signbit, and friends might return a result different from that of the OS' own? > reordering includes in Button.cpp could fix this, too Likely, other sources will need similar reshuffling... |
abma (administrator) 2015-04-08 20:23 |
> I don't understand. Are you saying, streflop's implementation for isnan, fpclassify, signbit, and friends might return a result different from that of the OS' own? maybe not these specific functions, but the functions which are implemented in streflop return different values across different computers. |
UnitedMarsupials (reporter) 2015-04-08 20:26 |
> maybe not these specific functions, but the functions which > are implemented in streflop return different values across > different computers. Understood. Still, for "noncontroversial" things like isnan, wouldn't you rather have the OS-provided (and, presumably, optimized) implementation over your own cross-platform one? |
abma (administrator) 2015-04-08 20:34 Last edited: 2015-04-08 20:37 |
the internal is prefered: https://github.com/spring/spring/blob/develop/rts/lib/streflop/SMath.h#L284 sorry, i don't know many details about streflop, so i have to investigate code, too. |
UnitedMarsupials (reporter) 2015-04-08 20:37 |
Now I am confused. The following two statements seem to conflict with each other: > very likely the implementation of spring should be used vs. > on other OS/compilers it uses the OS-provided ones... so it is prefered If the native implementation is preferred, then why try to use spring's? Is FreeBSD/clang combination considered especially suspect? |
abma (administrator) 2015-04-08 20:38 |
> on other OS/compilers it uses the OS-provided ones... so it is prefered thats wrong, sorry. |
UnitedMarsupials (reporter) 2015-04-08 20:55 |
Ok, yes, moving the #include "Rendering/Fonts/glFont.h" to the very top of Button.cpp helps compile that file. Now the same problem strikes in rts/aGui/LineEdit.cpp... |
abma (administrator) 2015-04-08 20:58 |
welcome in the "compile-hell" of spring :-) |
UnitedMarsupials (reporter) 2015-04-08 21:13 |
The following patch seems to fix the problem -- <cmath> needs to be included before SDL-anything. Because SDL headers are C-only and include <math.h>. Why does this matter, I don't know. Maybe, a libcpp thing: +++ rts/aGui/GuiElement.h 2015-04-08 15:06:26.000000000 -0400 @@ -4,4 +4,5 @@ #define GUIELEMENT_H +#include <cmath> #include <list> #include <SDL_events.h> |
abma (administrator) 2015-04-09 11:34 Last edited: 2015-04-09 11:40 |
replacing math::fabs with fabs very likely breaks sync, these fixes are imo invalid :-| but this needs testing... |
abma (administrator) 2015-04-09 12:05 Last edited: 2015-04-09 12:07 |
had some talk in chat with jK: real problem here: it's just that unordered_map must not include cmath and so polute our math functions space can this be workarrounded by some #define ? if not, unordered_map / __hash_table should to be fixed! |
abma (administrator) 2015-04-09 12:20 |
related? https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182657 |
UnitedMarsupials (reporter) 2015-04-09 15:29 Last edited: 2015-04-09 15:32 |
> replacing math::fabs with fabs very likely breaks sync, > these fixes are imo invalid :-| Are you saying, one of the implementations may not be standards-compliant? I can see, how results of cosine or even sqrt() may differ slightly between implementations (and platforms), but fabs? > real problem here: it's just that unordered_map must not include cmath I see. Maybe... > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182657 Possible. I'll try to come up with a simpler test case and ask around... |
Kloot (developer) 2018-02-13 01:27 |
the current clang build succeeds, whether it also does on freebsd should be retested. |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2015-04-08 19:53 | UnitedMarsupials | New Issue | |
2015-04-08 19:59 | abma | Severity | block => major |
2015-04-08 20:04 | abma | Note Added: 0014279 | |
2015-04-08 20:09 | abma | Note Added: 0014281 | |
2015-04-08 20:15 | UnitedMarsupials | Note Added: 0014282 | |
2015-04-08 20:16 | UnitedMarsupials | Note Edited: 0014282 | View Revisions |
2015-04-08 20:17 | abma | Relationship added | related to 0004731 |
2015-04-08 20:23 | abma | Note Added: 0014284 | |
2015-04-08 20:26 | UnitedMarsupials | Note Added: 0014287 | |
2015-04-08 20:34 | abma | Note Added: 0014288 | |
2015-04-08 20:37 | abma | Note Edited: 0014288 | View Revisions |
2015-04-08 20:37 | UnitedMarsupials | Note Added: 0014289 | |
2015-04-08 20:38 | abma | Note Added: 0014290 | |
2015-04-08 20:55 | UnitedMarsupials | Note Added: 0014294 | |
2015-04-08 20:58 | abma | Note Added: 0014296 | |
2015-04-08 21:13 | UnitedMarsupials | Note Added: 0014297 | |
2015-04-09 01:34 | UnitedMarsupials | File Added: patch-include-cmath | |
2015-04-09 01:35 | UnitedMarsupials | File Added: patch-rts-Sim-Path-IPathController.cpp | |
2015-04-09 01:35 | UnitedMarsupials | File Added: patch-rts-Sim-Projectiles-Unsynced-BitmapMuzzleFlame.cpp | |
2015-04-09 11:34 | abma | Note Added: 0014320 | |
2015-04-09 11:40 | abma | Note Edited: 0014320 | View Revisions |
2015-04-09 12:05 | abma | Note Added: 0014323 | |
2015-04-09 12:07 | abma | Note Edited: 0014323 | View Revisions |
2015-04-09 12:20 | abma | Note Added: 0014324 | |
2015-04-09 15:29 | UnitedMarsupials | Note Added: 0014325 | |
2015-04-09 15:32 | UnitedMarsupials | Note Edited: 0014325 | View Revisions |
2018-02-13 01:27 | Kloot | Status | new => resolved |
2018-02-13 01:27 | Kloot | Resolution | open => fixed |
2018-02-13 01:27 | Kloot | Note Added: 0018803 |