sagemath / sage

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

Fedora 40 and gcc 14 #37698

Open enriqueartal opened 8 months ago

enriqueartal commented 8 months ago

Environment

- **OS**: Fedora 40beta
- **Sage Version**: 10-4beta0

Steps To Reproduce

Fedora 40beta has just arrived, I wanted to check if sage can be built. The first problem is that Fedora 40 is using gcc 14. Instead of using gcc package, I changed spkg-configure.m4 in build/pkgs/gcc and build/pkgs/gfortran to allow gcc 14.

The compilation gave an error for givaro; the patch in https://github.com/linbox-team/givaro/issues/226 works for this. Next problem was with linbox. As a bypass, I used the changed files in https://github.com/sagemath/sage/pull/35148. The three packages have been successfully built.

But I stuck at the compilation of sagelib, apparently with ginac but not sure, see the package log

Config log

config.log

Package logs

sagelib-10.4.beta0.log

Additional Information

No response

Checklist

Dependencies

mkoeppe commented 8 months ago

compilation of sagelib, apparently with ginac

That is fixed in https://github.com/sagemath/sage/pull/37646

I don't think it's ginac, that's just the last gcc command that shows up in the log.

There are a bunch of errors (look for : error: in the log). Some are fixed already in https://github.com/sagemath/sage/pull/37646

mkoeppe commented 8 months ago

I changed spkg-configure.m4 in build/pkgs/gcc and build/pkgs/gfortran to allow gcc 14.

I have that change on #37537

erentar commented 6 months ago

I have replicated this too

enriqueartal commented 6 months ago

I have tried in Fedora 40 with gcc package; ppl needs the gmp spkg. Documentation does not build, symbol issues with libharfbuzz.

vbraun commented 6 months ago

The sagelib compile errors are https://github.com/cython/cython/issues/2747 and possibly fixed in cython-3.10

enriqueartal commented 6 months ago

The sagelib compile errors are cython/cython#2747 and possibly fixed in cython-3.10

Following @vbraun's comment, I have tried with cython-3.0.10. Some errors pointed out in https://github.com/sagemath/sage/pull/37537 have disappeared but the ones concerning plot didn't. I attach config.log and sagelib-10.4.beta5.log

Probably the errors are there:

[spkg-install]     sage/plot/plot3d/implicit_surface.c:11800:21: error: assignment to 'PyObject *' {aka 'struct _object *'} from incompatible pointer type 'struct __pyx_obj_4sage_4plot_6plot3d_16implicit_surface_VertexInfo *' [-Wincompatible-pointer-types]
[spkg-install]     11800 |         *__pyx_t_22 = __pyx_v_v;
[spkg-install]           |                     ^
[spkg-install]     sage/plot/plot3d/implicit_surface.c:12357:21: error: assignment to 'PyObject *' {aka 'struct _object *'} from incompatible pointer type 'struct __pyx_obj_4sage_4plot_6plot3d_16implicit_surface_VertexInfo *' [-Wincompatible-pointer-types]
[spkg-install]     12357 |         *__pyx_t_22 = __pyx_v_v;
[spkg-install]           |                     ^
[spkg-install]     sage/plot/plot3d/implicit_surface.c: In function '__pyx_f_4sage_4plot_6plot3d_16implicit_surface_22MarchingCubesTriangles__update_x_vertices':
[spkg-install]     sage/plot/plot3d/implicit_surface.c:13610:21: error: assignment to 'PyObject *' {aka 'struct _object *'} from incompatible pointer type 'struct __pyx_obj_4sage_4plot_6plot3d_16implicit_surface_VertexInfo *' [-Wincompatible-pointer-types]
[spkg-install]     13610 |         *__pyx_t_18 = __pyx_v_v;
[spkg-install]           |                     ^
vbraun commented 6 months ago

I've created #37939, with that I can at least build Sage on Fedora 40

enriqueartal commented 6 months ago

I can confirm that in Fedora 40 Sagemath can be built with https://github.com/sagemath/sage/pull/37939, https://github.com/sagemath/sage/pull/37537, https://github.com/sagemath/sage/pull/37938, and https://github.com/sagemath/sage/pull/37584

erentar commented 6 months ago

I can confirm that in Fedora 40 Sagemath can be built with #37939, #37537, #37938, and #37584

How do you apply all of those patches at once?

enriqueartal commented 6 months ago

If you put in the address line of the browser https://github.com/sagemath/sage/issues/xxxxx.patch you get the patchfile of the PR to be saved in SAGE_ROOT where you run patch -i xxxxx.patch -p 1; a simpler approach would be welcome

erentar commented 6 months ago

arr=(37939 37537 37938 37584); for i in $arr; do wget https://github.com/sagemath/sage/pull/$i.patch; patch -i $i.patch -p 1; done

erentar commented 6 months ago

Still doesnt work for me, givaro and ppl fails.

enriqueartal commented 6 months ago

Which version of givaro? The package ppl is taken from the system in my case. Maybe make clean-maintainer for a fresh start?

erentar commented 6 months ago

i ran

make clean-maintainer
make clean
./configure
sudo dnf install fflas-ffpack-devel libfplll libfplll-devel linbox-devel maxima-runtime-ecl maxima ppl ppl-devel zeromq zeromq-devel 4ti2 gnupg2 openssh igraph igraph-devel isl-devel graphviz lrslib polymake sbcl
make -j4

output:

Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):

* package:         givaro-4.1.1
  last build time: May 3 22:54
  log file:        /home/user/git/sage/logs/pkgs/givaro-4.1.1.log

* package:         fflas_ffpack-2.5.0
  last build time: May 7 21:20
  log file:        /home/user/git/sage/logs/pkgs/fflas_ffpack-2.5.0.log
  build directory: /home/user/git/sage/local/var/tmp/sage/build/fflas_ffpack-2.5.0

* package:         ppl-1.2.p1
  last build time: May 7 21:20
  log file:        /home/user/git/sage/logs/pkgs/ppl-1.2.p1.log
  build directory: /home/user/git/sage/local/var/tmp/sage/build/ppl-1.2.p1

It is safe to delete any log files and build directories, but they
contain information that is helpful for debugging build problems.
WARNING: If you now run 'make' again, the build directory of the
same version of the package will, by default, be deleted. Set the
environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.
make[1]: *** [Makefile:40: all-start] Error 1
make[1]: Leaving directory '/home/user/git/sage'
make: *** [Makefile:13: all] Error 2

givaro-4.2.0.log fflas_ffpack-2.5.0.log ppl-1.2.p1.log

erentar commented 6 months ago

Whoops, wrong logfile for givaro. givaro-4.1.1.log

erentar commented 6 months ago

to be absolutely sure, i ran

git checkout upstream/develop

git reset --hard

make clean

git clean -f

arr=(37939 37537 37938 37584) ; for i in $arr ; do wget https://github.com/sagemath/sage/pull/$i.patch ; patch -i $i.patch -p 1 ; done

make bootstrap

make configure

./configure

sudo dnf install fflas-ffpack-devel libfplll libfplll-devel linbox-devel ppl ppl-devel 4ti2 gnupg2 openssh igraph igraph-devel isl-devel graphviz lrslib polymake

make -j4

and i can still reproduce the same problem

enriqueartal commented 6 months ago

Why do you have givaro 4.1.1? It should be 4.2.0. This causes the error for fflas_ffpack. I did not have the error with ppl since the system package is used.

erentar commented 6 months ago

In my system, I have givaro 4.2.0 installed. I do not know why it is building 4.1.1 again, as i have applied the patch to upgrade it, as you mentioned

enriqueartal commented 6 months ago

Have you checked if the patch is really applied looking at build/pkgs/givaro. I get a running system in Fedora 40 but there are strange things. In config.log I get

## ------------------------------------------------------- ##
## Checking whether SageMath should install SPKG givaro... ##
## ------------------------------------------------------- ##
configure:26026: checking for givaro >= 4.2.0
configure:26033: $PKG_CONFIG --exists --print-errors "givaro >= 4.2.0"
configure:26036: $? = 0
configure:26050: $PKG_CONFIG --exists --print-errors "givaro >= 4.2.0"
configure:26053: $? = 0
configure:26091: result: yes
configure:26100: will use system package and not install SPKG givaro

and then

configure:125316: result: givaro:                         no suitable system package; standard, SPKG version 4.2.0 will be installed

Something similar for fflas-ffpack. The difference with your case is that I can build. I share the config.log in case it is useful: config40-2.log

erentar commented 6 months ago

I believe i have the same result.

Even though givaro-4.2.0 is installed from dnf, sage decides that SPKG should be installed

erentar commented 6 months ago

I nuked the local cloned folder and got a fresh copy, it built; however it still gets givaro et al from source even though system packages are available

vbraun commented 6 months ago

I'm building with the Fedora libgmp for the record:

release@zen:~/Sage$ rpm -qa | grep ^gmp-
gmp-6.2.1-8.fc40.x86_64
gmp-c++-6.2.1-8.fc40.x86_64
gmp-devel-6.2.1-8.fc40.x86_64

with that, I can build ppl just fine.

vbraun commented 6 months ago

This is now in Sage 10.4.beta6, so testing should be easier

vbraun commented 6 months ago

I've created https://github.com/sagemath/sage/issues/38002 for the macOS/linbox/givaro issue

dimpase commented 5 months ago

I am having problems with system-wide flint (3.1.2),and gcc 14, as

clpc177[/tmp]$ cat t.c 
#include <complex.h>
void foo(int I, int);
clpc177[/tmp]$ gcc -c t.c
In file included from t.c:1:
t.c:2:14: error: expected ‘)’ before ‘__extension__’
    2 | void foo(int I, int);
      |              ^
t.c:2:17: error: expected ‘;’, ‘,’ or ‘)’ before ‘int’
    2 | void foo(int I, int);
      |                 ^~~
clpc177[/tmp]$ 

or, similarly, replacing void ... above with #include <flint/mpoly.h> leads to the same errors.

It's fixed in flint's main branch now (cf https://github.com/flintlib/flint/pull/2027), though, but will linger for a while.

mkoeppe commented 5 months ago

I've fixed this one in #38227

dimpase commented 5 months ago

I've fixed this one in #38227

I don't see how this can fix this - to fix this, you need to test that system flint can be used (but it cannot - at least not with numpy 2.0 - I didn't check other ones).

So one needs a test in flint/spkg-configure.m4

mkoeppe commented 5 months ago

No.

dimpase commented 5 months ago

No.

could you point out how your PR is fixing this ?

mkoeppe commented 5 months ago

You mean you didn't look? https://github.com/sagemath/sage/pull/38227/commits/1fe2d7c5284ce42b1d68c42783e2dcc9cbf3adcd

dimpase commented 5 months ago

I didn't know where to look in the diff, as I apparently never knew about #pragma push/pop. Without this knowledge, I haven't even looked at src/.

It's got to be in the PR description, too, by the way.

mkoeppe commented 5 months ago

Also, this has nothing to do with gcc 14.

dimpase commented 4 months ago

This must be kept open until https://github.com/sagemath/sage/pull/38227 (or the specific flint fix in https://github.com/sagemath/sage/commit/1fe2d7c5284ce42b1d68c42783e2dcc9cbf3adcd) is merged.

mkoeppe commented 4 months ago

Like I said, this has absolutely nothing to do with gcc 14.

mkoeppe commented 4 months ago

(Do you read what's written?)