Closed dimpase closed 3 years ago
@isuruf
it broke recognition of flint in Sage on Gentoo, where flint is built with cmake, although we can certainly fix it.
You need something like https://github.com/wbhart/flint2/commit/720fc48ebe52b6a57db6bdfc2cec58e0b2bf07b6
How does one even requests the equivalent of --with-gc=...
with cmake
? E.g. the current Gentoo package doesn't even have a flag for it.
Right, I am sorry I skim a lot of stuff these days. So with cmake, let's look at https://github.com/wbhart/flint2/blob/trunk/CMakeLists.txt#L174 and later. This is where the MEMORY_MANAGER
is set by default to reentrant
when it can be single
, reentrant
or gc
. So to change it, you would have set something like -DMEMORY_MANAGER="gc"
I think. If we look further in CMakeLists.txt we can see that two files sources are different depending on MEMORY_MANAGER. Look at https://github.com/wbhart/flint2/blob/trunk/CMakeLists.txt#L189 and https://github.com/wbhart/flint2/blob/trunk/CMakeLists.txt#L195.
I elected to just use the default with cmake. It felt decent enough and from what I can see this is actually a tri-state config and those are a bit harder to handle.
And it seems that reentrant is identical to gc at first glance. And there is nothing to find gc in cmake. Possibly not implemented yet?
@kiwifb - any reason Gentoo wants to use cmake ?
Indeed, it looks like it's not implemented. There is no check for libgc in CMake/, whereas there are such checks for NTL, mpfr, gmp... And there is nothing in CMake files that flips HAVE_CG to 0 or 1. I'd say it's a bug.
Honestly? cmake or custom build system that you don't know when things will go wrong and is a potential huge portability issue? Should I even hesitate?
cmake is a hugely oversold custom build system IMHO. :-) Just look how much handwritten code one has here, and how verbose it is...
Not raising to such a bet before bedtime :) in any case it probably wouldn't hurt to throw an appropriate define in there, for compatibility's sake (spell checker suggestions of the day: "compatibility shake") at least.
Is there a particular reason to use gc rather than reentrant?
This is probably fairly easy to fix, along with other differences that might be more significant, like HAVE_PTHREAD, which isn't set by CMake.
cmake is a hugely oversold custom build system IMHO. :-) Just look how much handwritten code one has here, and how verbose it is...
In comparison to autotools? CMakeLists.txt is 365 lines, which is a third of configure+Makefile.in+Makefile.subdirs at 1178 lines, all of whom are handwritten.
In comparison to autotools? CMakeLists.txt is 365 lines
sure, in comparison to autotools (autoconf+automake+...) cmake is quite verbose. No autotools here, so it's unfair to count lines - besides, you forgot 238 lines in CMake/*.cmake :-)
I am quite ready to throw gc under the proverbial bus in exchange to be able to use cmake to build. reentrant seems a fine choice to me. Especially, if don't use any gc specific features anyway.
Unless Sage uses it, I see no reason to support --with-gc with CMake. The option only exists for the sake of Macaulay 2 I think, and I am not sure how much longer they will be using it, if they still are. They obviously don't use CMake to build Flint if they are still using the option.
I checked today, Macaulay2 stopped using --with-gc
2 years ago.
And, by the way, they are switching to cmake :-)
Excellent. I never liked that hack anyway!
I noticed a couple of other differences:
POPCNT_INTRINSICS
, HAVE_BLAS
(which is actually never used), and HAVE_FENV
The pthreads one seems significant, doesn't it?
All of those are now relevant. We will even shortly be using BLAS (Dan already has a prototype).
If one of the CMake maintainers addresses this with a PR this week, I'll put it in 2.7.0. Otherwise it's going to be pushed out to 2.8.0.
I am referring to mahrud's final comment above, especially his point 1. I don't think the original ticket is relevant at all (it relates to a feature only used by Macaulay 2 two years ago, but not any more).
In Flint 2.5* (and even later, maybe, but not in 2.6.3) the macro
HAVE_GC
was always defined, and set to 0 or 1. Now if Flint is built withcmake
, then instead ofone just sees no HAVE_GC in
flint-config.h
. This is a kind of a bug.It is in fact just not possible to tell cmake to use GC with Flint, as of Flint 2.6.3 or earlier.