Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 865733 - sys-devel/gcc: ada use flag is unavailable, dev-lang/gnat-gpl no longer being updated
Summary: sys-devel/gcc: ada use flag is unavailable, dev-lang/gnat-gpl no longer being...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-19 03:13 UTC by Andrew Athalye
Modified: 2022-09-25 21:34 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Athalye 2022-08-19 03:13:27 UTC
AdaCore upstream made the decision to transition all further development of GNAT Community / free into Alire and the FSF version of GNAT. As a result, GNAT GPL will no longer see annual releases, and they instead recommend either building GCC with GNAT support, or using their precompiled binaries at https://github.com/alire-project/GNAT-FSF-builds/releases. To solve the issue, I propose re-enabling the ada use flag in sys-devel/gcc, and having it download a GNAT FSF bootstrap build from GNAT-FSF-builds in order to complete the build. Alternatively, the same 2014 GNAT build that is currently being used could be used.

Reproducible: Always

Steps to Reproduce:
1. USE="ada" emerge -a sys-devel/gcc

Actual Results:  
GNAT is not built, and GNAT dependencies are not pulled in

Expected Results:  
GNAT should be built, and an appropriate bootstrap image should be pulled in.

Note: I am on musl, which requires additional patches anyway, however that is not pertinent to this issue, since this a general issue impacting GNAT / Ada support.

Portage 3.0.30 (python 3.10.5-final-0, default/linux/amd64/17.0/musl/hardened/selinux, gcc-11.3.0, musl-1.2.3, 5.19.1-gentoo x86_64)
=================================================================
System uname: Linux-5.19.1-gentoo-x86_64-12th_Gen_Intel-R-_Core-TM-_i7-1260P-with-libc
KiB Mem:    32577600 total,  28384788 free
KiB Swap:    8388288 total,   8388288 free
Timestamp of repository gentoo: Wed, 17 Aug 2022 20:30:01 +0000
Head commit of repository gentoo: 043dde86df5da70a3a4b52818252c5c14bfd34f5
Timestamp of repository guru: Mon, 15 Aug 2022 14:16:50 +0000
Head commit of repository guru: 73b556a845480d71d9e0fe123c9c246c83cae0e5

Timestamp of repository musl: Sun, 14 Aug 2022 22:31:51 +0000
Head commit of repository musl: 417832e0e07376f5d485c035e464acedf87b1d39

sh bash 5.1_p16-r1
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.4::gentoo
app-shells/bash:           5.1_p16-r1::gentoo
dev-lang/perl:             5.34.1-r3::gentoo
dev-lang/python:           3.10.5::gentoo
dev-lang/rust:             1.62.1::musl
dev-util/cmake:            3.22.4::gentoo
dev-util/meson:            0.62.2::gentoo
sec-policy/selinux-base:   2.20220106-r3::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r2::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           14.0.6-r1::gentoo
sys-devel/gcc:             11.3.0::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/lld:             14.0.6::gentoo
sys-devel/llvm:            14.0.6-r2::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/libselinux:       3.4::gentoo
sys-libs/musl:             1.2.3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/lib/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="rsync://mirror.bytemark.co.uk/gentoo/ rsync://rsync.mirrorservice.org/distfiles.gentoo.org/ rsync://rsync.gtlib.gatech.edu/gentoo rsync://mirrors.rit.edu/gentoo/"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="ru.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/fish"
USE="X acl ada alsa amd64 audit bluetooth branding bzip2 cairo caps crypt cups dbus dvd egl elogind flac gif gles2 gnome-keyring gtk gtk3 hardened iconv icu ipv6 jack jpeg kms lcms libglvnd libnotify libtirpc mp3 mpeg ncurses nls nptl nvdec ogg opengl openmp opus pam pcre pdf peer_perms pie pipewire png policykit readline sdl seccomp selinux spell split-usr ssl ssp svg text tiff truetype ubac udisks unicode usb v4l vaapi vorbis vulkan wayland x264 xattr xml xtpax xvid zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="ru ru-RU fr fr-FRE en en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-19 03:22:30 UTC
I think it's "non-functional" for you because it's masked (sharing the output of emerge -pv sys-devel/gcc would help to determine the issue there).

But I do expect some chnages will end up being needed to accommodate this. Not that I'm an Ada expert (and would prefer not to become one ;)). I'll deter to tupone.

This might well be a duplicate of bug 547358 but I guess it's a bit different as the situation has changed.
Comment 2 Andrew Athalye 2022-08-19 03:59:43 UTC
(In reply to Sam James from comment #1)
> I think it's "non-functional" for you because it's masked (sharing the
> output of emerge -pv sys-devel/gcc would help to determine the issue there).
> 
> But I do expect some chnages will end up being needed to accommodate this.
> Not that I'm an Ada expert (and would prefer not to become one ;)). I'll
> deter to tupone.
> 
> This might well be a duplicate of bug 547358 but I guess it's a bit
> different as the situation has changed.

It is currently masked in base's package.use.mask. Additionally, toolchain.eclass currently prevents all packages that don't have gnat- in the name from building Ada support. This is on line 2515 of toolchain.eclass. Unfortunately, this means that even if I were to unmask USE=ada, gcc would still not build Ada support. My current solution removes the check for "gcc-lang-supported ada || return 1" and uses a local portage overlay to build GCC 12.1.0 with Ada support. For what it's worth, on glibc at least, this causes no issues, and I've set it as my system compiler without any problems (that I can notice).
Comment 3 Andrew Athalye 2022-08-19 04:01:00 UTC
I also have "-ada" in /etc/portage/profile/use.mask.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-19 04:03:44 UTC
If you have something which works, could you share it then, even if rough?
Comment 5 Andrew Athalye 2022-08-19 04:37:13 UTC
My setup makes only one change: in toolchain.eclass, it removes "gcc-lang-supported ada || return 1". If you then unmask USE=ada for sys-devel/gcc, it will correctly build Ada support, provided that you already have an Ada compiler installed.

To actually implement this, I copied eclass/toolchain.eclass to eclass/toolchain_custom.eclass in my local overlay, and also copied sys-devel/gcc to sys-devel/gcc-gnat in my local overlay. I replaced functions prefixed with toolchain with toolchain_custom in order to appease portage, and the resulting compiler was able to build Ada objects successfully (including gprbuild).

On a side note, other Ada infrastructure, like GPRBuild, needs some minor ebuild edits to understand that gcc can now provide an Ada compiler, but this was relatively trivial. Right now gcc executable names are being hardcoded into GPRBuild, which means that it always ends up using gcc-10.3.1 at the moment, instead of whatever compiler you are actually using.

I'm going to try getting this to work on my musl hardware in an hour or so - I expect that with Alpine patches (Ariadne Conill maintains gcc-gnat 12.1.0 for musl) it will mostly work fine.
Comment 6 Andrew Athalye 2022-08-19 04:38:53 UTC
I could attach patches, but since the change is literally the removal of one line and my toolchain_custom.eclass is based on a slightly older version of toolchain.eclass, the diff would end up being significantly less helpful than the description in my opinion. Please let me know if you have any issues building GNAT as I described - you do need an already working Ada compiler set as your system compiler for it to build correctly, so I used =gnat-gpl-2021.
Comment 7 Andrew Athalye 2022-08-19 17:50:54 UTC
Update: using Alpine's GCC-GNAT, I have made significant progress building GCC with Ada on musl. The primary issue now is use of a poisoned calloc by adaint.h, which is similiar to what was happening with USE=jit gcc. Currently looking for a fix, but I don't imagine it will be too difficult since everything else has built well thus far.
Comment 8 Andrew Athalye 2022-08-19 18:15:29 UTC
Alpine actually already has a patch for this - they avoid including <sched.h> and instead use void * whenever pointer types from sched.h would have been used instead. The reason why calloc poisoning occurs is because GCC has a long-standing policy of not permitting calloc or malloc from libc to be used inside GCC, but sched.h on musl directly uses calloc in a macro expansion, causing issues.
Comment 9 Andrew Athalye 2022-08-19 19:10:34 UTC
I would like to report a successful GCC-GNAT compile on musl Gentoo using GCC from Alpine Linux and some additional patches. The resulting compiler is able to build Ada code, although I had to add an entry to /etc/ld.so.conf.d so that ld-musl could find libgnarl-12.so.

To build the compiler I downloaded:
binutils, gcc, gcc-gnat, gmp, isl22, libatomic, libgcc, libgnat, libgnat-static, libgomp, libstdc++, mpc1, and mpfr4 from Alpine latest-stable.

I then unpacked them all, replaced all references to alpine-linux-musl with gentoo-linux-musl (including symlinks, etc.) Alpine is the same length as Gentoo, so this does not cause any issues with offsets.

I symlinked all of the binaries in the alpine usr/bin into /usr/local/bin so that emerge could find them, and added all ada and gnat patches from Alpine into /etc/portage/patches/sys-devel/gcc.

LD_LIBRARY_PATH="<path to alpine usr>/lib" USE="ada" emerge -a sys-devel/gcc::local

If you would like, I can build a binpkg for this, but using the alpine stuff to create a bootstrap package would also work.
Comment 10 Tupone Alfredo gentoo-dev 2022-08-29 10:34:21 UTC
(In reply to Andrew Athalye from comment #2)
> (In reply to Sam James from comment #1)
> > I think it's "non-functional" for you because it's masked (sharing the
> > output of emerge -pv sys-devel/gcc would help to determine the issue there).
> > 
> > But I do expect some chnages will end up being needed to accommodate this.
> > Not that I'm an Ada expert (and would prefer not to become one ;)). I'll
> > deter to tupone.
> > 
> > This might well be a duplicate of bug 547358 but I guess it's a bit
> > different as the situation has changed.
> 
> It is currently masked in base's package.use.mask. Additionally,
> toolchain.eclass currently prevents all packages that don't have gnat- in
> the name from building Ada support. This is on line 2515 of
> toolchain.eclass. Unfortunately, this means that even if I were to unmask
> USE=ada, gcc would still not build Ada support. My current solution removes
> the check for "gcc-lang-supported ada || return 1" and uses a local portage
> overlay to build GCC 12.1.0 with Ada support. For what it's worth, on glibc
> at least, this causes no issues, and I've set it as my system compiler
> without any problems (that I can notice).

Maybe it is a problem with the prebuilt images? I was able to build gcc:12 by selecting (gcc-config) gnat-gpl (I used the SLOT 10). After changing gcc to slot 12, I was also able to rebuild it using the new fresh generated compiler
Comment 11 Tupone Alfredo gentoo-dev 2022-09-17 14:08:08 UTC
ada USE flag is now unmasked for x86 and amd64
Comment 12 Andrew Athalye 2022-09-21 03:05:10 UTC
Great, I'll be testing that on my musl x86_64 target tonight just to be sure it works as well as 12.1.0. Are there any substantial changes that need to be made to get it working with GPRBuild and associated tools, or is it mostly a matter of updating the scripts to point to the right GCC installation?
Comment 13 Tupone Alfredo gentoo-dev 2022-09-21 06:57:06 UTC
(In reply to Andrew Athalye from comment #12)
> Great, I'll be testing that on my musl x86_64 target tonight just to be sure
> it works as well as 12.1.0. Are there any substantial changes that need to
> be made to get it working with GPRBuild and associated tools, or is it
> mostly a matter of updating the scripts to point to the right GCC
> installation?

I have tested on gcc-12.2.0

along gnat_2020 and gnat_2021 I added gcc_12_2_0

gprbuild/xmlada/libgpr/gnatcoll-core are already working with that flag.

The others will follow
Comment 14 Andrew Athalye 2022-09-21 17:58:51 UTC
Yep, can confirm it works on musl as well (the same patches for musl have apparently worked for the better part of a decade). Hopefully once this is considered stable work can resume on 547358 so that GNAT-GPL won't be directly required to build GCC [ada]