Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 592060 - Add Ada to toolchain.eclass
Summary: Add Ada to toolchain.eclass
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: AMD64 Linux
: Normal enhancement with 8 votes (vote)
Assignee: Gentoo Linux ADA team
URL:
Whiteboard:
Keywords:
: 783807 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-08-24 22:43 UTC by Luke A. Guest
Modified: 2022-09-18 09:30 UTC (History)
11 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch toolchain.eclass to add Ada support (add-ada-to-toolchain-eclass_v3.patch,4.10 KB, patch)
2016-08-24 22:43 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v4 (add-ada-to-toolchain-eclass_v4.patch,4.09 KB, patch)
2016-08-25 01:38 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v5 (add-ada-to-toolchain-eclass_v5.patch,4.07 KB, patch)
2016-08-25 09:56 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v6 (add-ada-to-toolchain-eclass_v6.patch,4.08 KB, patch)
2016-08-25 22:43 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v7 (add-ada-to-toolchain-eclass_v7.patch,4.07 KB, patch)
2016-08-26 00:46 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v8 (add-ada-to-toolchain-eclass_v8.patch,3.95 KB, patch)
2016-08-27 13:27 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v9 (toolchain.eclass,75.74 KB, patch)
2016-09-14 16:46 UTC, Luke A. Guest
Details | Diff
Add Ada to toolchain.eclass v10 (add-ada-support-to-toolchain-eclass.patch,3.88 KB, patch)
2017-04-22 13:47 UTC, Luke A. Guest
Details | Diff
Full debug log of 6.1.0 (gcc-build-logs.tar.bz2,674.13 KB, application/x-bzip2)
2017-05-03 11:28 UTC, Luke A. Guest
Details
Add Ada to toolchain.eclass v11 (add-ada-support-to-toolchain-eclass.patch,3.96 KB, patch)
2017-06-21 16:39 UTC, Luke A. Guest
Details | Diff
Latest toolchain.eclas from today, v12 (0001-New-toolchain.eclass-copied-over-and-patched-for-Ada.patch,2.57 KB, patch)
2017-08-14 16:36 UTC, Luke A. Guest
Details | Diff
Latest toolchain.eclas from today, v13 (0001-New-toolchain.eclass-copied-over-and-patched-for-Ada.patch,4.14 KB, patch)
2017-08-15 12:29 UTC, Luke A. Guest
Details | Diff
New patch, v14 (0001-New-toolchain.eclass-copied-over-and-patched-for-Ada.patch,4.14 KB, patch)
2017-08-15 12:38 UTC, Luke A. Guest
Details | Diff
Latest toolchain.eclas from today, v15 (0001-New-toolchain.eclass-copied-over-and-patched-for-Ada.patch,4.28 KB, patch)
2017-08-15 12:40 UTC, Luke A. Guest
Details | Diff
Latest toolchain.eclas from today, v16 (0001-New-toolchain.eclass-copied-over-and-patched-for-Ada.patch,4.21 KB, patch)
2017-08-15 18:42 UTC, Luke A. Guest
Details | Diff
Removes usage of the P macro (0001-Remove-P-macro-gnat-makefile.patch,1.06 KB, patch)
2017-08-19 17:55 UTC, Luke A. Guest
Details | Diff
Patch for gcc-6.3.0.ebuild (gcc-6.3.0.ebuild.gnat.patch,254 bytes, patch)
2017-08-19 17:55 UTC, Luke A. Guest
Details | Diff
Patch for gcc-6.4.0.ebuild (gcc-6.4.0.ebuild.gnat.patch,345 bytes, patch)
2017-08-19 17:56 UTC, Luke A. Guest
Details | Diff
Patch for gcc-7.1.0-r1.ebuild (gcc-7.1.0-r1.ebuild.gnat.patch,260 bytes, patch)
2017-08-19 17:56 UTC, Luke A. Guest
Details | Diff
Patch for gcc-6.4.0.ebuild v2 (gcc-6.4.0.ebuild.gnat.patch,240 bytes, patch)
2017-08-21 18:48 UTC, Luke A. Guest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luke A. Guest 2016-08-24 22:43:33 UTC
Created attachment 444064 [details, diff]
Patch toolchain.eclass to add Ada support

I'm trying to get a clean up of all the Ada stuff in Gentoo, I don't
really care if the old stuff gets removed as it's ancient and a complete
mess, IMO. There is absolutely no need for a separate compiler build just for Ada, i.e. the gnatgcc stuff. Ada should be part of the toolchain.eclass just like the other compilers.

Here's the first part in rectifying this, adding Ada into the
toolchain.eclass.

I have tested x86 and amd64 to bootstrap the system compiler for v4.9.3 and then used the subsequent compiler to build the next version, which was 5.1.0. All subsequent versions should be buildable by the previously installed compiler and if need be, be able to build the previous version with a later one.

It's a cleaner solution to the mess that we have now.
Comment 1 Anthony Basile gentoo-dev 2016-08-24 22:55:02 UTC
The patch looks safe enough to go in because everything is shielded by `in_iuse ada` but I don't know ada's build well enough to say if we have all the pieces.  Maybe others in toolchain can comment.  I do have a few questions:

1. Are you sure about this line?  It says that this will work with all versions of gcc in the tree except 2.95.3-r10.  Did you test?

+ tc_version_is_at_least 3 && IUSE+=" ada doc gcj awt hardened multilib objc"


2. I assume that ada is built with ada and so we're testing if we have an ada compiler with the following line, correct?

+if [[ ! -f `which gnatbind 2>&1|tee /dev/null` ]]; then
Comment 2 Luke A. Guest 2016-08-24 22:59:16 UTC
1) I've asked around if later versions would compile earlier versions, I can only find references to the installation saying it must be x or later for y version. So, can only say that it should work. I've not tested it. I know there are issues with certain versions compiling a later version, so for example, 4.9.x won't compile 6.x, but 4.9.3 will compile 5.1.0 and 5.x will compile 6.x.

2) gnatbind is one of the tools installed by the --enable-languages=ada, so testing for that binary is checking to see if there was already a GCC built with Ada enabled, therefore, don't use the bootstrap.
Comment 3 Luke A. Guest 2016-08-24 23:01:16 UTC
Ok, so I got a reply to a question about 1) on https://groups.google.com/forum/#!topic/comp.lang.ada/iFKBsDVZZns but it seems to be a question of whether the C compiler would work. I would need to build it to see.
Comment 4 Luke A. Guest 2016-08-25 01:35:58 UTC
I just tried building the following for x86 using the 5.1.0 compiler:

3.4.6-r2
4.4.7
4.5.4
4.6.4
4.7.4
4.8.5

All failed.

I set the system compiler to 4.9.3, trying them again:

3.4.6-r2
4.4.7
4.5.4
4.7.4

All failed again, but 4.8.5 compiled and installed fine. 

I don't think  it would be a problem setting the min version for the 4.9.3 bootstrap to 4.8.5, but given that Ada 2012 support didn't become decent/stable until the 4.9.x series, I think it's best to stick to that as a minimum version for now.

Trust me on this, anyone using Ada will want a newer compiler anyway as there have been a lot of internal compiler errors in previous versions, so it's always better to have a more up to date compiler.

Luke.
Comment 5 Luke A. Guest 2016-08-25 01:38:51 UTC
Created attachment 444066 [details, diff]
Add Ada to toolchain.eclass v4

Added ARM bootstrap.
Comment 6 Luke A. Guest 2016-08-25 01:40:36 UTC
Also, I've added the ada use flag to 4.9 minimum as I know it's a good version that will build itself without problems.
Comment 7 Anthony Basile gentoo-dev 2016-08-25 06:01:34 UTC
(In reply to Luke A. Guest from comment #5)
> Created attachment 444066 [details, diff] [details, diff]
> Add Ada to toolchain.eclass v4
> 
> Added ARM bootstrap.

Since you've already tested for version 4.9, the following, modulo comments, 

if [[ ! -f `which gnatbind 2>&1|tee /dev/null` ]]; then
        tc_version_is_at_least 3 && GNAT_BOOTSTRAP_VERSION="4.9"
        GNAT_STRAP_DIR="${WORKDIR}/gnat_strap"
fi

would be better written as

if in_iuse ada && [[ ! -f `which gnatbind 2>&1|tee /dev/null` ]]; then
        GNAT_BOOTSTRAP_VERSION="4.9"
        GNAT_STRAP_DIR="${WORKDIR}/gnat_strap"
fi
Comment 8 Luke A. Guest 2016-08-25 09:52:35 UTC
Well, really that line could be:

if [[ ! -f `which gnatbind 2>&1|tee /dev/null` ]]; then
	# First time build, so need to bootstrap this.
	# A newer version of GNAT should build an older version, just not vice-versa. 4.9 can definitely build 5.1.0.
	tc_version_is_at_least 4.9 && GNAT_BOOTSTRAP_VERSION="4.9"
	GNAT_STRAP_DIR="${WORKDIR}/gnat_strap"
fi

Because in the future further bootstraps will be required to handle later releases. But I'm happy to just take out the test for now.
Comment 9 Luke A. Guest 2016-08-25 09:56:51 UTC
Created attachment 444082 [details, diff]
Add Ada to toolchain.eclass v5
Comment 10 Anthony Basile gentoo-dev 2016-08-25 16:53:57 UTC
(In reply to Luke A. Guest from comment #9)
> Created attachment 444082 [details, diff] [details, diff]
> Add Ada to toolchain.eclass v5

you dropped the "in_iuse ada &&" that i added to that if statement.  i'm a bit worried about poluting the environment by setting GNAT_BOOTSTRAP_VERSION and GNAT_STRAP_DIR if we don't have ada in IUSE.
Comment 11 Luke A. Guest 2016-08-25 22:43:41 UTC
(In reply to Anthony Basile from comment #10)
> (In reply to Luke A. Guest from comment #9)
> > Created attachment 444082 [details, diff] [details, diff] [details, diff]
> > Add Ada to toolchain.eclass v5
> 
> you dropped the "in_iuse ada &&" that i added to that if statement.  i'm a
> bit worried about poluting the environment by setting GNAT_BOOTSTRAP_VERSION
> and GNAT_STRAP_DIR if we don't have ada in IUSE.

I actually didn't notice it.

Fixed.
Comment 12 Luke A. Guest 2016-08-25 22:43:59 UTC
Created attachment 444146 [details, diff]
Add Ada to toolchain.eclass v6
Comment 13 Anthony Basile gentoo-dev 2016-08-25 22:52:13 UTC
(In reply to Luke A. Guest from comment #12)
> Created attachment 444146 [details, diff] [details, diff]
> Add Ada to toolchain.eclass v6

okay, following gentoo policy, i have to email that to the gentoo-dev@ email list for review by the community and then i'll commit.
Comment 14 Luke A. Guest 2016-08-25 22:59:12 UTC
(In reply to Anthony Basile from comment #13)
> (In reply to Luke A. Guest from comment #12)
> > Created attachment 444146 [details, diff] [details, diff] [details, diff]
> > Add Ada to toolchain.eclass v6
> 
> okay, following gentoo policy, i have to email that to the gentoo-dev@ email
> list for review by the community and then i'll commit.

Okay, thanks for taking the time to look at it.
Comment 15 Anthony Basile gentoo-dev 2016-08-25 23:01:07 UTC
(In reply to Luke A. Guest from comment #14)
> (In reply to Anthony Basile from comment #13)
> > (In reply to Luke A. Guest from comment #12)
> > > Created attachment 444146 [details, diff] [details, diff] [details, diff] [details, diff]
> > > Add Ada to toolchain.eclass v6
> > 
> > okay, following gentoo policy, i have to email that to the gentoo-dev@ email
> > list for review by the community and then i'll commit.
> 
> Okay, thanks for taking the time to look at it.

actually before I email the list, I should bounce this bug off of Steve (nerdboy) since he's maintaining dev-lang/gnat-gcc.  we need to coordinate with him.

@steve, what do you think about bringing gnat into toolchain and building ada via `USE=ada emerge gcc` ?
Comment 16 Luke A. Guest 2016-08-25 23:09:37 UTC
(In reply to Anthony Basile from comment #15)
> (In reply to Luke A. Guest from comment #14)
> > (In reply to Anthony Basile from comment #13)
> > > (In reply to Luke A. Guest from comment #12)
> > > > Created attachment 444146 [details, diff] [details, diff] [details, diff] [details, diff] [details, diff]
> > > > Add Ada to toolchain.eclass v6
> > > 
> > > okay, following gentoo policy, i have to email that to the gentoo-dev@ email
> > > list for review by the community and then i'll commit.
> > 
> > Okay, thanks for taking the time to look at it.
> 
> actually before I email the list, I should bounce this bug off of Steve
> (nerdboy) since he's maintaining dev-lang/gnat-gcc.  we need to coordinate
> with him.
> 
> @steve, what do you think about bringing gnat into toolchain and building
> ada via `USE=ada emerge gcc` ?

That's fine, he's been aware of this from the outset. It's his gnatstrap's I'm using.
Comment 17 Luke A. Guest 2016-08-26 00:46:44 UTC
Created attachment 444148 [details, diff]
Add Ada to toolchain.eclass v7

Enhancement from "specing" on #Ada to change `which gnatbind 2>&1|tee /dev/null` into $(command -v gnatbind)
Comment 18 Arfrever Frehtes Taifersar Arahesis 2016-08-26 16:25:37 UTC
'[[ ! -f $(command -v gnatbind) ]]' should not be in global scope.
I suggest to replace it with '! type -P gnatbind > /dev/null'.

'[ ! -d ${GNAT_STRAP_DIR} ]' should be '[[ ! -d ${GNAT_STRAP_DIR} ]]'.

Only stdout (without stderr) of pushd / popd should be sent to /dev/null.

GNAT_EXTRA_BINS should be marked as local variable (and maybe lowercased).
Comment 19 Steve Arnold archtester gentoo-dev 2016-08-26 18:29:51 UTC
This is definitely cleaner than a separate package/eselect tool, but will need to integrate with gcc-config to set the proper adalib/adainclude paths.  I'm still working on the application side (ie, an updated gnat eclass) which needs to match the compiler side config.  I have a draft spec in the overlay:

https://github.com/sarnold/portage-overlay/blob/master/eclass/gnat-r1.eclass

# Gentoo GNAT/Ada policy draft (install locations, etc)
#
# Gnat package installs are no longer profile dependent; only the active GNAT
# profile is currently supported, so packages will depend on the latest SLOT.
# There is now only one set of install paths and directory locations
# that more-or-less follows the GNU & Debian Ada policies for shared libraries:
#   https://people.debian.org/~lbrenta/debian-ada-policy.html
# 
# Source files SHALL reside in directory $AdalibSpecsDir/<package-name>
#  - merge all source files (specs and bodies) into one directory if possible
#  - provide all required source files, and only source files
# The *.ali files SHALL reside in $AdalibLibTop/<package-name>
#  - *.ali files SHALL have read-only permissions for all users (mode 0444)
# Each library SHALL provide a library project file named <library>.gpr
#  - project files SHALL reside in a configured project search path as
#    shown by gnatls -v
#    - Current project path is /usr/share/gpr
#    - Goal project path is $AdalibSpecsDir (parent of library source dirs)
# Shared/static libraries and binaries SHALL reside in the standard locations

# The library project file SHALL have:
#  - a Source_Dirs attribute containing at least /usr/share/ada/adainclude/<library>
#  - a Library_ALI_Dir equal to /usr/$libdir/ada/adalib/<library>
#  - a Library_Name attribute equal to the library name of the shared library
#  - a Library_Kind attribute equal to ‘dynamic’
#  - a Library_Dir attribute equal to /usr/$libdir
#  - an Externally_Built attribute equal to ‘true’
#  - a Linker_Options section for any library dependencies
# *note: $libdir and linker options should be declared External

# Example:
#  library project <library> is
#     for Library_Name use "<library>";
#     for Library_Dir use "/usr/lib";
#     for Library_Kind use "dynamic";
#     for Source_Dirs use ("/usr/share/ada/adainclude/<library>");
#     for Library_ALI_Dir use "/usr/lib/ada/adalib/<library>";
#     for Externally_Built use "true";
#     package Linker is
#        for Linker_Options use ("-lindirectdependency");
#     end Linker;
#  end <library>;
#
# See ncurses gpr files for real examples
Comment 20 Anthony Basile gentoo-dev 2016-08-26 23:06:24 UTC
(In reply to Steve Arnold from comment #19)
> This is definitely cleaner than a separate package/eselect tool, but will
> need to integrate with gcc-config to set the proper adalib/adainclude paths.
> I'm still working on the application side (ie, an updated gnat eclass) which
> needs to match the compiler side config.  I have a draft spec in the overlay:

Is it premature to commit this change to the eclass?  It would seem to me that the change go gcc-config to set proper paths and the change to the eclass should go in simultaneously.
Comment 21 Luke A. Guest 2016-08-27 00:49:06 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #18)
> '[[ ! -f $(command -v gnatbind) ]]' should not be in global scope.
> I suggest to replace it with '! type -P gnatbind > /dev/null'.
> 
> '[ ! -d ${GNAT_STRAP_DIR} ]' should be '[[ ! -d ${GNAT_STRAP_DIR} ]]'.
> 
> Only stdout (without stderr) of pushd / popd should be sent to /dev/null.
> 
> GNAT_EXTRA_BINS should be marked as local variable (and maybe lowercased).

I'll do this tomorrow.
Comment 22 Luke A. Guest 2016-08-27 00:53:29 UTC
(In reply to Anthony Basile from comment #20)
> (In reply to Steve Arnold from comment #19)
> > This is definitely cleaner than a separate package/eselect tool, but will
> > need to integrate with gcc-config to set the proper adalib/adainclude paths.
> > I'm still working on the application side (ie, an updated gnat eclass) which
> > needs to match the compiler side config.  I have a draft spec in the overlay:
> 
> Is it premature to commit this change to the eclass?  It would seem to me
> that the change go gcc-config to set proper paths and the change to the
> eclass should go in simultaneously.

Have to agree on this. I will talk to Steve about it.
Comment 23 Arfrever Frehtes Taifersar Arahesis 2016-08-27 05:38:56 UTC
Due to requirement of invariance of metadata, SRC_URI cannot be dependent on existence of gnatbind or another file.

So the following can be done:

In global scope:

if in_iuse ada; then
	GNAT_BOOTSTRAP_VERSION="4.9"
fi

...

	if in_iuse ada; then
		GCC_SRC_URI+=" amd64? ( https://dev.gentoo.org/~nerdboy/files/gnatboot-${GNAT_BOOTSTRAP_VERSION}-amd64.tar.xz )
		...
	fi


In toolchain_src_unpack():

	# Unpack the Ada bootstrap if bootstrapping is necessary.
	if in_iuse ada && ! type -P gnatbind > /dev/null; then
		mkdir -p "${WORKDIR}/gnat_bootstrap" || die
		pushd "${WORKDIR}/gnat_bootstrap" > /dev/null || die

		case $(tc-arch) in
		...
		esac

		popd > /dev/null || die
	fi

In toolchain_src_configure():

	if in_iuse ada && [[ -d ${WORKDIR}/gnat_bootstrap ]]; then
		export GNATBOOT="${WORKDIR}/gnat_bootstrap/usr"



Other questions:

Does setting CC and CXX cause that gnatgcc and gnatg++ (instead of tools selected by gcc-config) are used for building of all C / C++ parts of GCC (at least during first phase of building of GCC)?
Comment 24 Luke A. Guest 2016-08-27 13:27:43 UTC
Created attachment 444250 [details, diff]
Add Ada to toolchain.eclass v8

Various changed made. Please go over it and make sure I haven't made any mistakes.


(In reply to Arfrever Frehtes Taifersar Arahesis from comment #23)
> Other questions:
> 
> Does setting CC and CXX cause that gnatgcc and gnatg++ (instead of tools
> selected by gcc-config) are used for building of all C / C++ parts of GCC
> (at least during first phase of building of GCC)?

Yes, because if we don't use them, the build won't find the Ada compiler. It must use the driver from the bootstrap or it won't work at all. But again, this is only for the first build, every time after that the script will use the system compiler.
Comment 25 Arfrever Frehtes Taifersar Arahesis 2016-08-27 20:18:31 UTC
`man 5 ebuild`:
"Note that the EXTRA_ECONF is for users only, not for ebuild writers. If you wish to pass more options to configure, just pass the extra arguments to econf."

So change 'EXTRA_ECONF+=(' to 'confgcc+=(' and drop new line with einfo.
Comment 26 Anthony Basile gentoo-dev 2016-08-27 23:52:32 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #25)
> `man 5 ebuild`:
> "Note that the EXTRA_ECONF is for users only, not for ebuild writers. If you
> wish to pass more options to configure, just pass the extra arguments to
> econf."
> 
> So change 'EXTRA_ECONF+=(' to 'confgcc+=(' and drop new line with einfo.

good catch!
Comment 27 Luke A. Guest 2016-09-14 16:46:26 UTC
Created attachment 445698 [details, diff]
Add Ada to toolchain.eclass v9

Latest revision based on latest in Gentoo tree.
Comment 28 Luke A. Guest 2016-09-14 16:59:12 UTC
(In reply to Steve Arnold from comment #19)

> This is definitely cleaner than a separate package/eselect tool, but will
> need to integrate with gcc-config to set the proper adalib/adainclude paths.

Yes.

> # Shared/static libraries and binaries SHALL reside in the standard locations

You sure about this? Each lib is compiled with a particular compiler in a particular slot, shouldn't Ada libs also be installed according to compiler slot?
Comment 29 Luke A. Guest 2017-04-22 13:47:03 UTC
Created attachment 470640 [details, diff]
Add Ada to toolchain.eclass v10

Patch against most recent toolchain.eclass
Comment 30 Luke A. Guest 2017-04-22 13:47:35 UTC
Can this patch be added into the eclass so I don't have to keep updating it?
Comment 31 Myckel Habets 2017-04-22 21:10:22 UTC
Removing x86 stabilization team, as I don't see a direct role for us in this. Please add us again if you want something going through stabilization testing.
Comment 32 onox 2017-05-02 21:48:55 UTC
Any progress on this bug? Having ada USE flag for gcc would be great.
Comment 33 Luke A. Guest 2017-05-02 22:10:16 UTC
Yes, check github, I've updated it. I've managed to build up to 5.4.0, but 6.x is failing with:

libtool: compile:  /var/tmp/portage/sys-devel/gcc-6.1.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.1.0/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-l
inux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortr
an -iquote/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortran/io -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortran/../gcc -I/var/tmp/portage/sys-devel/gcc-6.
1.0/work/gcc-6.1.0/libgfortran/../gcc/config -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortran/../libquadmath -I../.././gcc -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/g
cc-6.1.0/libgfortran/../libgcc -I../libgcc -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortran/../libbacktrace -I../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstric
t-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcx-fortran-rules -ffunction-sections -fdata-sections
 -g -march=native -O2 -pipe -MT symlnk.lo -MD -MP -MF .deps/symlnk.Tpo -c /var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/libgfortran/intrinsics/symlnk.c  -fPIC -DPIC -o .libs/symln
k.o
make[3]: *** No rule to make target 'gcc-6.1.0', needed by '../../gnatmake'.  Stop.
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.1.0/work/build/gcc/ada/tools'
make[2]: *** [Makefile:195: gnattools-native] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.1.0/work/build/gnattools'
make[1]: *** [Makefile:11306: all-gnattools] Error 2
make[1]: *** Waiting for unfinished jobs....
Comment 34 Luke A. Guest 2017-05-03 11:28:31 UTC
Created attachment 471560 [details]
Full debug log of 6.1.0

This fails at all-gnattools -> gnattools-native target.
Comment 35 Luke A. Guest 2017-05-06 14:36:28 UTC
I've added 2 new boostrap compilers for amd64, 5.3.0 and 6.3.0, they are inside a dropbox folder: https://www.dropbox.com/sh/stljjvpj9201n8t/AAAzVG67ppskZ9UKiWTWz9Q_a?dl=0

I built the these by ebuild ... prepare, then configure, make, etc using the installed compilers. So, the 6.x series builds with the 5.4.0 compiler, as it should.

In there is a compressed debug compile log of 6.1.0 which fails when building with emerge, see above it builds normally by hand. I get the same error when building 6.3.0 with emerge.

The failure starts at:

make -C ../gcc/ada/tools -f ../Makefile \
  "CC=../../xgcc -B../../" "CXX=../../xg++ -B../../ -B../../../x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B../../../x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L../../../x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L../../../x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs" "CFLAGS=-g -march=native -O2 -pipe -W -Wall" "LDFLAGS=-static-libstdc++ -static-libgcc " "ADAFLAGS=-gnatpg -gnata" "ADA_CFLAGS=" "INCLUDES=-iquote . -iquote .. -iquote ../.. -iquote /var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc/ada -iquote /var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc/config -iquote /var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/include" "ADA_INCLUDES=-I- -I../rts -I. -I/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc/ada" "exeext=" "fsrcdir=/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc" "srcdir=/var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/gcc" "GNATMAKE=../../gnatmake" "GNATLINK=../../gnatlink" "GNATBIND=../../gnatbind" "TOOLSCASE=native" \
  ../../gnatmake ../../gnatlink
Live child 0x6858a0 (gnattools-native) PID 28783 

Then for some reason, thinks there is a target with the name matching the compiler, which there isn't. I've no clue where it's coming from or how.

Updating goal targets....
Considering target file '../../gnatmake'.
 File '../../gnatmake' does not exist.
  Considering target file 'gcc-6.1.0'.
   File 'gcc-6.1.0' does not exist.
   Looking for an implicit rule for 'gcc-6.1.0'.
   Trying pattern rule with stem 'gcc-6.1.0'.
   Trying implicit prerequisite 'gcc-6.1.0.o'.
   ...
Comment 36 Luke A. Guest 2017-05-22 09:32:34 UTC
I created this bug report because that old one is so old and uses all the stuff that needs to be purged from the Gentoo tree as it's a massive hack and uses a complete rewrite of the toolchain.eclass. This *needs* to be part of the toolchain.eclass so that cross-dev also works. That is what this buig fixes, albeit for some reason anything above 5.4.0 doesn't build yet and I'm yet to see any resolution or help.
Comment 37 Luke A. Guest 2017-06-21 16:39:18 UTC
Created attachment 477544 [details, diff]
Add Ada to toolchain.eclass v11

A new patch against latest eclass, sync'd from today.
Comment 38 Luke A. Guest 2017-06-21 16:39:54 UTC
(In reply to Luke A. Guest from comment #37)
> Created attachment 477544 [details, diff] [details, diff]
> Add Ada to toolchain.eclass v11
> 
> A new patch against latest eclass, sync'd from today.

FYI, I've not been able to test this yet.
Comment 39 Luke A. Guest 2017-08-14 16:36:20 UTC
Created attachment 488908 [details, diff]
Latest toolchain.eclas from today, v12
Comment 40 Luke A. Guest 2017-08-15 12:29:50 UTC
Created attachment 489108 [details, diff]
Latest toolchain.eclas from today, v13

The previous patch was wrong.
Comment 41 Luke A. Guest 2017-08-15 12:38:35 UTC
Created attachment 489110 [details, diff]
New patch, v14

Removes a comment.
Comment 42 Luke A. Guest 2017-08-15 12:40:55 UTC
Created attachment 489112 [details, diff]
Latest toolchain.eclas from today, v15

Sort the use flags.
Comment 43 Luke A. Guest 2017-08-15 18:42:30 UTC
Created attachment 489216 [details, diff]
Latest toolchain.eclas from today, v16

Fixed the correct gcc and g++ bootstrap compilers, the names have changed since this was first created.
Comment 44 Luke A. Guest 2017-08-15 23:24:12 UTC
Ok, back to the issue at comment 33, where for some reason when compiling 6.3.0 with the 5.4.0 or the gnatboot strap tools, it fails because the makefiles are being passed a target of gcc-6.3.0!???
Comment 45 Luke A. Guest 2017-08-16 00:25:14 UTC
(In reply to Luke A. Guest from comment #44)
> Ok, back to the issue at comment 33, where for some reason when compiling
> 6.3.0 with the 5.4.0 or the gnatboot strap tools, it fails because the
> makefiles are being passed a target of gcc-6.3.0!???

This also happens with gcc-6.1.0
Comment 46 Sergei Trofimovich (RETIRED) gentoo-dev 2017-08-17 20:59:53 UTC
Latest toolchain patch introduces a bunch of binary tarballs that don't exist:

sys-devel/gcc $ LANG=C repoman manifest
>>> Downloading 'http://distfiles.gentoo.org/distfiles/gnatboot-6.3-i686.tar.xz'
--2017-08-17 21:57:45--  http://distfiles.gentoo.org/distfiles/gnatboot-6.3-i686.tar.xz
Resolving distfiles.gentoo.org... 64.50.233.100, 140.211.166.134, 137.226.34.46, ...
Connecting to distfiles.gentoo.org|64.50.233.100|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-08-17 21:57:45 ERROR 404: Not Found.

>>> Downloading 'https://dev.gentoo.org/~nerdboy/files/gnatboot-6.3-i686.tar.xz'
--2017-08-17 21:57:45--  https://dev.gentoo.org/~nerdboy/files/gnatboot-6.3-i686.tar.xz
Resolving dev.gentoo.org... 140.211.166.183, 2001:470:ea4a:1:5054:ff:fec7:86e4
Connecting to dev.gentoo.org|140.211.166.183|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-08-17 21:57:46 ERROR 404: Not Found.

!!! Couldn't download 'gnatboot-6.3-i686.tar.xz'. Aborting.
!!! Fetch failed for gnatboot-6.3-i686.tar.xz, can't update Manifest
Unable to generate manifest.
Comment 47 Luke A. Guest 2017-08-17 23:11:57 UTC
(In reply to Sergei Trofimovich from comment #46)
> Latest toolchain patch introduces a bunch of binary tarballs that don't
> exist:
> 
> sys-devel/gcc $ LANG=C repoman manifest
> >>> Downloading 'http://distfiles.gentoo.org/distfiles/gnatboot-6.3-i686.tar.xz'
> --2017-08-17 21:57:45-- 
> http://distfiles.gentoo.org/distfiles/gnatboot-6.3-i686.tar.xz
> Resolving distfiles.gentoo.org... 64.50.233.100, 140.211.166.134,
> 137.226.34.46, ...
> Connecting to distfiles.gentoo.org|64.50.233.100|:80... connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2017-08-17 21:57:45 ERROR 404: Not Found.
> 
> >>> Downloading 'https://dev.gentoo.org/~nerdboy/files/gnatboot-6.3-i686.tar.xz'
> --2017-08-17 21:57:45-- 
> https://dev.gentoo.org/~nerdboy/files/gnatboot-6.3-i686.tar.xz
> Resolving dev.gentoo.org... 140.211.166.183,
> 2001:470:ea4a:1:5054:ff:fec7:86e4
> Connecting to dev.gentoo.org|140.211.166.183|:443... connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2017-08-17 21:57:46 ERROR 404: Not Found.
> 
> !!! Couldn't download 'gnatboot-6.3-i686.tar.xz'. Aborting.
> !!! Fetch failed for gnatboot-6.3-i686.tar.xz, can't update Manifest
> Unable to generate manifest.

Currently not all the bootstraps have been built. I have 5.4 and 6.3.0 amd64 built. You can stop the from happening in your test env by commenting out the gnatboot i686 and arm lines and closing the string for amd64 as of now.

We need to get past the issue at comment 44 before we can go further. There is absolutely no reason why the build process should be getting a target of gcc-6.1.0 or gcc-6.3.0 passed to it.I can build a compiler without emerge and with Ada support using 5.4.0 and 6.3.0, but for some reason within the emerge env, this fails.
Comment 48 Luke A. Guest 2017-08-19 17:55:04 UTC
Created attachment 489690 [details, diff]
Removes usage of the P macro

This patch needs to go into /usr/portage/sys-devel/gcc/files/6.3.0, in gcc/ada/gcc-interface/Makefile.in there used to be a macro defined called P, in the Gentoo dev environment, this P means the product. In the lines where it is used ../../gnatmake$(exeext): and ../../gnatlink$(exeext): the dependencies on P were not removed, so in the build, make would be trying to find the target of gcc-6.3.0/6.4.0/7.1.0/etc.
Comment 49 Luke A. Guest 2017-08-19 17:55:38 UTC
Created attachment 489692 [details, diff]
Patch for gcc-6.3.0.ebuild

Adds gnat specific path to remove P.
Comment 50 Luke A. Guest 2017-08-19 17:56:00 UTC
Created attachment 489694 [details, diff]
Patch for gcc-6.4.0.ebuild

Adds gnat specific path to remove P.
Comment 51 Luke A. Guest 2017-08-19 17:56:24 UTC
Created attachment 489696 [details, diff]
Patch for gcc-7.1.0-r1.ebuild

Adds gnat specific path to remove P.
Comment 52 Luke A. Guest 2017-08-21 18:48:31 UTC
Created attachment 490036 [details, diff]
Patch for gcc-6.4.0.ebuild v2
Comment 53 Steve Arnold archtester gentoo-dev 2017-08-22 21:53:31 UTC
@blueness as far as comment #15 I missed this bug for a while but this has been discussed a lot in #ada so I've been more-or-less in the loop.  I was hoping that george would respond but that hasn't happened for many moons, and lately I've had too many customers/projects and no minimum distance between me and my wife while working...

Anyway, there are apparently other users interested in preserving Ada support, but bootstrap compilers aren't as easy as they used to be and it *does* make more sense to fold it into the normal toolchain stuff rather than continue to maintain what is essentially a separate fork just for Ada.

So it's about time for me to test this more heavily with the new bootstraps and (hopefully) move forward with the 6/7 versions (not sure about 5.x yet) and make gnat-gcc-4.9.4 the last version (possibly 5.4 for testing against new 5.4).  Also, since I just hit a bug with some packages picking up gnat-gcc (non-Ada) headers it seems like a good time to make the switch.

Lastly we still need to work out a new packaging policy/eclass for Ada packages but that needs more input (and toolchain comes first...)
Comment 54 Steve Arnold archtester gentoo-dev 2017-08-23 06:58:11 UTC
arrr, this is already the shiznitz :P

With a couple of tweaks, not only does it build a toolchain with Ada support, but then it builds ncurses with USE="ada".

Updated toolchain.eclass still needs some gcc-config integration and some (hardened) QA fixes, but nice piece of work overall.

Other packages like ncurses still rely on some ADA_PATH variables and need a place to install their sources/libs, so ebuild helper and policy draft (pretty much what was pasted here until we get more feedback) updates will come next.
Comment 55 Steve Arnold archtester gentoo-dev 2017-08-23 21:09:23 UTC
(In reply to Luke A. Guest from comment #28)
> (In reply to Steve Arnold from comment #19)

> > # Shared/static libraries and binaries SHALL reside in the standard locations
> 
> You sure about this? Each lib is compiled with a particular compiler in a
> particular slot, shouldn't Ada libs also be installed according to compiler
> slot?

For now, yes, since gcc/gnat is now installed/slotted with full version (eg, 5.4.0) instead of two-digit gnat slot, the adalibs/adaincludes paths can default to LIBPATH/*.  Once the packaging/policy decisions are firmed up, this might be tweaked a bit.

The above default is fine for a simple build/install of something like ncurses, but the (really) old george eclass/eselect thing used to keep track of each package that installed "ada libs" and I'm not sure if that was because of just the 2-digit slot or not.  It should fall out of the policy stuff, but at this point I'm not sure if we *need* to keep track of each installed set of libs per slot.  Which means each compiler slot gets whatever is installed/built with that version, so we need to decide what we want when a slot version is uninstalled, etc.
Comment 56 Luke A. Guest 2017-08-24 10:34:36 UTC
As for the building of a bootstrap, I didn't do too much, I pretty much did what nerdboy (says he) did:

ebuild gcc-6.4.0.ebuild prepare
mkdir /tmp/{install,build}-gcc-6.4.0-amd64
cd /tmp/build-gcc-6.4.0-amd64

Pretty much took the options from /tmp/usr/bin/gcc -v from an existing gnat bootstrap.

/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/configure --target=x86_64-pc-linux-gnu --prefix=/usr --with-arch=athlon64 --enable-languages=c,ada,c++ --with-gcc --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libmudflap --disable-libssp --disable-libunwind-exceptions --enable-libada --enable-threads=posix --enable-shared --enable-multilib --enable-__cxa_atexit --enable-clocale=gnu --disable-altivec --disable-fixed-point --disable-libgcj --disable-libcilkrts --disable-libsanitizer --disable-libquadmath --disable-bootstrap --disable-libvtv --disable-libgomp --without-ppl --without-cloog --without-isl --with-multilib-list=m64,m32 --enable-multiarch --enable-targets=all

make -j7 && make DESTDIR=/tmp/install-gcc-6.4.0-amd64 install-strip
Comment 57 Luke A. Guest 2017-08-24 10:35:22 UTC
(In reply to Steve Arnold from comment #53)

> 
> So it's about time for me to test this more heavily with the new bootstraps
> and (hopefully) move forward with the 6/7 versions (not sure about 5.x yet)
> and make gnat-gcc-4.9.4 the last version (possibly 5.4 for testing against
> new 5.4).  Also, since I just hit a bug with some packages picking up
> gnat-gcc (non-Ada) headers it seems like a good time to make the switch.

Tamiko (on #gentoo-toolchain) has already told me to focus on 6/7 rather than 5.4.0.
Comment 58 Steve Arnold archtester gentoo-dev 2017-08-27 17:37:27 UTC
Updated for various things; QA warnings in 6.x, path mangling, bootstrap use flag (at least for a little while) and tweaked the logic a bit to check for existing gnat.  The TODO marks the most questionable piece I could use feedback on, couldn't find a better way to rest the path for non-bootstrap build (when it was blank it failed the gnat configure test).

That said, 6.3/6.4/7.1 build fine from 6.4/7.1 bootstraps and previous/current installed gcc; they also build (slightly patched) ncurses Ada bindings, which get installed in the "normal" LIBPATH dirs for the active toolchain.  So far I've only appended the basic ADA env vars to gcc_envd_file which is enough to both find the files when building and tell packages where to install Ada files.

There is still one pullrequest for Luke but otherwise ready for feedback.
Comment 59 Steve Arnold archtester gentoo-dev 2017-08-30 03:26:07 UTC
Finally found the upstream bug with all the trampoline patches; although there are several bugs with arch-specific "add-ons" to the original core set.  I haven't checked the other arches yet, but x86/amd64 has the patches in 7.1 (but not 6.4 or below).  I'm assuming they wouldn't apply cleanly to 6.x so would take some amount of effort to back-port/test.  If nobody else does it in the next few weeks I might have time, don't let that stop anyone...

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67205
Comment 60 Steve Arnold archtester gentoo-dev 2017-09-30 02:38:13 UTC
This is pretty much done (pending any feedback) for the arches I can do with the hardware I have, mainly x86/amd64/arm/arm64.  I dropped the "ada" support for 4.x and below, so the new stuff has bootstraps for 5.4, 6.4, and 7.2 (makes a clean-ish cutover from gnat-gcc 4.9.3).  Mainly tested with hardened and related flags, built/rebuilt with both itself and the bootstrap builds, all green with the new patches (also tested with previous major version bootstraps and current, but current is default). Time to flame or merge (or flame then merge).
Comment 61 Steve Arnold archtester gentoo-dev 2017-10-07 19:01:50 UTC
I made a pull request (to myself) against the latest tree for review purposes, add comments as needed.  I'm fully armed with native and cross gnat toolchains now...

https://github.com/sarnold/gentoo/pull/1
Comment 62 David Kredba 2018-03-26 18:49:09 UTC
I tested it now with the =sys-devel/gcc-7.3.0-r1 and =sys-devel/gcc-4.9.4 on an ~amd64 default/linux/amd64/17.1/no-multilib profile in this order of versions. All worked perfectly for me, including switching gcc versions.
Comment 63 David Kredba 2019-04-29 06:38:41 UTC
Do you please have a variant patch not using the in_iuse() function in global scope?
Comment 64 Fedja Beader 2020-01-22 20:04:29 UTC
2020 brought in an undelayable update to gcc, and now I am without my faithful USE=Ada gcc-6.4.0. Where are we at?
Comment 65 Luke A. Guest 2020-01-22 21:30:22 UTC
We need new bootstraps, but for a quick fix on x86-64 (dunno about i586), we can use the dev-lang/gnat-gpl (2019-r1) toolchain as that bootstrap. But ideally, we need new ones for all targets.

This is because there was an ABI change last time I tried looking at this and the bootstraps weren't linked statically, so the maths libs were all wrong versions.

Then the Ada stuff needs to go back in, with nerdboy adding/checking what he did with the arm stuff before.

Then the toolchain people need to accept the patches, not so simple.
Comment 66 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-25 23:31:09 UTC
The topic was brought up a few times in #gentoo-toolchain. It looks like there is disagreement between intent of these patches and intent of how ada@ manages toolchains.

Reassigning to ada@ to agree on the approach.
Comment 67 Luke A. Guest 2020-03-26 17:27:49 UTC
(In reply to Sergei Trofimovich from comment #66)
> The topic was brought up a few times in #gentoo-toolchain. It looks like
> there is disagreement between intent of these patches and intent of how ada@
> manages toolchains.
> 
> Reassigning to ada@ to agree on the approach.

There is only one way to do this (for gcc's gnat), the correct way, the way I've already showed.

For llvm/gnat, that can be a separate ebuild, that can co-exist with sys-devel/gcc +ada.
Comment 68 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-19 00:59:51 UTC
*** Bug 783807 has been marked as a duplicate of this bug. ***
Comment 69 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-19 04:43:42 UTC
nerdboy?
Comment 70 Andrew Athalye 2022-06-19 15:47:52 UTC
Since Adacore has discontinued GNAT GPL upstream, it would probably be a good idea to integrate these changes from ~GCC 12. I can confirm that manually enabling Ada support in the GCC ebuild and using the old GNAT GPL to bootstrap it works as expected.
Comment 71 Tupone Alfredo gentoo-dev 2022-06-20 17:41:48 UTC
(In reply to Andrew Athalye from comment #70)
> Since Adacore has discontinued GNAT GPL upstream, it would probably be a
> good idea to integrate these changes from ~GCC 12. I can confirm that
> manually enabling Ada support in the GCC ebuild and using the old GNAT GPL
> to bootstrap it works as expected.

Did it build also all the dev-ada packages?
Comment 72 Luke A. Guest 2022-06-20 21:06:25 UTC
You can find the relevant changes and bootstraps in my overlay on gh.
Comment 73 Tupone Alfredo gentoo-dev 2022-09-17 17:17:34 UTC
ada use flag is now unmasked for x86 and amd64.

gcc-12.2.0 can be used now to build gprbuild and xmlada

For other architecture I don't see any other way except adding some gcc [ada] binary gnat-compilers out of the toolchain
Comment 74 Luke A. Guest 2022-09-17 19:37:14 UTC
Did you take anything from my overlay?
Comment 75 Tupone Alfredo gentoo-dev 2022-09-18 06:58:55 UTC
(In reply to Luke A. Guest from comment #74)
> Did you take anything from my overlay?

No, I don't know where it is, and what provide
sorry
Comment 76 Luke A. Guest 2022-09-18 09:30:12 UTC
You haven't really been paying attention then? I've posted in the dev-ml about it, I emailed you directly and you ignored me. If you go to sarnold's github below you can get to it.