bootstrapping gnat GCC on amd64

View: New views
20 Messages — Rating Filter:   Alert me  

bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I'm attempting to compile GNAT on AMD64 with an eye to
extending support to the platform (the gnat-gcc43 port
is ONLY_FOR_ARCH=i386).

GNAT obviously requires an Ada compiler to bootstrap.

What are my options here?

I suspect that I need to create an i386 jail to build
a cross compiler but am not sure.

Any help would be appreciated.
xw

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 4 May 2009, xorquewasp@... wrote:

> Hello.
>
> I'm attempting to compile GNAT on AMD64 with an eye to
> extending support to the platform (the gnat-gcc43 port
> is ONLY_FOR_ARCH=i386).
>
> GNAT obviously requires an Ada compiler to bootstrap.
>
> What are my options here?
>
> I suspect that I need to create an i386 jail to build
> a cross compiler but am not sure.

Is that your only system (amd64)?  I originally
ported GNAT to FreeBSD x86 from a solaris-sparc32 system.
I built a sparc-sun-freebsd GNAT cross compiler using
the native Solaris GNAT binary and its associated
sources.  I also (first) had to cross build binutils
similarly.   This made a cross compiler that ran on
Solaris and built ELF binaries for FreeBSD.  I then
used this cross compiler to rebuild GNAT as a FreeBSD
binary.  So it was 2 major steps: build a cross compiler,
then use the cross to build a native compiler.

It's been years since I've done that.  I don't know
how much has changed, but you probably have to do
something similar.

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-04 14:44:52, Daniel Eischen wrote:

> Is that your only system (amd64)?  I originally
> ported GNAT to FreeBSD x86 from a solaris-sparc32 system.
> I built a sparc-sun-freebsd GNAT cross compiler using
> the native Solaris GNAT binary and its associated
> sources.  I also (first) had to cross build binutils
> similarly.   This made a cross compiler that ran on
> Solaris and built ELF binaries for FreeBSD.  I then
> used this cross compiler to rebuild GNAT as a FreeBSD
> binary.  So it was 2 major steps: build a cross compiler,
> then use the cross to build a native compiler.
>
> It's been years since I've done that.  I don't know
> how much has changed, but you probably have to do
> something similar.
>
> --
> DE

Hello.

I have a debian system with a working x86 gnat gcc 4.3.3
and a freebsd x86 system running gnat gcc 4.3.2.

I guess the first step will be an i386->amd64 cross
compiler then.

Thanks,
xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 4 May 2009, xorquewasp@... wrote:

> On 2009-05-04 14:44:52, Daniel Eischen wrote:
>> Is that your only system (amd64)?  I originally
>> ported GNAT to FreeBSD x86 from a solaris-sparc32 system.
>> I built a sparc-sun-freebsd GNAT cross compiler using
>> the native Solaris GNAT binary and its associated
>> sources.  I also (first) had to cross build binutils
>> similarly.   This made a cross compiler that ran on
>> Solaris and built ELF binaries for FreeBSD.  I then
>> used this cross compiler to rebuild GNAT as a FreeBSD
>> binary.  So it was 2 major steps: build a cross compiler,
>> then use the cross to build a native compiler.
>>
>> It's been years since I've done that.  I don't know
>> how much has changed, but you probably have to do
>> something similar.
>>
>> --
>> DE
>
> Hello.
>
> I have a debian system with a working x86 gnat gcc 4.3.3
> and a freebsd x86 system running gnat gcc 4.3.2.
>
> I guess the first step will be an i386->amd64 cross
> compiler then.

Right, you should be able to do it from either of those,
but perhaps the freebsd x86 may be easier.

I would use a PREFIX other than /usr/local (or something
different than whatever your actual PREFIX is) for the
builds.

I was looking around for my notes but can't find them.
If I do find them, I'll post them.

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-04 15:03:32, Daniel Eischen wrote:
> Right, you should be able to do it from either of those,
> but perhaps the freebsd x86 may be easier.
>
> I would use a PREFIX other than /usr/local (or something
> different than whatever your actual PREFIX is) for the
> builds.
>
> I was looking around for my notes but can't find them.
> If I do find them, I'll post them.

I've built an i386 jail and am currently building the
gnat-gcc43 port to compile a GNAT cross-compiler (i386 ->
amd64).

There are two reasons for this whole exercise: I just moved
over to amd64 and want a native toolchain and I also have a
lot of software written in Ada that I'd like to submit to
FreeBSD ports but can't due a lack of an Ada compiler on amd64.

I noticed that the gnat-gcc43 port downloads a rather
anonymous set of gcc 4.1 bootstrap binaries. I assume I'd
have to provide my own in the same manner to create a port?

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 5 May 2009, xorquewasp@... wrote:

> On 2009-05-04 15:03:32, Daniel Eischen wrote:
>> Right, you should be able to do it from either of those,
>> but perhaps the freebsd x86 may be easier.
>>
>> I would use a PREFIX other than /usr/local (or something
>> different than whatever your actual PREFIX is) for the
>> builds.
>>
>> I was looking around for my notes but can't find them.
>> If I do find them, I'll post them.
>
> I've built an i386 jail and am currently building the
> gnat-gcc43 port to compile a GNAT cross-compiler (i386 ->
> amd64).
>
> There are two reasons for this whole exercise: I just moved
> over to amd64 and want a native toolchain and I also have a
> lot of software written in Ada that I'd like to submit to
> FreeBSD ports but can't due a lack of an Ada compiler on amd64.
>
> I noticed that the gnat-gcc43 port downloads a rather
> anonymous set of gcc 4.1 bootstrap binaries. I assume I'd
> have to provide my own in the same manner to create a port?

Yes, you can look at my lang/gnat port to find its
bootstrap compiler.  I would recommend making a binary
bootstrap compiler on the earliest version of FreeBSD
amd64 as you can.  If you use 8.0-current for instance,
others will not be able to build the port on 7.x.

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-04 20:54:46, Daniel Eischen wrote:
> Yes, you can look at my lang/gnat port to find its
> bootstrap compiler.  I would recommend making a binary
> bootstrap compiler on the earliest version of FreeBSD
> amd64 as you can.  If you use 8.0-current for instance,
> others will not be able to build the port on 7.x.

Earliest version of FreeBSD that fully supports this
hardware is 7.2, so I personally can't go back to an
earlier release than that.

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 5 May 2009, xorquewasp@... wrote:

> On 2009-05-04 20:54:46, Daniel Eischen wrote:
>> Yes, you can look at my lang/gnat port to find its
>> bootstrap compiler.  I would recommend making a binary
>> bootstrap compiler on the earliest version of FreeBSD
>> amd64 as you can.  If you use 8.0-current for instance,
>> others will not be able to build the port on 7.x.
>
> Earliest version of FreeBSD that fully supports this
> hardware is 7.2, so I personally can't go back to an
> earlier release than that.

Keep good notes - maybe someone else can do it once you
have the procedure down and working ;-)

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Parent Message unknown Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-06 10:57:25, Daniel Eischen wrote:

>
> Back in the day when I did it, it was with gcc-2.7.x or
> gcc-2.8.x I believe.  The cross build process with gnat
> was a little different.  I couldn't do a normal gnat build,
> which did a bootstrap and then rebuilt the compiler again
> using the bootstrap.  I believe I had to manually build
> bootstrap, gnatlib-cross, and gnattools-cross or targets
> named something like that.  I don't even think "install"
> worked - I think I had to manually install the cross.
>
> This does sound vaguely familiar though.  I may have
> just rebuilt the target->target GNAT with the cross
> GNAT, then whenever the build process stopped with
> gnatmake errors, I would manually build whatever target
> it stopped at with the cross gnatbind and gnatlink.
>
> I don't even know if gnatmake is required to rebuild
> the target->target GNAT, all the dependencies should
> be listed in the Makefiles, so gcc should get called
> directly as opposed through gnatmake.  So try going
> forward with rebuilding that x86_64 native GNAT and
> see what happens.  This is really what your goal is,
> having the i386->x86_64 cross is nice, but not really
> essential.
>
> Hmm, I do know that building gnat as a cross
> does work though, since we have and use GNAT for
> sparc-solaris hosted ppc-vxworks cross compilers.
> And gnatmake works just fine as a cross.

Thanks for the notes.

This is an example of one of the build failures when
compiling the x86_64 native GNAT:

mkdir -p ada/bldtools/nmake_b
rm -f ada/bldtools/nmake_b/sinfo.ads ada/bldtools/nmake_b/nmake.adt ada/bldtools/nmake_b/xnmake.adb ada/bldtools/nmake_b/xutil.ads ada/bldtools/nmake_b/xutil.adb
cp -p ../../gcc-4.4.0/gcc/ada/sinfo.ads ../../gcc-4.4.0/gcc/ada/nmake.adt ../../gcc-4.4.0/gcc/ada/xnmake.adb ../../gcc-4.4.0/gcc/ada/xutil.ads ../../gcc-4.4.0/gcc/ada/xutil.adb ada/bldtools/nmake_b
(cd ada/bldtools/nmake_b && x86_64-unknown-freebsd7.2-gnatmake -q xnmake && ./xnmake -b ../../nmake.adb )
x86_64-unknown-freebsd7.2-gnatmake: "xnmake.ali" incompatible ALI file, please recompile
x86_64-unknown-freebsd7.2-gnatmake: "xnmake.adb" compilation error
gmake[2]: *** [ada/nmake.adb] Error 4
gmake[2]: Leaving directory `/root/gcc-4.4.0-obj/gcc'
gmake[1]: *** [all-gcc] Error 2
gmake[1]: Leaving directory `/root/gcc-4.4.0-obj'
gmake: *** [all] Error 2

The Makefiles are pretty twisted and hard to comprehend.

I'll try your suggestion, stepping through each target and
ideally try to get the whole process down to shell script
form.

More news to follow...

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Parent Message unknown Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just an update.

Finally managed to get the i386 -> amd64 compiler to compile
gcc 4.4.0. It took a few Makefile patches as for some reason,
cross compilation breaks gnatmake.

About to try to get the amd64 compiler to compile itself and
run the test suite.

Added a system-freebsd_x86_64.ads profile and checked all the
other references to freebsd in the source.

I've scripted the entire bootstrap process so it should be
easy to produce binaries for a port.

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

After a week off, another update:

I've realised, too late, that I'm using a version of binutils
(2.19) that's incompatible with the system binutils (2.15).
Specifically, assembler code emitted by the native GNAT contains
.cfi_personality directives (and no doubt other things too) that
can't be processed by the system 'as'.

I've got two choices now and would appreciate some advice on
which to take given that I want to produce a FreeBSD port:

  1. Compile binutils-2.15.

  Unfortunately, compiling these as cross-binutils appear to be problematic:

  gmake[3]: Entering directory `/root/memfs/c1-bu-obj/gas'
  gcc -DHAVE_CONFIG_H -I. -I/root/binutils-2.15/gas -I. -D_GNU_SOURCE -I. -I/root/binutils-2.15/gas -I../bfd -I/root/binutils-2.15/gas/config -I/root/binutils-2.15/gas/../include -I/root/binutils-2.15/gas/.. -I/root/binutils-2.15/gas/../bfd -I/root/binutils-2.15/gas/../intl -I../intl -DLOCALEDIR="\"/cross/x86_64/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c /root/binutils-2.15/gas/app.c
  In file included from /root/binutils-2.15/gas/as.h:94,
                 from /root/binutils-2.15/gas/app.c:30:
  /root/binutils-2.15/gas/../include/getopt.h:116: warning: function declaration isn't a prototype
  In file included from ./targ-cpu.h:1,
                 from /root/binutils-2.15/gas/config/obj-elf.h:42,
                 from ./obj-format.h:1,
                 from /root/binutils-2.15/gas/config/te-freebsd.h:30,
                 from ./targ-env.h:1,
                 from /root/binutils-2.15/gas/as.h:626,
                 from /root/binutils-2.15/gas/app.c:30:
  /root/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type
  gmake[3]: *** [app.o] Error 1
  gmake[3]: Leaving directory `/root/memfs/c1-bu-obj/gas'
  gmake[2]: *** [all-recursive] Error 1
  gmake[2]: Leaving directory `/root/memfs/c1-bu-obj/gas'
  gmake[1]: *** [all] Error 2
  gmake[1]: Leaving directory `/root/memfs/c1-bu-obj/gas'
  gmake: *** [all-gas] Error 2

  2. Continue to use binutils-2.19.

  This would appear to require me to create a binutils-2.19 port
  just for the GNAT compiler. Seems like it would be preferable
  to use the system binutils rather than to take this route...

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-18 09:48:31, xorquewasp@... wrote:

>   1. Compile binutils-2.15.
>
>   Unfortunately, compiling these as cross-binutils appear to be problematic:
>
>   gmake[3]: Entering directory `/root/memfs/c1-bu-obj/gas'
>   gcc -DHAVE_CONFIG_H -I. -I/root/binutils-2.15/gas -I. -D_GNU_SOURCE -I. -I/root/binutils-2.15/gas -I../bfd -I/root/binutils-2.15/gas/config -I/root/binutils-2.15/gas/../include -I/root/binutils-2.15/gas/.. -I/root/binutils-2.15/gas/../bfd -I/root/binutils-2.15/gas/../intl -I../intl -DLOCALEDIR="\"/cross/x86_64/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c /root/binutils-2.15/gas/app.c
>   In file included from /root/binutils-2.15/gas/as.h:94,
>                  from /root/binutils-2.15/gas/app.c:30:
>   /root/binutils-2.15/gas/../include/getopt.h:116: warning: function declaration isn't a prototype
>   In file included from ./targ-cpu.h:1,
>                  from /root/binutils-2.15/gas/config/obj-elf.h:42,
>                  from ./obj-format.h:1,
>                  from /root/binutils-2.15/gas/config/te-freebsd.h:30,
>                  from ./targ-env.h:1,
>                  from /root/binutils-2.15/gas/as.h:626,
>                  from /root/binutils-2.15/gas/app.c:30:
>   /root/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type
>   gmake[3]: *** [app.o] Error 1
>   gmake[3]: Leaving directory `/root/memfs/c1-bu-obj/gas'
>   gmake[2]: *** [all-recursive] Error 1
>   gmake[2]: Leaving directory `/root/memfs/c1-bu-obj/gas'
>   gmake[1]: *** [all] Error 2
>   gmake[1]: Leaving directory `/root/memfs/c1-bu-obj/gas'
>   gmake: *** [all-gas] Error 2

Correction. Will compile with patches from here:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=299671

But doesn't pass test suite:

  # of expected passes    28
  # of unexpected failures  20

Test logs show:

Executing /root/binutils-2.15/gas/testsuite/lib/run ../as-new  --32 -al /root/binutils-2.15/gas/testsuite/gas/i386/float.s >&dump.out
regexp_diff match failure
regexp "^.*: Assembler messages:$"
line   "Assembler messages:"
regexp_diff match failure
regexp "^.*:3: Warning:.*faddp.*$"
line   "FATAL: can't create a.out: Invalid bfd target"
extra regexps in /root/binutils-2.15/gas/testsuite/gas/i386/float.l starting with "^.*:14: Warning:.*fsubp.*$"
EOF from dump.out
FAIL: i386 float

I have no idea why this happens.

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 18 May 2009, xorquewasp@... wrote:

> Hi.
>
> After a week off, another update:
>
> I've realised, too late, that I'm using a version of binutils
> (2.19) that's incompatible with the system binutils (2.15).
> Specifically, assembler code emitted by the native GNAT contains
> .cfi_personality directives (and no doubt other things too) that
> can't be processed by the system 'as'.
>
> I've got two choices now and would appreciate some advice on
> which to take given that I want to produce a FreeBSD port:
>
>  1. Compile binutils-2.15.
>
>  Unfortunately, compiling these as cross-binutils appear to be problematic:

Hmm, if the system binutils is 2.15, then it should build
as a cross.  You can do a cross build of all FreeBSD - I
think you just set TARGET="amd64" to build amd64 from
a different arch.  Part of this process should be to
create a cross binutils toolset.

>  2. Continue to use binutils-2.19.
>
>  This would appear to require me to create a binutils-2.19 port
>  just for the GNAT compiler. Seems like it would be preferable
>  to use the system binutils rather than to take this route...

Well, I used a newer binutils on sparc when I did the original
port.  Once I built the cross compiler and binutils toolset,
I was done with it.  After the native compiler is built using
the cross tools, you should be able to rebuild the native
compiler _again_ but this time with the system (amd64)
binutils.

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-18 18:36:15, Daniel Eischen wrote:
> Hmm, if the system binutils is 2.15, then it should build
> as a cross.  You can do a cross build of all FreeBSD - I
> think you just set TARGET="amd64" to build amd64 from
> a different arch.  Part of this process should be to
> create a cross binutils toolset.

Ok.

Silly question - is it actually possible to build contrib/binutils
(including TARGET=amd64) without building the whole tree? Trying
the obvious:

  cd /usr/obj
  /usr/src/contrib/binutils/configure \
    --target=x86_64-pc-freebsd7.2     \
    --host=i386-pc-freebsd7.2         \
    --build=i386-pc-freebsd7.2        \
    --prefix=/cross/x86_64

.. Didn't work (didn't really expect it to).

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-18 18:36:15, Daniel Eischen wrote:
> Well, I used a newer binutils on sparc when I did the original
> port.  Once I built the cross compiler and binutils toolset,
> I was done with it.  After the native compiler is built using
> the cross tools, you should be able to rebuild the native
> compiler _again_ but this time with the system (amd64)
> binutils.

I probably should point out that I don't think this is the case anymore.

GCC apparently detects what capabilities the currently selected binutils
have so when the first native compiler has been compiled using the
cross, it will emit code that can't be assembled using the system
binutils (because it uses features from the new binutils that aren't
supported by the older system ones). In other words, you can't rebuild the
native compiler using the system binutils.

If the worst comes to the worst, I can create a dependency on the
devel/cross-binutils port.

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 19 May 2009, xorquewasp@... wrote:

> On 2009-05-18 18:36:15, Daniel Eischen wrote:
>> Well, I used a newer binutils on sparc when I did the original
>> port.  Once I built the cross compiler and binutils toolset,
>> I was done with it.  After the native compiler is built using
>> the cross tools, you should be able to rebuild the native
>> compiler _again_ but this time with the system (amd64)
>> binutils.
>
> I probably should point out that I don't think this is the case anymore.
>
> GCC apparently detects what capabilities the currently selected binutils
> have so when the first native compiler has been compiled using the
> cross, it will emit code that can't be assembled using the system
> binutils (because it uses features from the new binutils that aren't
> supported by the older system ones). In other words, you can't rebuild the
> native compiler using the system binutils.
>
> If the worst comes to the worst, I can create a dependency on the
> devel/cross-binutils port.

Even so, you shouldn't need a cross-binutils, only a native
(amd64) binutils.  Your port won't be a cross port, but a
native amd64 port.  The native amd64 GNAT will need a native
binutils, not a cross binutils.  The only thing you will have
to make is a minimal bootstrap (native amd64) compiler.

Of course you can create a cross port if you want to facilitate
cross builds for ports that don't exist yet, but no one running
amd64 will want to make a cross build when they can make a
faster native build with less dependencies.

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 19 May 2009, xorquewasp@... wrote:

> On 2009-05-18 18:36:15, Daniel Eischen wrote:
>> Hmm, if the system binutils is 2.15, then it should build
>> as a cross.  You can do a cross build of all FreeBSD - I
>> think you just set TARGET="amd64" to build amd64 from
>> a different arch.  Part of this process should be to
>> create a cross binutils toolset.
>
> Ok.
>
> Silly question - is it actually possible to build contrib/binutils
> (including TARGET=amd64) without building the whole tree? Trying
> the obvious:
>
>  cd /usr/obj
>  /usr/src/contrib/binutils/configure \
>    --target=x86_64-pc-freebsd7.2     \
>    --host=i386-pc-freebsd7.2         \
>    --build=i386-pc-freebsd7.2        \
>    --prefix=/cross/x86_64
>
> .. Didn't work (didn't really expect it to).

I've not done a cross build before, but I'd look in
src/Makefile.inc1 if you want to try to build it
piecemeal (see the target for cross-tools).

--
DE
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-05-19 09:51:08, Daniel Eischen wrote:

>
> Even so, you shouldn't need a cross-binutils, only a native
> (amd64) binutils.  Your port won't be a cross port, but a
> native amd64 port.  The native amd64 GNAT will need a native
> binutils, not a cross binutils.  The only thing you will have
> to make is a minimal bootstrap (native amd64) compiler.
>
> Of course you can create a cross port if you want to facilitate
> cross builds for ports that don't exist yet, but no one running
> amd64 will want to make a cross build when they can make a
> faster native build with less dependencies.

'lo,

Sorry, I should have been a bit clearer there. I mean if in the
very worst case, I can't get by with the system binutils, I can
create a "native" set of recent binutils using the cross-binutils
port:

  cd /usr/ports/devel/cross-binutils
  make TGTARCH=x86_64 TGTABI=freebsd7.2 install

That way, the port can just depend on those and I won't have to
create my own binutils port.

Like I said, I'm hoping this won't happen.

Current status is that I have a working native AMD64 GNAT using
2.19 binutils!

$ gcc44 -v
Using built-in specs.
Target: x86_64-pc-freebsd7.2
Configured with: /usr/jails/i386/root/gcc-4.4.0/configure
  --build=x86_64-pc-freebsd7.2
  --enable-languages=c,ada
  --disable-nls
  --with-system-zlib
  --with-libiconv-prefix=/usr/local
  --program-suffix=44
  --bindir=/usr/local/bin/gcc44
  --libdir=/usr/local/lib/gcc-4.4.0
  --prefix=/usr/local
  --mandir=/usr/local/man
  --infodir=/usr/local/info/gcc44
Thread model: posix
gcc version 4.4.0 (GCC)

Needless to say, I'm pretty pleased.

xw
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by Daniel Eischen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How's this all going?

I'm updating lang/gnat to gnat-2009 right now.  In the
GNAT sources, it has build instructions including how
to build the cross - see below.

--
DE

--------------------------------------
-- BUILDING GNAT - EXAMPLE SEQUENCE --
--------------------------------------

Supposing you have one tarball for the GCC sources and one for the GNAT
sources, here is a possible way to proceed:

0/ If not available on your system, build libgmp and libmpfr following
    build instructions from these packages.

1/ Create a root directory into which you'll later setup the source and
    build subdirectories:

    ~ $ mkdir GNAT
    ~ $ cd GNAT

2/ Setup an initial source tree from the GCC and the GNAT tarballs:

   ~/GNAT $ gzip -dc [...]/gcc-4.3*.tgz | tar xf -
   ~/GNAT $ mv gcc-4* src
   ~/GNAT $ cd src

   ~/GNAT/src $ gzip -dc [...]/gnat-xxx-src.tgz  | tar xf -
   ~/GNAT/src $ mv gnat-xxx-src/src/ada gcc
   ~/GNAT/src $ patch -p0 < gnat-xxx-src/src/gcc-43.dif
   ~/GNAT/src $ touch gcc/cstamp-h.in

3/ Prepare and configure the build tree:

   ~/GNAT/src $ mkdir ../obj; cd ../obj
   ~/GNAT/obj $ ../src/configure --enable-languages="c,ada" --disable-libada ...
   [see the GCC documentation for other relevant configure options]

4/ Build the compiler, run time and tools:

   Note that the use of "GNU Make" is required by the GCC Makefiles.

   ~/GNAT/obj $ make bootstrap
   ~/GNAT/obj $ make -C gcc gnatlib gnattools

   If you are building a cross compiler, you will need to replace
   the above sequence by something similar to:

   ~/GNAT/obj $ make
   ~/GNAT/obj $ make -C gcc gnatlib cross-gnattools ada.all.cross

5/ Install the whole package:

   ~/GNAT/obj $ make install

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: bootstrapping gnat GCC on amd64

by xorquewasp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Status update:

http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00102.html

I replied to the last email in the thread but haven't
heard back yet. Presumably I'll be maintaining the FreeBSD
x86_64 port.

I'm about to start work on the FreeBSD port now.

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."