Page 1 sur 1

opensuse clang-3.8 hash_map/unordered_map

Publié : dim. févr. 11, 2018 10:01 am
par frederic han
Hello bernard,
there is a report of bad detection of hash_map with CC=clang on OpenSuSE Leap 42.3 leading to a compile failure.
cf: https://trac.sagemath.org/ticket/24696

The problem is that this configuration doesn't have hash_map but has unordered_map while the configure think there is hash_map:

Code : Tout sélectionner

checking for clock_gettime in -lrt... yes
checking unordered_map usability... no
checking unordered_map presence... no
checking for unordered_map... no
checking ext/hash_map usability... yes
checking ext/hash_map presence... yes
checking for ext/hash_map... yes
checking tr1/unordered_map usability... yes
checking tr1/unordered_map presence... yes
checking for tr1/unordered_map... yes
checking hash_map usability... yes
checking hash_map presence... yes
checking for hash_map... yes
checking pwd.h usability... yes
cf:
https://trac.sagemath.org/ticket/24696#comment:3

Re: opensuse clang-3.8 hash_map/unordered_map

Publié : dim. févr. 11, 2018 10:40 am
par parisse
There is already code to detect hash_map in configure.in and index.h. In index.h

Code : Tout sélectionner

#if defined C11_UNORDERED_MAP && (defined __clang__ || !defined __APPLE__)
#undef HASH_MAP
#undef EXT_HASH_MAP
#undef UNORDERED_MAP
#define HASH_MAP_NAMESPACE std
#define hash_map unordered_map
#include <unordered_map>
#endif
How should I change it without breaking other ports (macos/ios and emscripten)?

Re: opensuse clang-3.8 hash_map/unordered_map

Publié : dim. févr. 11, 2018 8:48 pm
par frederic han
it seems the guilty is just after:
removing the !defined(__clang__) seems to fix the pb. Does it breaks things for you?

Code : Tout sélectionner

+diff --git a/giac-1.4.9.45-orig/src/src/index.h b/giac-1.4.9.45/src/src/index.h
+index e74be63..8ed12f9 100755
+--- a/src/index.h
++++ b/src/index.h
+@@ -42,7 +42,7 @@
+ #include <unordered_map>
+ #endif
+ 
+-#if defined UNORDERED_MAP  && !defined(__clang__) && !defined(VISUALC) // && !defined(__APPLE__)
++#if defined UNORDERED_MAP  && !defined(VISUALC) // && !defined(__APPLE__)
+ #include <tr1/unordered_map>
+ #define HASH_MAP_NAMESPACE std::tr1
+ #define hash_map unordered_map

Re: opensuse clang-3.8 hash_map/unordered_map

Publié : lun. févr. 12, 2018 9:54 am
par parisse
Seems to work, I have committed to geogebra, if it works also there, it should be ok.