hash_map et obso

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

Répondre
frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

hash_map et obso

Message par frederic han » mar. juil. 15, 2014 10:37 am

Bonjour bernard,

J'ai parfois remarque des warning sur des fonctions obsoletes, mais ca a l'air pouvoir aussi donner des erreurs et ca bloque le spkg
du moins sous OS10.9

http://trac.sagemath.org/attachment/tic ... ilderr.log

Est ce que vca serait possible d'arranger cela?

D'avance merci

Frederic

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: hash_map et obso

Message par parisse » mar. juil. 15, 2014 1:14 pm

Tu as quoi dans config.h pour EXT_HASH_MAP et HASH_MAP? Moi j'ai

Code : Tout sélectionner

/* Define if <ext/hash_map> header is aviailable */
#define EXT_HASH_MAP 1

/* Define if <hash_map> header is aviailable */
/* #undef HASH_MAP */


frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

Re: hash_map et obso

Message par frederic han » mar. juil. 15, 2014 3:11 pm

Salut,
je n'ai pas de macos 10.9, c'est la personne qui a teste le spkg qui est sous 10.9.
Je vois ca dans le log qu'il a donne:

Code : Tout sélectionner

n file included from
394	/usr/local/src/sage/sage/local/lib/gcc/x86_64-apple-darwin13.2.0/4.7.3/../../../../include/c++/4.7.3/backward/hash_map:61:0,
395	                 from index.h:50,
396	                 from vecteur.h:21,
397	                 from gen.h:62,
398	                 from input_lexer.ll:53:
399	/usr/local/src/sage/sage/local/lib/gcc/x86_64-apple-darwin13.2.0/4.7.3/../../../../include/c++/4.7.3/backward/backward_warning.h:33:2:
400	warning: #warning This file includes at least one deprecated or
401	antiquated header which may be removed without further notice at a
402	future date. Please use a non-deprecated interface with equivalent
403	functionality instead. For a listing of replacement headers and
404	interfaces, consult the file backward_warning.h. To disable this
405	warning use -Wno-deprecated. [-Wcpp]
406	In file included from vecteur.h:21:0,
407	                 from gen.h:62,
408	                 from input_lexer.ll:53:
409	index.h:550:11: error: 'hash_map' in namespace 'std' does not name a
410	type
En revanche sous BSD11 j'ai eu des warning tres similaires, et j'ai aussi le config.h

Code : Tout sélectionner

/* Define if <ext/hash_map> header is aviailable */
#define EXT_HASH_MAP 1

/* Define if <hash_map> header is aviailable */
/* #undef HASH_MAP */
car il trouve ce header mais il doit savoir que c'est obsolete!
En revanche si j'enleve ce define la compilation marche bien sauf dans:

Code : Tout sélectionner

modpoly.cc:4752:19: error: variable length array of non-POD element type 'inttype' (aka 'giac::gen')
      inttype tabp[np+1]; // dense rep of the polynomial
                  ^
modpoly.cc:4755:19: error: variable length array of non-POD element type 'inttype' (aka 'giac::gen')
      inttype tabq[nq+1]; // dense rep of the polynomial
---------------------              
et idem dans
puis idem avec modfactor.cc

c'est bizarre j'ai retouve des patch a moi pour corriger ca dans freebsd j'ai du oublier de les soumettre. :oops:

l'un ne passe peut etre plus tel quel mais en faisant des modifs identiques j'ai pu terminer la compilation avec clang sous bsd11

Code : Tout sélectionner

--- src/modpoly.cc.orig	2014-05-01 13:30:07.000000000 +0200
+++ src/modpoly.cc	2014-05-01 13:29:45.000000000 +0200
@@ -4455,12 +4455,17 @@
       return giac_gcd_modular_algo1(p,q,d);
     bool res=true;
     try {
-      inttype tabp[np+1]; // dense rep of the polynomial
-      if (!polynome2tab(p,np,tabp))
+      inttype * tabp=new inttype[np+1]; // dense rep of the polynomial
+      if (!polynome2tab(p,np,tabp)){
+	delete [] tabp; //cf clang
 	return false;
-      inttype tabq[nq+1]; // dense rep of the polynomial
-      if (!polynome2tab(q,nq,tabq))
+      }
+      inttype * tabq=new inttype[nq+1]; // dense rep of the polynomial
+      if (!polynome2tab(q,nq,tabq)){
+	delete [] tabp; //cf clang
+	delete [] tabq; //cf clang
 	return false;
+      }
       int nd;
       inttype * res;
       ntlgcd(tabp,np,tabq,nq,res,nd);
@@ -4471,6 +4476,8 @@
 	p = p/d;
 	q = q/d;
       }
+    delete [] tabp; // cf clang
+    delete [] tabq; // cf clang
     } catch(std::runtime_error & e){
       res=false;
     }

Code : Tout sélectionner

--- src/modfactor.cc.orig	2014-05-01 13:30:20.000000000 +0200
+++ src/modfactor.cc	2014-05-01 13:29:26.000000000 +0200
@@ -1316,11 +1316,13 @@
     }
     try {
       int n=q.lexsorted_degree();
-      inttype tab[n+1]; // dense rep of the polynomial
+      inttype * tab=new inttype[n+1]; // dense rep of the polynomial
       inttype * result[n]; // array of dense rep of the polynomial
       int resultdeg[n];
-      if (!polynome2tab(q,n,tab))
+      if (!polynome2tab(q,n,tab)){
+	delete [] tab; //cf clang
 	return false;
+      }
       // cerr << "NTL factor begins" << endl;
       int size=ntlfactor(tab,n,result,resultdeg,debug); 
       // cerr << "NTL factor end" << endl;
@@ -1329,6 +1331,7 @@
 	v.push_back(tab2polynome(result[i],resultdeg[i]));
 	delete [] result[i];
       }
+      delete [] tab; // cf clang
     } catch (std::runtime_error & e){
     }

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: hash_map et obso

Message par parisse » mar. juil. 15, 2014 4:19 pm

Je fais les modifs dans modfactor et modpoly. Le probleme de hash_map ne devrait pas en etre vraiment un, parce que autoconf devrait desactiver tout simplement EXT_HASH_MAP si clang decide de supprimer le support. Bizarrement le log de configure que tu as fait suivre semble indiquer qu'il reconnait les 2. Peut-etre faut-il desactiver le deuxieme dans configure.in, je veux dire

Code : Tout sélectionner

AC_CHECK_HEADER(hash_map,AC_DEFINE(HASH_MAP,1, [Define if <hash_map> header is aviailable]))

frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

Re: hash_map et obso

Message par frederic han » mar. juil. 15, 2014 4:41 pm

sous inux lorsque je compile le spkg j'ai cela dans config.h:

Code : Tout sélectionner

/* Define if <ext/hash_map> header is aviailable */
#define EXT_HASH_MAP 1

/* Define if <hash_map> header is aviailable */
#define HASH_MAP 1
mais ca passe bien.


NB: Je pars en vacance avec peu d'internet ce soir!
a+

jondo
Messages : 8
Inscription : mar. juil. 15, 2014 8:29 am

Re: hash_map et obso

Message par jondo » mer. juil. 16, 2014 7:05 am

frederic han a écrit : je n'ai pas de macos 10.9, c'est la personne qui a teste le spkg qui est sous 10.9.
Bernard, if you need more info: The corresponding Sage ticket is http://trac.sagemath.org/ticket/12375.

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: hash_map et obso

Message par parisse » mer. juil. 16, 2014 7:22 am

Problem is I can't test myself (I have a 3 years old mac, and I don't want to upgrade it to OS X.9 because I'm almost certain it will break something, and even if I wanted to upgrade, I don't have enough Internet bandwidth during summer). Is there some way I can compile on a server where the error happens?
Or is there some way to make hash_map work on top of unordered_map on "new" systems? (I don't understand why there is a need to remove hash_map by the way).

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: hash_map et obso

Message par parisse » mer. juil. 16, 2014 7:31 am

By the way, what happens if in index.h, one replaces

Code : Tout sélectionner

#if defined UNORDERED_MAP && !defined(__APPLE__) && !defined(__clang__) && !defined(VISUALC)
#include <tr1/unordered_map>
#define HASH_MAP_NAMESPACE std::tr1
#define hash_map unordered_map
#else // UNORDERED_MAP
..
#endif // UNORDERED_MAP
by something like

Code : Tout sélectionner

#undef HASH_MAP
#define HASH_MAP_NAMESPACE std
#define hash_map unordered_map

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: hash_map et obso

Message par parisse » mer. juil. 16, 2014 11:33 am

I tried to modify configure.in and index.h in order to support unordered_map in namespace std, it's in
http://www-fourier.ujf-grenoble.fr/~par ... .2.tar.bz2

jondo
Messages : 8
Inscription : mar. juil. 15, 2014 8:29 am

Re: hash_map et obso

Message par jondo » mer. juil. 16, 2014 1:27 pm

Unfortunately I also cannot test your changes. Let's wait until Frederic is back and creates a new spkg.

Répondre