sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 481 forks source link

giac should be compiled without --disable-gui #34679

Open 2edf2d52-6c17-4f2a-88a6-e860db4dcddf opened 2 years ago

2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 2 years ago

(I apologize if this ticket is not formatted correctly, never done one before). The reason given for disabling GUI was that an incompatible old versions of FLTK could stop the compilation. This should not be a concern anymore now. This would provide a standard compilation path for Giac/Xcas on systems where it is not packaged (I especially need this in an educational context for French maths teacher recruitement).

Actions required: 1/ remove --disable-gui in build/pkgs/giac/spkg-install.in 2/ For current giac source, in the files: src/Makefile.am and src/Makefile.in, in the executable aide dependencies, libgiac.la should be replaced by libxcas.la. The next release of giac 1.9.0-23 (planned next week) will include these fixes.

Thanks in advance!

Upstream: Fixed upstream, but not in a stable release.

CC: @slel

Component: packages: standard

Author: Bernard Parisse

Branch/Commit: public/ticket/34679 @ d1b6efc

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/34679

sheerluck commented 2 years ago
comment:1

but when in docker we need --disable-gui

fchapoton commented 2 years ago

Commit: d1b6efc

fchapoton commented 2 years ago

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
 (I apologize if this ticket is not formatted correctly, never done one before).
 The reason given for disabling GUI was that an incompatible old versions of FLTK could stop the compilation. This should not be a concern anymore now.
-This would provide a standard compilation path for Giac/Xcas on systems where it is not packaged (I especially need this in an educationnal context for French maths teacher recruitement). 
+This would provide a standard compilation path for Giac/Xcas on systems where it is not packaged (I especially need this in an educational context for French maths teacher recruitement). 

 Actions required: 
 1/ remove --disable-gui in build/pkgs/giac/spkg-install.in
fchapoton commented 2 years ago

Branch: public/ticket/34679

fchapoton commented 2 years ago
comment:2

here is a branch just removing --disable-gui

someone else must add the required patch changing Makefiles ; or wait for thr upgrade in #34583


New commits:

d1b6efcre-enable giac gui (xcas using ftlk)
2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 2 years ago
comment:3

I have released giac-1.9.0-25 this evening. Changes related to this problem: 1/ src/Makefile.am, src/Makefile.in: aide did not link correctly in some situations, I changed dependencies from libgiac.la to libxcas.la 2/ giac will now detect if fltk headers are installed, if not it will compile fltk-1.3.8 (included) statically and link against the compiled fltk static libraries.

mkoeppe commented 2 years ago
comment:4

With #34583, you can now use export GIAC_CONFIGURE="--enable-fltk" to override our default --disable-fltk.

2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 2 years ago
comment:5

I'm afraid this will not solve my original problem. The guys who say it's too complicated to compile Xcas will most probably not consider running an export command before compiling sage.

Why not make the default inside sage with FLTK enabled and ask users who do not want the GUI to run export GIAC_CONFIGURE="--disable-fltk" ?

The GUI can now be run inside giac/icas (type xcas at the prompt), and there you can access to some features like tracemode on functions/parametric plots : a cursor is displayed on the curve, with the value of t, x, y, tangent slope, curve radius, osculating circle, you can move the cursor interactively, and also find nearest roots/extrema/intersection/inflexion points ...

Thanks!

dimpase commented 1 year ago
comment:6

Replying to Bernard Parisse:

I'm afraid this will not solve my original problem. The guys who say it's too complicated to compile Xcas will most probably not consider running an export command before compiling sage.

Why not make the default inside sage with FLTK enabled and ask users who do not want the GUI to run export GIAC_CONFIGURE="--disable-fltk" ?

The GUI can now be run inside giac/icas (type xcas at the prompt), and there you can access to some features like tracemode on functions/parametric plots : a cursor is displayed on the curve, with the value of t, x, y, tangent slope, curve radius, osculating circle, you can move the cursor interactively, and also find nearest roots/extrema/intersection/inflexion points ...

let's test and see how it goes. By the way, is there a new version of giac available?

dimpase commented 1 year ago
comment:7

By the way, giac as packages on Fedora 34 doesn't seem to want to report its version:

$ giac --version
// Using locale /usr/share/locale/
// en_GB.UTF-8
// /usr/share/locale/
// giac
// UTF-8
// Maximum number of parallel threads 16
Can't open display: localhost:10.0

is it due to it built with GUI enabled?

dimpase commented 1 year ago
comment:8

On Fedora 34 and this patch, build errors out with

libtool: link: (cd ".libs" && rm -f "libgiac.so.0" && ln -s "libgiac.so.0.0.0" "libgiac.so.0")
libtool: link: (cd ".libs" && rm -f "libgiac.so" && ln -s "libgiac.so.0.0.0" "libgiac.so")
libtool: link: ( cd ".libs" && rm -f "libgiac.la" && ln -s "../libgiac.la" "libgiac.la" )
/usr/local/bin/bash ../libtool  --tag=CXX   --mode=link g++ -std=gnu++11  -g -O2 -g -O2 -std=gnu++11 -fno-strict-aliasing -DGIAC_GENERIC_CONSTANTS -DTIMEOUT -
no-undefined -Wl,-rpath-link,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -L/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl
,-rpath,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath-link,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -L/home/sc
ratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib  -o libxcas.la  History.lo Inpu
t.lo Xcas1.lo Equation.lo Print.lo Tableur.lo Editeur.lo Graph.lo Graph3d.lo Help1.lo Cfg.lo Flv_CStyle.lo Flve_Check_Button.lo Flve_Input.lo Flv_Style.lo Flv
_Data_Source.lo Flve_Combo.lo Flv_List.lo Flv_Table.lo gl2ps.lo Python.lo libgiac.la -lfltk_images -ljpeg -lpng -lz -lfltk -lfltk_gl -lXext -lXft -lfontconfig
 -lXinerama -lX11 -lGL -lcurl -lglpk -ldl -lm -lecm -lmpfi -lmpfr -lgmp   -lrt -lpthread -lnauty -lcliquer -lcurl -lglpk -ldl -lm -lecm -lmpfi -lmpfr -lgmp 
/usr/local/bin/bash ../libtool  --tag=CXX   --mode=link g++ -std=gnu++11  -g -O2 -g -O2 -std=gnu++11 -fno-strict-aliasing -DGIAC_GENERIC_CONSTANTS -DTIMEOUT -
no-undefined -Wl,-rpath-link,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -L/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl
,-rpath,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath-link,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -L/home/sc
ratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib  -o aide aide.o libgiac.la -lre
adline -lncurses -lcurl -lglpk -ldl -lm -lecm -lmpfi -lmpfr -lgmp  -lgsl -lm -lopenblas  -lopenblas  -lrt -lpthread -lnauty -lcliquer -lcurl -lglpk -ldl -lm -
lecm -lmpfi -lmpfr -lgmp 
libtool: link: g++ -std=gnu++11 -g -O2 -g -O2 -std=gnu++11 -fno-strict-aliasing -DGIAC_GENERIC_CONSTANTS -DTIMEOUT -Wl,-rpath-link -Wl,/home/scratch/scratch2/
dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath -Wl,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath-link -Wl,/home/scratch/scratch2
/dimpase/sage/sagetrac-mirror/local/lib -Wl,-rpath -Wl,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib -o .libs/aide aide.o  -L/home/scratch/scr
atch2/dimpase/sage/sagetrac-mirror/local/lib ./.libs/libgiac.so -lntl -lpari -lreadline -lncurses -lgsl -lopenblas -lrt -lpthread -lnauty -lcliquer -lcurl -lglpk -ldl -lm -lecm -lmpfi -lmpfr -lgmp -Wl,-rpath -Wl,/home/scratch/scratch2/dimpase/sage/sagetrac-mirror/local/lib
libtool: link: ar cr .libs/libxcas.a .libs/History.o .libs/Input.o .libs/Xcas1.o .libs/Equation.o .libs/Print.o .libs/Tableur.o .libs/Editeur.o .libs/Graph.o .libs/Graph3d.o .libs/Help1.o .libs/Cfg.o .libs/Flv_CStyle.o .libs/Flve_Check_Button.o .libs/Flve_Input.o .libs/Flv_Style.o .libs/Flv_Data_Source.o .libs/Flve_Combo.o .libs/Flv_List.o .libs/Flv_Table.o .libs/gl2ps.o .libs/Python.o 
libtool: link: ranlib .libs/libxcas.a
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_create_info_struct'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_create_write_struct'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_set_IHDR'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_write_image'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_write_info'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_write_end'
/usr/bin/ld: ./.libs/libgiac.so: undefined reference to `png_init_io'
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:784: aide] Error 1
dimpase commented 1 year ago

Changed author from parisse to Bernard Parisse

dimpase commented 1 year ago

Reviewer: Dima Pasechnik

2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 1 year ago
comment:11

Replying to Dima Pasechnik:

By the way, giac as packages on Fedora 34 doesn't seem to want to report its version:

$ giac --version
// Using locale /usr/share/locale/
// en_GB.UTF-8
// /usr/share/locale/
// giac
// UTF-8
// Maximum number of parallel threads 16
Can't open display: localhost:10.0

is it due to it built with GUI enabled?

It seems the DISPLAY variable is set to localhost:10:0, and it can not be opened for some reason. On my computer, DISPLAY is set to set | grep DISPLAY DISPLAY=:0.0 If you run unset DISPLAY, it should work.

For Fedora compilation, I don't know why png symbols are not found, but it should be possible to compile giac 1.9.0-29 since it is available for Fedora 37 and 38 (https://src.fedoraproject.org/rpms/giac)

dimpase commented 1 year ago
comment:12

for building, or reporting version, DISPLAY should not matter at all. E.g. if it is done under screen, it's not possible to set it to anything sensible.

dimpase commented 1 year ago
comment:13

as to not finding png, giac apparently recognises that libpng is present, but forgets to add -lpng to LDFLAGS

2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 1 year ago
comment:14

Current check works under debian (link command has a -lpng), it is (configure.ac):

CONFIG_PNG="yes" AC_ARG_ENABLE(png, [AS_HELP_STRING([--enable-png], [Enable PNG library])], [ if test "x$enableval" = "xno"; then CONFIG_PNG="no"; fi], [])

if test "x$CONFIG_PNG" = "xyes"; then AC_CHECK_HEADERS(png.h, AC_SEARCH_LIBS(png_sig_cmp,[png16 png14 png12 png])) dnl AC_CHECK_HEADERS(png.h, AC_CHECK_LIB(png,main)) dnl AC_CHECK_LIBS(main,[png16,png14,png12,png])) fi

what should it be?

dimpase commented 1 year ago
comment:15

if you look at the branch, it has --enable-png=no - so it seems that the bug is elsewhere, not in the yes branch.

2edf2d52-6c17-4f2a-88a6-e860db4dcddf commented 1 year ago
comment:16

I'm confused, sorry. Is there something I should change? If so, what?

dimpase commented 1 year ago
comment:17

Please check that on Linux (preferably Fedora 34, but perhaps it's reproducible elsewhere)

./configure --disable-ao --enable-png=no --disable-samplerate --disable-static --disable-micropy --disable-quickjs
make

does not end up with the error as in comment:8. If it works then my comment:8 was incorrect. If it does not, then you have a bug in configure

kiwifb commented 1 year ago
comment:18

If you compile with the gui, my understanding is you cannot configure with --enable-png=no at the same time, like it is done now. In fact I am not sure why png is disabled, it could be used without gui to produce figures.

dimpase commented 1 year ago
comment:19

Replying to François Bissey:

If you compile with the gui, my understanding is you cannot configure with --enable-png=no at the same time, like it is done now. In fact I am not sure why png is disabled, it could be used without gui to produce figures.

dig it up :-)

$ git log -S "enable-png" -- build/pkgs/giac/spkg-install

commit 041c76d5ad0d4fe8ab09b7242a75c797c435bde5
Author: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date:   Tue Mar 3 22:18:53 2020 -0500

    Rename spkg-build, spkg-install etc. templates as spkg-build.in, spkg-install.in etc.

commit d04a5fd913fe74433ffc0579b44738e63a0e1e80
Author: Dima Pasechnik <dima@pasechnik.info>
Date:   Wed Jan 16 07:45:08 2019 +0000

    do not link libpng

I disabled linking to libpng in #26315, as recognition of Sage-installed libpng by giac's configure was (is?) broken. (you took park in that discussion)

kiwifb commented 1 year ago
comment:20

I did take part in that conversation! It seems my memory buffer doesn't extend up that far (4 years). Same kind of conclusion, libpng is only used by the gui. Pity we didn't remove libpng of the list of dependency of giac at the same time, that should have gone hand in hand with disabling it.

If we want to fix that properly, someone will have to touch configure.ac. I cannot promise to work on it before the end of February.

parisseb commented 1 year ago

giac 1.9.0-41 available at https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/giac_stable.tgz introduces some changes in configure.ac that fixes some bugs for compiling giac with the included version of FLTK. ... AC_CHECK_HEADERS(FL/Fl.H,[],[tar xfj fltk-1.3.8-source.tar.bz2 ; cd fltk-1.3.8 && ./configure --disable-shared && make && cd .. && CXXFLAGS="$CXXFLAGS -I../fltk-1.3.8 -I./fltk-1.3.8" && LDFLAGS="$LDFLAGS -Lfltk-1.3.8/lib "] ) dnl X11, check for opengl, fltk AC_CHECK_LIB(X11,main) AC_CHECK_LIB(Xcursor,main) AC_CHECK_LIB(Xfixes,main) AC_CHECK_LIB(Xinerama, main) AC_CHECK_LIB(fontconfig, main) AC_CHECK_LIB(Xft, main) AC_CHECK_LIB(Xext, main) AC_CHECK_LIB(Xrender, main) AC_CHECK_LIB(fltk_gl, main) AC_CHECK_LIB(fltk, main) if test "$HAVE_LIBFLTK" = "1"; then AC_DEFINE([HAVE_LIBFLVW],1, [Now defined if fltk is available]) fi AC_CHECK_LIB(z,main) AC_CHECK_HEADERS(png.h, AC_CHECK_LIB(png,main)) AC_CHECK_LIB(jpeg, main) AC_CHECK_LIB(fltk_images, main) FLTK_LIBS="$LIBS $X_LIBS" AC_SUBST(FLTK_LIBS) cd src && ln -sf ../fltk-1.3.8 && cd .. fi ...

I hope this helps for compiling giac inside sage with GUI enabled by default.

dimpase commented 1 year ago

@parisseb - I'm having a look now. The tarball you linked:

ls -l giac_stable.tgz 
-rw-r--r--. 1 dimpase staff 114044952 May  7 16:33 giac_stable.tgz

is it still the same version?

parisseb commented 1 year ago

giac_stable.tgz is a symbolic link to the latest debian source : giac_stable.tgz -> ../debian/dists/stable/main/source/giac_1.9.0-53.tar.gz You probably have version 1.9.0-49 (I sometimes forget to update the symbolic link, if you want to have the latest stable version it's better to check in the debian source directory). You can check your version in debian/changelog. This is not important here since Groebner code did not change recently.

dimpase commented 1 year ago

That's fine, we can use ../debian/dists/stable/main/source/giac_1.9.0-53.tar.gz instead. Are these tarballs in ../debian/ "stable" - in the sense they are never changed?

parisseb commented 1 year ago

The tarballs in debian...stable are indeed stable, they don't change, unlike giac_stable.tgz

dimpase commented 1 year ago

The tarballs in debian...stable are indeed stable, they don't change, unlike giac_stable.tgz

OK, great, this helps.