Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup general CFLAGS #12890

Closed
jdemeyer opened this issue Apr 30, 2012 · 4 comments
Closed

Setup general CFLAGS #12890

jdemeyer opened this issue Apr 30, 2012 · 4 comments

Comments

@jdemeyer
Copy link

The current way how Sage handles CFLAGS is quite bad. There are several issues:

  1. Too many spkg-install files are trying to do clever stuff to determine CFLAGS. This should be done just once instead of in every spkg. This would imply we don't need to handle SAGE64 and SAGE_DEBUG in every spkg.

  2. Sometimes, the spkg determines CFLAGS which result in a failed build, for example when the gcc issues instructions which the assembler doesn't know about.

  3. Some packages don't do anything clever and just build with simple, suboptimal CFLAGS.

My impression is that MPIR is very good at determining the right CFLAGS. So we should not try to reinvent the wheel, just take MPIR's CFLAGS.

CC: @kini

Component: build

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

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 30, 2012

comment:1

There are a lot of aspects to this, i.e., one could write a whole essay on it, that's why I haven't [yet] replied on #11616...

The introduction of SAGE64 (including its name) was IMHO a poor idea, or at least badly implemented.

Michael Abshoff had some ideas regarding "standard" variables like CC, CFLAGS etc.; see his old wiki page.

The Sage library (i.e., devel/sage/setup.py) should by itself make sure -fno-strict-aliasing is used to compile Cython-generated code when needed and supported.

Sage's configure doesn't configure anything, nor does it take a --target option. (It could for example also set things like EGREP.)

There's in principle no way to determine in an spkg-install whether the settings of CC, LD, CXXFLAGS etc. originate from Sage (currently mostly sage-env) or the user.

Spkgs are intended to make Sage modular (i.e., they're not supposed to be tied to a specific Sage version); they can [currently] rely on a few basic environment variable settings, but not more, and there's currently no framework for an spkg to require a minimal or specific version of Sage or other spkgs.

The assembler errors ("unknown instruction") are almost exclusively caused by the GCC spkg, since any reasonable operating system or distribution ships a toolchain where parts "match". (A user could of course also install a newer compiler without updating binutils etc., but then it's mainly his fault, and we certainly cannot catch and work around all possible issues.) Note that one usually also needs current versions of gdb and valgrind to debug code which exploits newer CPU features.

MPIR implements much more in assembly than other spkgs do, hence it's less likely that GCC is tempted to emit fancy instructions for MPIR's (high-level) C code. (And MPIR uses its own assembler for its "hand-written" assembly files. We might install yasm into Sage if we also build GCC.)

Still a couple of spkgs (i.e., mostly upstream) ignore CC, CXX, CFLAGS etc., or use some non-standard variables for similar or the same purposes, or even abuse CPP and/or CPPFLAGS.

...

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 30, 2012

comment:2

P.S.: The situation with Fortran is even worse. We have a useless sage_fortran script and SAGE_FORTRAN* variables, instead of using FC (or F77), FFLAGS, FCFLAGS and LDFLAGS etc.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe
Copy link
Member

mkoeppe commented Aug 26, 2021

comment:8

outdated, should close

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Aug 26, 2021
@fchapoton
Copy link
Contributor

comment:9

indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants