Page 1 sur 2

clang 6.0.1

Publié : jeu. oct. 25, 2018 11:53 am
par frederic han
Hi bernard,
on this topic,

https://trac.sagemath.org/ticket/26315#comment:14

dimpase suggest the following patch to build giac with clang 6.0.1


https://trac.sagemath.org/raw-attachmen ... g601.patch

could you tell us if you plan to include it in giac?
Best
Frederic

Re: clang 6.0.1

Publié : jeu. oct. 25, 2018 2:40 pm
par parisse
Ok, I have patched with unsigned() and int(). Does this really stop compilation or is it a warning? Because I don't like to change int to unsigned, this is dangerous (seems safe here).

Re: clang 6.0.1

Publié : dim. oct. 28, 2018 1:07 pm
par frederic han
Thank you,
Yes they were errors. NB dimpase also mention that register gives a warning that will become an error in C++17

cf: https://trac.sagemath.org/ticket/26315#comment:19

Re: clang 6.0.1

Publié : mar. oct. 30, 2018 11:28 am
par dimpase
One further small patch for clang 6.0.1 I need to make giac build is discussed here https://trac.sagemath.org/ticket/26315#comment:21

It's just

Code : Tout sélectionner

--- a/src/misc.h
+++ b/src/misc.h
@@ -23,6 +23,7 @@
 #include "gen.h"
 #include "unary.h"
 #include "symbolic.h"
+#include <sys/time.h>
 
 #ifndef NO_NAMESPACE_GIAC
 namespace giac {
 
With this and the previous one in this thread, I can build on FreeBSD 12.0 - which hopefully will allow me to re-enable the port of giac on this system.

Re: clang 6.0.1

Publié : mer. oct. 31, 2018 4:13 pm
par parisse
Ok, I'm adding

Code : Tout sélectionner

#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif

Re: clang 6.0.1

Publié : jeu. nov. 01, 2018 11:22 pm
par dimpase
parisse a écrit :
jeu. oct. 25, 2018 2:40 pm
Ok, I have patched with unsigned() and int(). Does this really stop compilation or is it a warning? Because I don't like to change int to unsigned, this is dangerous (seems safe here).
I tried this with 1.5.0-11 (with the extra sys/time.h patch, as it's not in this version yet), and I still have one error:

solve.cc:5811:49: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in initializer list [-Wc++11-narrowing]
order_t order_={static_cast<short>(order),unsigned(lexvars)};
^~~~~~~~~~~~~~~~~
solve.cc:5811:49: note: insert an explicit cast to silence this issue
order_t order_={static_cast<short>(order),unsigned(lexvars)};
^~~~~~~~~~~~~~~~~
static_cast<unsigned char>( )

Re: clang 6.0.1

Publié : ven. nov. 02, 2018 2:12 pm
par parisse
Perhaps

Code : Tout sélectionner

      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};

Re: clang 6.0.1

Publié : dim. nov. 18, 2018 12:15 am
par dimpase
This still gives

Code : Tout sélectionner

solve.cc:5812:49: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in
      initializer list [-Wc++11-narrowing]
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                ^~~~~~~~~~~~~~~~~~~~~
solve.cc:5812:49: note: insert an explicit cast to silence this issue
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                ^~~~~~~~~~~~~~~~~~~~~
                                                static_cast<unsigned char>( )
solve.cc:5812:71: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in
      initializer list [-Wc++11-narrowing]
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                                      ^~~~~~~~~~~~~~~~~
solve.cc:5812:71: note: insert an explicit cast to silence this issue
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                                      ^~~~~~~~~~~~~~~~~
                                                                      static_cast<unsigned char>( )

Re: clang 6.0.1

Publié : dim. nov. 18, 2018 12:26 am
par dimpase
Build succeeds if I do what the compiler says, i.e. write

Code : Tout sélectionner

order_t order_={static_cast<short>(order),
                static_cast<unsigned char>(unsigned(lexvars/256)),
                static_cast<unsigned char>(unsigned(lexvars))};

Re: clang 6.0.1

Publié : dim. nov. 18, 2018 7:14 am
par parisse
Ok, I changed unsigned to unsigned char. There is certainly a flag to avoid this warning, converting an unsigned (or an int) to an unsigned char is quite common...

Re: clang 6.0.1

Publié : mar. nov. 20, 2018 11:22 am
par dimpase
It's not a warning, it's an error. Probably, conforming to a recent C++1x standard, I don't know.

Re: clang 6.0.1

Publié : mer. nov. 21, 2018 1:49 pm
par dimpase
the unstable tarball (dated 18/11/18) builds OK with clang 6.0.1, thanks!

I noticed that hevea is a requirement for a successful install, but there is no dedicated configure option to disable it.
Is it intentional, or one can still somehow use configure to disable hevea?

Re: clang 6.0.1

Publié : mer. nov. 21, 2018 2:36 pm
par parisse
It should be possible to build without hevea. Since I have it installed I don't know if something fails without.
hevea is anyway a very good addition, because if you have it installed, you can write latex files with giac commands, compile them with hevea2mml and display as HTML+MathML with input fields where the giac commands can be modified and executed from a browser.

Re: clang 6.0.1

Publié : mer. nov. 21, 2018 2:45 pm
par dimpase
No, without hevea it errors out, and with hevea (installed as a FreeBSD package) I get the following error:

Code : Tout sélectionner

gmake[3]: Entering directory '/usr/home/dimpase/Sage/sagemath/local/var/tmp/sage/build/giac-1.5.0-11/src/doc/el'
gmake[3]: warning: -jN forced in submake: disabling jobserver mode.
gmake[4]: Entering directory '/usr/home/dimpase/Sage/sagemath/local/var/tmp/sage/build/giac-1.5.0-11/src/doc/el'
gmake[4]: warning: -jN forced in submake: disabling jobserver mode.
gmake[4]: Nothing to be done for 'install-exec-am'.
TEXINPUTS=.:$TEXINPUTS  cas_el.tex
/bin/sh: cas_el.tex: not found
gmake[4]: *** [Makefile:1029: cas_el.dvi] Error 127

Re: clang 6.0.1

Publié : mer. nov. 21, 2018 4:26 pm
par dimpase
there is something fishy with doc/el. Namely, if I remove el from the list of languages, i.e. apply

Code : Tout sélectionner

--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -336,8 +336,8 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = en es fr el local pt zh de
-DIST_SUBDIRS = en es fr el local pt zh de
+SUBDIRS = en es fr local pt zh de
+DIST_SUBDIRS = en es fr local pt zh de
 XCASHTML = xcasfr.html xcasen.html *.css *.js giacwasm.wasm logo.png giac.tex giacfr.tex test.tex testfr.tex test.html testfr.html algolycee.html graphtheory-user_manual.pdf *.sty
 EXTRA_DIST = aide_cas README index.html $(XCASHTML) dxcas/* pari/* castex.tex tortue.tex 
 dist_pkgdata_DATA = aide_cas
 
then the build works.