unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gcc: build all languages at once?
@ 2021-08-31 17:43 Sarah Morgensen
  2021-09-08 21:08 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Sarah Morgensen @ 2021-08-31 17:43 UTC (permalink / raw)
  To: guix-devel

Hello Guix,

I notice that out of GCC's supported languages (ada, c, c++, d, fortran,
go, jit, lto, objc, obj-c++) we currently build all except ada, and five
of them (d, fortran, go, objc, and obj-c++) are built separately.  Most
of GCC's build time is spent bootstrapping and building the actual
compiler, rather than building the frontends, so we would save a lot of
build time by building them all together.

We could also possibly reuse the 'core' parts of GCC between language
frontends, saving some space.  (This is what distros seem to do.)

If we do this, I'm not sure whether it would be better to have each
additional language as an output for gcc, or as a separate package.

Currently, the only build-time difference between our GCC packages is
that our package for 'jit' uses '--enable-host-shared', which
"[specifies] that the host code should be built into
position-independent machine code (with -fPIC), allowing it to be used
within shared libraries, but yielding a slightly slower compiler" [0].
I don't think it would be too big of a hit to just turn that on
unconditionally, but we could also keep 'jit' as a separately-built
package.

What do you all think?

[0] https://gcc.gnu.org/install/configure.html

--
Sarah


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc: build all languages at once?
  2021-08-31 17:43 gcc: build all languages at once? Sarah Morgensen
@ 2021-09-08 21:08 ` Ludovic Courtès
  2021-09-09 10:14   ` Maxime Devos
  2021-09-10 19:59   ` Sarah Morgensen
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2021-09-08 21:08 UTC (permalink / raw)
  To: Sarah Morgensen; +Cc: guix-devel

Hi Sarah,

Sarah Morgensen <iskarian@mgsn.dev> skribis:

> I notice that out of GCC's supported languages (ada, c, c++, d, fortran,
> go, jit, lto, objc, obj-c++) we currently build all except ada, and five
> of them (d, fortran, go, objc, and obj-c++) are built separately.  Most
> of GCC's build time is spent bootstrapping and building the actual
> compiler, rather than building the frontends, so we would save a lot of
> build time by building them all together.

Yes, but at the expense of the build time of the main GCC package and of
its size.

> We could also possibly reuse the 'core' parts of GCC between language
> frontends, saving some space.  (This is what distros seem to do.)

That’d be ideal, but I’m not sure it’s feasible.  It’s feasible for FHS
distros that “just” need to shuffle files around in various binary
packages, but here we’d have to have several outputs or something, and
most likely they’d refer to one another.

> If we do this, I'm not sure whether it would be better to have each
> additional language as an output for gcc, or as a separate package.
>
> Currently, the only build-time difference between our GCC packages is
> that our package for 'jit' uses '--enable-host-shared', which
> "[specifies] that the host code should be built into
> position-independent machine code (with -fPIC), allowing it to be used
> within shared libraries, but yielding a slightly slower compiler" [0].
> I don't think it would be too big of a hit to just turn that on
> unconditionally, but we could also keep 'jit' as a separately-built
> package.

Yeah, dunno.

> What do you all think?

There’s definitely room for improvement in this area, but it’s not clear
to me what can be done within the constraints that we have, in
particular the closure size of gcc (gcc:lib in particular) and having a
reasonably small set of dependencies for ‘gcc-final’.  I suppose
experimentation could tell us which approach to follow!

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc: build all languages at once?
  2021-09-08 21:08 ` Ludovic Courtès
@ 2021-09-09 10:14   ` Maxime Devos
  2021-09-10 19:59   ` Sarah Morgensen
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Devos @ 2021-09-09 10:14 UTC (permalink / raw)
  To: Ludovic Courtès, Sarah Morgensen; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

Ludovic Courtès schreef op wo 08-09-2021 om 23:08 [+0200]:
> > We could also possibly reuse the 'core' parts of GCC between language
> > frontends, saving some space.  (This is what distros seem to do.)
> 
> That’d be ideal, but I’m not sure it’s feasible.  It’s feasible for FHS
> distros that “just” need to shuffle files around in various binary
> packages, but here we’d have to have several outputs or something, and
> most likely they’d refer to one another.

GCC consists of many separate components  (e.g. ‘libada’, ‘libatomic’, ‘libbacktrae’,
‘libgcc’, that each have their own ‘configure.ac’ script called from the ‘main’
configure.ac.   I'd presume it would be possible to ignore the main configure.ac
let all of them be separate packages, without guix having to move files around.

Greetings,
Maxime

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc: build all languages at once?
  2021-09-08 21:08 ` Ludovic Courtès
  2021-09-09 10:14   ` Maxime Devos
@ 2021-09-10 19:59   ` Sarah Morgensen
  1 sibling, 0 replies; 4+ messages in thread
From: Sarah Morgensen @ 2021-09-10 19:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Sarah,
>
> Sarah Morgensen <iskarian@mgsn.dev> skribis:
>
>> I notice that out of GCC's supported languages (ada, c, c++, d, fortran,
>> go, jit, lto, objc, obj-c++) we currently build all except ada, and five
>> of them (d, fortran, go, objc, and obj-c++) are built separately.  Most
>> of GCC's build time is spent bootstrapping and building the actual
>> compiler, rather than building the frontends, so we would save a lot of
>> build time by building them all together.
>
> Yes, but at the expense of the build time of the main GCC package and of
> its size.

Its size shouldn't change, as the other languages should be entirely in
separate packages or outputs.  The build time... yeah, that could be
harsh, especially on slower arches.

>> We could also possibly reuse the 'core' parts of GCC between language
>> frontends, saving some space.  (This is what distros seem to do.)
>
> That’d be ideal, but I’m not sure it’s feasible.  It’s feasible for FHS
> distros that “just” need to shuffle files around in various binary
> packages, but here we’d have to have several outputs or something, and
> most likely they’d refer to one another.

Good point.  I hadn't considered this.

>> What do you all think?
>
> There’s definitely room for improvement in this area, but it’s not clear
> to me what can be done within the constraints that we have, in
> particular the closure size of gcc (gcc:lib in particular) and having a
> reasonably small set of dependencies for ‘gcc-final’.  I suppose
> experimentation could tell us which approach to follow!

I did some research, and it looks like the Debian GCC build scripts do a
lot of what I am looking for.  They allow building languages and
libraries separately [0], and wow is it complicated!  It looks the gist
is liberal application of --disable-*, especially --disable-bootstrap.

Doing something like this (with each language still built separately,
but without bootstrapping again or building unnecessary libraries)
should be feasible in Guix... with a fair amount of effort.  I'm sure I
don't have the familiarity with GCC to do anything but trial-and-error,
so if anyone else wants to tackle this, have at it :)

[0] https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2

--
Sarah


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-10 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 17:43 gcc: build all languages at once? Sarah Morgensen
2021-09-08 21:08 ` Ludovic Courtès
2021-09-09 10:14   ` Maxime Devos
2021-09-10 19:59   ` Sarah Morgensen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).