comp.lang.ada
 help / color / mirror / Atom feed
* Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
@ 2011-10-23 13:59 Mark Murray
  2011-10-23 17:12 ` Mark Murray
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Murray @ 2011-10-23 13:59 UTC (permalink / raw)


Hi all

"AMD64" is what FreeBSD calls "X86_64".

Hopefully this version of this question hasn't been asked too many
times before!

I'm building GCC-4.7 with Ada on FreeBSD/AMD64 with some success.

I used an earlier version of FreeBSD's GNAT port (no longer available
on more recent FreeBSD's) as the bootstrap compiler; this installs the
binaries into /usr/local/bin/gcc44. After a minor fix, this compiler
works fine _as_long_as_ the above directory is first in the path.

If the above directory is NOT first in the path, then gnatmake uses
gcc off the path, finding the local gcc in /usr/bin/gcc, which, because
its not Ada-aware, fails.

After GCC+Ada is built and installed into ${PREFIX}/bin (PREFIX is
/usr/local here) the same problem exists with the newly compiled
gnatmake (in /usr/local/bin); it runs "gcc", gets the one off the path
in /usr/bin and breaks.

Questions:

1) How do I get build gcc-4.7 such that the ${PREFIX}/bin/gnat* bits
"know" that gcc${SUFFIX} or ${PREFIX}/<something> is to be used, and
not the first "gcc" it finds on the path? Rearranging the path is not a
permanent option, its OK for bootstrapping; "gcc" is "system gcc", if I
want other gcc then I'd like to ask for that specifically with (say)
"gcc47".

2) The rest of gcc built fine with a ${SUFFIX} of "47", so I get
${PREFIX}/bin/gcc47 etc.
How do I get the same with ${PREFIX}/bin/gnat* and friends?

Thanks!

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 13:59 Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT Mark Murray
@ 2011-10-23 17:12 ` Mark Murray
  2011-10-23 19:54   ` Ludovic Brenta
  2011-10-23 20:32   ` Kulin Remailer
  0 siblings, 2 replies; 13+ messages in thread
From: Mark Murray @ 2011-10-23 17:12 UTC (permalink / raw)


On 23/10/2011 14:59, Mark Murray wrote:
> 1) How do I get build gcc-4.7 such that the ${PREFIX}/bin/gnat* bits
> "know" that gcc${SUFFIX} or ${PREFIX}/<something> is to be used, and
> not the first "gcc" it finds on the path? Rearranging the path is not a
> permanent option, its OK for bootstrapping; "gcc" is "system gcc", if I
> want other gcc then I'd like to ask for that specifically with (say)
> "gcc47".

Answering myself partially on this one; it looks like you can't?

I dug through the source for gnatmake etc in gcc-4.7-20111015/gcc/ada
and found strings (more than one) that would indicate that "gcc" is
hardcoded and not configuable.

I'm no Ada programmer (I want this so I can learn!), so I may be
missing something, but its not looking good so far.

Next step is to hack the source and see. Yuk! :-)

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 17:12 ` Mark Murray
@ 2011-10-23 19:54   ` Ludovic Brenta
  2011-10-23 21:03     ` Mark Murray
  2011-10-23 20:32   ` Kulin Remailer
  1 sibling, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2011-10-23 19:54 UTC (permalink / raw)


Mark Murray <w.h.oami@example.com> writes:
> On 23/10/2011 14:59, Mark Murray wrote:
>> 1) How do I get build gcc-4.7 such that the ${PREFIX}/bin/gnat* bits
>> "know" that gcc${SUFFIX} or ${PREFIX}/<something> is to be used, and
>> not the first "gcc" it finds on the path? Rearranging the path is not
>> a permanent option, its OK for bootstrapping; "gcc" is "system gcc",
>> if I want other gcc then I'd like to ask for that specifically with
>> (say) "gcc47".
>
> Answering myself partially on this one; it looks like you can't?
>
> I dug through the source for gnatmake etc in gcc-4.7-20111015/gcc/ada
> and found strings (more than one) that would indicate that "gcc" is
> hardcoded and not configuable.
>
> I'm no Ada programmer (I want this so I can learn!), so I may be
> missing something, but its not looking good so far.
>
> Next step is to hack the source and see. Yuk! :-)

In Debian GNU/Linux and GNU/kFreeBSD, gnat is patched to use gcc-x.y
instead of just gcc.  The patch for 4.6 is here[1].

But I think your best bet is simply to use the GNAT port by John
Marino[2].  If you still want to learn how to build GNAT on FreeBSD, I
suggest you get in touch with him[3] and collaborate on the port.

[1] http://green.ada-france.org:8081/revision/file/64a5a2fc291fd77a36fc8df3fa96253b00ce3846/debian/patches/ada-gcc-name.diff
[2] http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/gnat-aux/
[3] http://www.dragonlace.net

Hope this helps.

-- 
Ludovic Brenta.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 17:12 ` Mark Murray
  2011-10-23 19:54   ` Ludovic Brenta
@ 2011-10-23 20:32   ` Kulin Remailer
  2011-10-23 20:51     ` Mark Murray
  1 sibling, 1 reply; 13+ messages in thread
From: Kulin Remailer @ 2011-10-23 20:32 UTC (permalink / raw)


I didn't cross compile but when I installed 3.15p onto a system that already
had a more current gcc-ada installed, I installed the 3.15p into my user
directory. You can write a shell script to set the PATH to whatever you want
and choose from amongst your versions. Ludovic will undoubtedly have a
better suggestion.





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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 20:32   ` Kulin Remailer
@ 2011-10-23 20:51     ` Mark Murray
  2011-10-23 21:16       ` Simon Wright
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Murray @ 2011-10-23 20:51 UTC (permalink / raw)


On 23/10/2011 21:32, Kulin Remailer wrote:
> I didn't cross compile but when I installed 3.15p onto a system that already
> had a more current gcc-ada installed, I installed the 3.15p into my user
> directory. You can write a shell script to set the PATH to whatever you want
> and choose from amongst your versions. Ludovic will undoubtedly have a
> better suggestion.

Thanks! That's sort-of what I did for the bootstrap compiler, but PATH
shenannigans is NOT the way I want to go for "real" use.

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 19:54   ` Ludovic Brenta
@ 2011-10-23 21:03     ` Mark Murray
  2011-10-24 16:23       ` jrmarino
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Murray @ 2011-10-23 21:03 UTC (permalink / raw)


On 23/10/2011 20:54, Ludovic Brenta wrote:
> Mark Murray<w.h.oami@example.com>  writes:
>> Next step is to hack the source and see. Yuk! :-)
>
> In Debian GNU/Linux and GNU/kFreeBSD, gnat is patched to use gcc-x.y
> instead of just gcc.  The patch for 4.6 is here[1].

Thank you! Its useful to know which ones are the ones to change.

I've found something strange; there is a function called Program_Name
which (according to comments) should do what I want, but doesn't.
Its comments say it should put the same prefix/suffix onto the
first string that remain when the calling program has its
base-name (eg gnat, gnatmake) removed. Doesn't seem to work
on a VERY rudimentary test, but I need to identify that properly.

> But I think your best bet is simply to use the GNAT port by John
> Marino[2].  If you still want to learn how to build GNAT on FreeBSD, I
> suggest you get in touch with him[3] and collaborate on the port.

I'm working on the lang/gcc47 port. That gnat-aux may help a lot,
thanks!

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 20:51     ` Mark Murray
@ 2011-10-23 21:16       ` Simon Wright
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wright @ 2011-10-23 21:16 UTC (permalink / raw)


Mark Murray <w.h.oami@example.com> writes:

> On 23/10/2011 21:32, Kulin Remailer wrote:
>> I didn't cross compile but when I installed 3.15p onto a system that already
>> had a more current gcc-ada installed, I installed the 3.15p into my user
>> directory. You can write a shell script to set the PATH to whatever you want
>> and choose from amongst your versions. Ludovic will undoubtedly have a
>> better suggestion.
>
> Thanks! That's sort-of what I did for the bootstrap compiler, but PATH
> shenannigans is NOT the way I want to go for "real" use.

Personally I have no problems with PATH shenanigans. However, you
_might_ be interested in gnatfe [1]:

"This script acts as a front end to the GNAT compiler in the case where
you don't want to install GNAT over an existing compiler (perhaps your
main compiler is Apple's gcc-4.0.1, which doesn't support Ada), and/or
where you have more than one GNAT version installed."

[1] http://gnuada.sourceforge.net/pmwiki.php/Packages/Gnatfe



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-23 21:03     ` Mark Murray
@ 2011-10-24 16:23       ` jrmarino
  2011-10-24 18:28         ` Mark Murray
  0 siblings, 1 reply; 13+ messages in thread
From: jrmarino @ 2011-10-24 16:23 UTC (permalink / raw)


On Oct 23, 11:03 pm, Mark Murray <w.h.o...@example.com> wrote:
>
> I'm working on the lang/gcc47 port. That gnat-aux may help a lot,
> thanks!
>
> M
> --
> Mark "No Nickname" Murray
> Notable nebbish, extreme generalist.

GNAT-AUX is basically the latest released GNAT FSF compiler.
Currently it's 4.6.1, soon to be 4.6.2.  However, when gcc 4.7.0 is
released and gnat-aux is verified to be error-free, it will be
transitioned to gcc 4.7.
So...
A) You're basically re-inventing the wheel
B) You're going to be missing some vital patches.  I still haven't
forwarded necessary FreeBSD patches back the gcc project.  Any stock
build of gnat-gcc on FreeBSD is going to have issues.
C) There's no reason to bootstrap with an old gnat, gnat-aux is modern
so this is the compiler you should use to build this stock 4.7.

John



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-24 16:23       ` jrmarino
@ 2011-10-24 18:28         ` Mark Murray
  2011-10-24 18:52           ` jrmarino
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Murray @ 2011-10-24 18:28 UTC (permalink / raw)


On 24/10/2011 17:23, jrmarino wrote:
> GNAT-AUX is basically the latest released GNAT FSF compiler.
> Currently it's 4.6.1, soon to be 4.6.2.  However, when gcc 4.7.0 is
> released and gnat-aux is verified to be error-free, it will be
> transitioned to gcc 4.7.
> So...
> A) You're basically re-inventing the wheel

*BLUSH* OK :-)

> B) You're going to be missing some vital patches.  I still haven't
> forwarded necessary FreeBSD patches back the gcc project.  Any stock
> build of gnat-gcc on FreeBSD is going to have issues.

Gotcha. Thanks!

> C) There's no reason to bootstrap with an old gnat, gnat-aux is modern
> so this is the compiler you should use to build this stock 4.7.

Fair enough!

Thanks for pointing that out.

How hard would it be to incerease the number of languages it supports?
I'm hoping "not" :-). In order to avoid a proliferation of GCC builds,
I'd like to stick to one, where possible. I've had too many issues in
the past with various compiler builds jumping all over each other. A
smaller issue is simply trying to keep my ports count down; GCC is a
big build and in my infrequent "build world" + "rebuild all ports"
runs, "rebuild all ports" takes WWWAAAYYY longer than the OS itself!

Big win; if gnat-aux were to support Fortran (used a fair bit) and
Java (nice to have) or if the gcc46 port were to "grow" gnat-aux type
support, I'd be delighted!

Am I making overly lofty demands yet? ;-)

No worries; now that I know where to look, I'm sure I can come up with
a better plan to the previous one.

Thanks for your help!

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-24 18:28         ` Mark Murray
@ 2011-10-24 18:52           ` jrmarino
  2011-10-24 19:48             ` Mark Murray
  2011-10-24 20:14             ` Ludovic Brenta
  0 siblings, 2 replies; 13+ messages in thread
From: jrmarino @ 2011-10-24 18:52 UTC (permalink / raw)


On Oct 24, 8:28 pm, Mark Murray <w.h.o...@example.com> wrote:
>
> How hard would it be to incerease the number of languages it supports?
> I'm hoping "not" :-). In order to avoid a proliferation of GCC builds,

> Big win; if gnat-aux were to support Fortran (used a fair bit) and
> Java (nice to have) or if the gcc46 port were to "grow" gnat-aux type
> support, I'd be delighted!

I wouldn't hold your breath on gcc46 supporting Ada, the bootstrap
issue is hard to overcome.  GNAT-AUX demands a 25-30MB download just
for the first build of the compiler (in addition to the source code),
but after that it uses the compiler on the system to build new
versions.

New version support is whatever GCC is.  The GNAT-AUX tarball is
customized, and these extra languages are left it.  It would be a
matter of putting them back and adding language options.  Fortran
should be fine.  I understand the java is basically not worth having,
is it even being seriously maintained?  Last I checked/understood,
this option is probably not worth pursuing.

> Am I making overly lofty demands yet? ;-)

Not particularly, but compiling building and testing is a huge time-
suck.

> No worries; now that I know where to look, I'm sure I can come up with
> a better plan to the previous one.
>
> Thanks for your help!

No problem.
Dragonlace has all the source for gnat-aux.
When it's time to build GNAT-AUX based on 4.7, I'll make patch format
so it'll be easy to A) see what's different and B) start sending them
to gcc for integration.

John




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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-24 18:52           ` jrmarino
@ 2011-10-24 19:48             ` Mark Murray
  2011-10-24 20:14             ` Ludovic Brenta
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Murray @ 2011-10-24 19:48 UTC (permalink / raw)


On 24/10/2011 19:52, jrmarino wrote:
> I wouldn't hold your breath on gcc46 supporting Ada, the bootstrap
> issue is hard to overcome.  GNAT-AUX demands a 25-30MB download just
> for the first build of the compiler (in addition to the source code),
> but after that it uses the compiler on the system to build new
> versions.

OK. But could I hold my breath for gcc47 supporting Ada? ;-)

> New version support is whatever GCC is.  The GNAT-AUX tarball is
> customized, and these extra languages are left it.  It would be a
> matter of putting them back and adding language options.  Fortran
> should be fine.  I understand the java is basically not worth having,
> is it even being seriously maintained?  Last I checked/understood,
> this option is probably not worth pursuing.

For me, Fortran is important. Java is something I only use if I get
Java code that I'm unwilling to translate, and this is rare and getting
rarer. I'm guessing that some folks _may_ want obj-c* and go, but I'll
let them speak for themselves!

>> Am I making overly lofty demands yet? ;-)
>
> Not particularly, but compiling building and testing is a huge time-
> suck.

Thanks, and sure. Yell if you need a hand; I'm markm at freebsd.

>> No worries; now that I know where to look, I'm sure I can come up with
>> a better plan to the previous one.
>>
>> Thanks for your help!
>
> No problem.
> Dragonlace has all the source for gnat-aux.
> When it's time to build GNAT-AUX based on 4.7, I'll make patch format
> so it'll be easy to A) see what's different and B) start sending them
> to gcc for integration.

Thank you!

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-24 18:52           ` jrmarino
  2011-10-24 19:48             ` Mark Murray
@ 2011-10-24 20:14             ` Ludovic Brenta
  2011-10-24 20:21               ` Mark Murray
  1 sibling, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2011-10-24 20:14 UTC (permalink / raw)


jrmarino writes:
> On Oct 24, 8:28 pm, Mark Murray <w.h.o...@example.com> wrote:
>>
>> How hard would it be to incerease the number of languages it
>> supports?  I'm hoping "not" :-). In order to avoid a proliferation of
>> GCC builds,
>
>> Big win; if gnat-aux were to support Fortran (used a fair bit) and
>> Java (nice to have) or if the gcc46 port were to "grow" gnat-aux type
>> support, I'd be delighted!
>
> I wouldn't hold your breath on gcc46 supporting Ada, the bootstrap
> issue is hard to overcome.  GNAT-AUX demands a 25-30MB download just
> for the first build of the compiler (in addition to the source code),
> but after that it uses the compiler on the system to build new
> versions.
>
> New version support is whatever GCC is.  The GNAT-AUX tarball is
> customized, and these extra languages are left it.  It would be a
> matter of putting them back and adding language options.  Fortran
> should be fine.  I understand the java is basically not worth having,
> is it even being seriously maintained?  Last I checked/understood,
> this option is probably not worth pursuing.

I think the following changes to the GNAT-AUX port would solve that
problem "for free":

- GNAT-AUX no longer ships "gcc" but depends on the "gcc" from
  lang/gcc46 instead.

- GNAT-AUX installs into the directory tree of lang/gcc46, without
  overwriting any files of course, only adding new files.

- Leave the maintenance of Objective-C, Fortran and Java to people more
  capable and more interested in these languages.

It is not necessary to build the "gcc" of lang/gcc46 specially for it to
find whatever compiler is installed; just drop gnat1, cc1plus, gcj1,
gfortran1 etc. and their associated run-time libraries into the proper
directory and you're done.  This scheme has been successful in Debian
for years.  On the one hand we build C, C++, Fortran and Objective-C,
which all require only a C compiler for bootstrapping, together; on the
other hand we build Java and Ada, which require a second bootstrap
compiler, as separate source packages; but we build all from the same
source tarball, same build scripts and same patches from the same VCS.
The compiled binaries all install into a common tree.  Thus, the end
user simply installs gcc-4.6 plus any additional languages and run-time
libraries desired.

This technique also solves the problem of the size of the builds and the
time necessary for a full bootstrap, since we do not boostrap all
languages at once.

-- 
Ludovic Brenta.



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

* Re: Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT
  2011-10-24 20:14             ` Ludovic Brenta
@ 2011-10-24 20:21               ` Mark Murray
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Murray @ 2011-10-24 20:21 UTC (permalink / raw)


On 24/10/2011 21:14, Ludovic Brenta wrote:
> I think the following changes to the GNAT-AUX port would solve that
> problem "for free":

<snip>

If that could be made to work, it would be a bonus! I'm guessing that
some patches would also need to be applied, but FreeBSD already has a
mechanism for that.

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



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

end of thread, other threads:[~2011-10-24 20:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-23 13:59 Bootstrapping Gnu ADA onto FreeBSD/AMD64-CURRENT Mark Murray
2011-10-23 17:12 ` Mark Murray
2011-10-23 19:54   ` Ludovic Brenta
2011-10-23 21:03     ` Mark Murray
2011-10-24 16:23       ` jrmarino
2011-10-24 18:28         ` Mark Murray
2011-10-24 18:52           ` jrmarino
2011-10-24 19:48             ` Mark Murray
2011-10-24 20:14             ` Ludovic Brenta
2011-10-24 20:21               ` Mark Murray
2011-10-23 20:32   ` Kulin Remailer
2011-10-23 20:51     ` Mark Murray
2011-10-23 21:16       ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox