Fixpoint

2024-05-17

Poking at a swarm of GNATs

Filed under: Eulora, Gales Linux, Software — Jacob Welsh @ 17:10

What's to be done about Gales Linux development? If it's to gain any life as a collaborative project, it can't continue as it's been, a local git repository on my private laptop.

Smart people have come up with an improved paradigm and toolset for working with code as text, at some expense, and it would be most unfortunate to pass up the chance to use it, to continue shaping and being shaped by it. But it brings along what appears from one perspective as quite an onerous dependency: the Ada programming language with its GNAT implementation. So a first impulse is to work on specifying the tools more clearly and reimplement them, most likely in C, which for all its well-known pitfalls remains near-universal as the native language of the extant computing world.

Yet if GNAT proves at all digestible, not only would it save the rewriting effort here, but the addition of Ada support would open a whole new space of possibilities for Gales itself, in terms of what it can be used for. Ada has, after all, been considered the definitive programming language, the pinnacle at least of the static-typing family and the culmination of decades of practical experience and concerted effort.

As to digestibility, computing is this strange field where just about any system is theoretically and even provably capable of swallowing whole absolutely any other system, given only enough time and a wide enough gullet (i.e. enough memory). Like with snakes! So it isn't a question of possibility but really more akin to an ethical dilemma. How many and which immigrants do you allow into your Open Society, before it's no longer recognizable as yours, open, or even a place you'd want to live? What new core facilities do we allow into Gales, before it's no longer recognizable as Gales, or a system you'd want to use and build on?

Of course we have some general principles to help guide things, aiming to be strong enough to be meaningful yet flexible enough not to get in the way of useful work. Perhaps the over-arching themes are trust and intellectual ownership, and some major principles following from that would be: create reproducible processes; don't duplicate existing functionality; don't add wanton complexity; and if you can't yet make something better, at least don't make it worse.

We start out in the situation of having GCC, a stupendously bloated pile of unloved (or perhaps over-loved, yet still usually working) code, right at the heart of the system. Freezing it at the somewhat aging version 4.7 puts a stop to the spread of Thompsonian circularity, limiting the necessary starting point to a C environment from which at least the C++ components can then be built up from source. This trick will not help for GNAT, as it consists of multiple interdependent components which appear to have always been mostly in Ada: the compiler frontend, runtime system, and build tools (gnatbind, gnatlink etc.). Of those, the build tools might be feasible to replace with simplified versions for bootstrapping purposes, but I don't presently see any way around the rest of it that doesn't amount to reimplementing a full-blown Ada compiler and no doubt with GNAT extensions too.

Nonetheless, the GCC 4.7 tree (and thus the Gales distributed sources collection) already includes a version of GNAT, and in the life cycle of the Ada language it's not really that old, e.g. it appears to be largely Ada 2012 compliant except that it needs a flag to enable the mode as it defaults to Ada '05. The best hope seems to be either to make this work for our needs or else to retrofit a newer GNAT release into the older GCC tree. Taking a newer GNAT as-is, while possible, would mean irresolvably duplicating the entire GCC tree, and as the saying goes, "now you have two problems". Or else putting in the work to fully reverse the proliferation of C++ in that newer GCC: also likely to be a major undertaking.

So between this and related interest in GNAT from the standpoint of Eulora2 client distribution, a first step was to get to know the beast a bit better. First there was getting oriented to the available documentation and the basic layout of the codebase,(i) various reading around manuals,(ii) and refreshing on ave1's prior work(iii) ; then it was time to get hands-on and try some compiler builds. First with nothing fancy, on a CentOS machine where I already had it working in two versions: the gcc-gnat 4.4.7 RPMs from the distribution, and the binary toolchain from Eulora2 (essentially the same as Adacore's gnat-gpl-2016-x86_64-linux-bin.tar.gz). Throughout, I used the system-wide (RPM) version for bootstrapping, without any apparent trouble from that.

Once familiarized and practiced in how it's supposed to work, I proceeded to pushing it in various directions. My notes follow; the upshot is that it's not going to budge an inch, at least without some more serious forcing; there are no stable interfaces within GCC and ~everything depends on everything else.

Plain build of Adacore's GNAT GPL 2016

In the usual faceless corporate style, by now they've purged any connection to this history from their web "presence"; more surprisingly, even from my archives, documentation from the time on how to build or even gather the sources was scarce. The README.BUILD file from gnat-gpl-2016-src.tar.gz (src subdirectory) was about it, and it neglected to mention what GCC version(s) it might need to be housed in(iv) or the extra requirement of gcc-interface-4.9-gpl-2016-src.tar.gz. I ended up checking ave1's musl-based build script to be sure, just of how to put the dubiously separated sources back together.

The README.BUILD recipe appears to be an old-fashioned method at least per GCC's build docs: configure counterintuitively with --disable-libada, then "make bootstrap", then "make -C gcc gnatlib gnattools".

  • Can probably be simplified by removing the --disable and just doing make.
  • Had to yum install gmp-devel and mpfr-devel. There was no mpc-devel, so I extracted it as 'mpc' in the gcc tree.
  • Had to add --disable-multilib to the configure (or else perhaps "yum install glibc-devel.i686").

I just ran "make"; forgot the "make bootstrap", but didn't find any documentation of what specifically that would do.

Oddity: it appears to be spending time building c++ stuff even though I only configured with --enable-languages=c,ada. (Confirmed.) I guess it's because of the 3-stage bootstrap, with the newer gcc requiring c++ to build itself.(v)

First "make -j2" completed in:

real    117m32.177s
user    206m39.281s
sys     13m7.987s

Then "make -C gcc gnatlib gnattools":

real    5m49.868s
user    5m0.078s
sys     0m34.962s

Probing the GCC/GNAT boundary

Next: trying a straight transplant of gnat-gpl-2016 onto gcc 4.7.4. Expecting failure. An intermediate step could be using the stock FSF gcc 4.9 instead of adacore's "gcc-4.9-gpl-2016-src" special sauce.

Sure enough:

make[3]: Entering directory `/home/user/src/gcc-4.7.4/build/gcc'
build/gengtype  \
					-S ../../gcc -I gtyp-input.list -w tmp-gtype.state
../../gcc/ada/gcc-interface/decl.c:139: unidentified type `vec'
../../gcc/ada/gcc-interface/decl.c:139: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:115: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:115: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:117: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:117: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:166: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:166: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:172: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:172: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:176: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:176: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:180: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:180: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:202: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:202: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:212: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:212: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:215: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:215: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:216: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:216: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/trans.c:217: unidentified type `vec'
../../gcc/ada/gcc-interface/trans.c:217: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/utils.c:214: unidentified type `vec'
../../gcc/ada/gcc-interface/utils.c:214: parse error: expected '(', 'GTY', or an identifier, have '<'
../../gcc/ada/gcc-interface/utils.c:217: unidentified type `vec'
../../gcc/ada/gcc-interface/utils.c:217: parse error: expected '(', 'GTY', or an identifier, have '<'
make[3]: *** [s-gtype] Error 1

Looks like they started sprinkling C++ into this supposedly C source.

Now trying gnat-gpl-2016 in the FSF gcc-4.9.2 tree.

$ ../configure --enable-languages=c,ada --disable-lto --disable-multilib
$ make

...
make[3]: Entering directory `/home/user/src/gcc-4.9.2/build/gcc'
g++ -c  -DIN_GCC_FRONTEND -g -DIN_GCC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wno-format  -Wmissing-format-attribute -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -Iada -I../../gcc -I../../gcc/ada -I../../gcc/../include -I../../gcc/../libcpp/include -I/home/user/src/gcc-4.9.2/mpc/src  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc/../libbacktrace    -o ada/decl.o -MT ada/decl.o -MMD -MP -MF ada/.deps/decl.TPo ../../gcc/ada/gcc-interface/decl.c
../../gcc/ada/gcc-interface/decl.c: In function 'tree_node* gnat_to_gnu_entity(Entity_Id, tree_node*, bool)':
../../gcc/ada/gcc-interface/decl.c:1868: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:1868: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:1896: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:1920: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:1920: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2226: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2296: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2296: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2556: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2556: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2611: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2620: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2620: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2720: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2720: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:2993: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:3405: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:3405: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:3408: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:3689: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:3689: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c: In function 'tree_node* elaborate_expression_1(tree_node*, Entity_Id, const char*, bool, bool)':
../../gcc/ada/gcc-interface/decl.c:6522: error: 'optimize_cfg' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c: In function 'tree_node* gnat_to_gnu_field(Entity_Id, tree_node*, int, bool, bool)':
../../gcc/ada/gcc-interface/decl.c:7041: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c: In function 'bool components_to_record(tree_node*, Node_Id, tree_node*, int, bool, bool, bool, bool, bool, bool, bool, bool, tree_node*, tree_node**)':
../../gcc/ada/gcc-interface/decl.c:7255: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:7255: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:7369: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:7422: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:7516: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:7744: error: 'TYPE_REVERSE_STORAGE_ORDER' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c: In function 'void associate_original_type_to_packed_array(tree_node*, Entity_Id)':
../../gcc/ada/gcc-interface/decl.c:9024: error: 'gnat_encodings' was not declared in this scope
../../gcc/ada/gcc-interface/decl.c:9024: error: 'DWARF_GNAT_ENCODINGS_MINIMAL' was not declared in this scope
make[3]: *** [ada/decl.o] Error 1

Could look into where that 'gnat_encodings' is supposed to be declared; sounds like somewhere in the larger GCC body. Which sounds pretty weird too, like they haven't actually separated GNAT from the rest in any meaningful way.

Next, we can try moving the gnat from gcc-4.9.2 (gcc/ada/) into gcc-4.7.4. [Eh, obviously not going to work because the 4.9.2 interface already includes the c++ vec<> stuff.] Then try mixing gcc-interface versions.

Plain build in the 4.7.4 tree (FSF release)

$ ../configure --enable-languages=c,ada --disable-lto --disable-multilib
$ time make -j2

It also insistently built g++ and libstdc++.

As timing luck would have it, I noticed this oddity before it proceeded to building gnattools, RTS, other target libs etc.:

make[2]: Entering directory `/home/user/src/gcc-4.7.4/build'
make[3]: Entering directory `/home/user/src/gcc-4.7.4/build'
rm -f stage_current
make[3]: Leaving directory `/home/user/src/gcc-4.7.4/build'
Comparing stages 2 and 3
warning: gcc/cc1plus-checksum.o differs
warning: gcc/cc1-checksum.o differs
Comparison successful.
if false; then \
		  rm -rf stage2-*; \
		  echo timestamp >  stage2-lean; \
		fi
make[2]: Leaving directory `/home/user/src/gcc-4.7.4/build'
make[1]: Leaving directory `/home/user/src/gcc-4.7.4/build'
make[1]: Entering directory `/home/user/src/gcc-4.7.4/build'
make[1]: Leaving directory `/home/user/src/gcc-4.7.4/build'
make[1]: Entering directory `/home/user/src/gcc-4.7.4/build'
...

Umm, how can comparison be successful if something differs (and a checksum no less) ?

Success in the end;

real    121m2.602s
user    216m14.657s
sys     13m26.510s

Can it build the Eulora2 client and/or VaMP?

$ make install DESTDIR=$PWD/root
$ mv root/usr/local ~/eulora2/gcc47
$ export PATH=$HOME/eulora2/gcc47/bin:$PATH

We'll need gprbuild too. For starters can it build that?

[gprbuild-gpl-2017-src(vi)]$ DESTDIR=$PWD/root ./bootstrap.sh
gcc -c -I./ -I/home/user/src/gprbuild-gpl-2017-src/src -I/home/user/src/gprbuild-gpl-2017-src/gpr/src -I../xmlada/sax -I../xmlada/dom -I../xmlada/schema -I../xmlada/unicode -I../xmlada/input_sources -I- /home/user/src/gprbuild-gpl-2017-src/src/gprbuild-main.adb
gpr_build_util.ads:192:11: expression function is an Ada 2012 feature
gpr_build_util.ads:192:11: unit must be compiled with -gnat2012 switch

Hmm, can the CentOS GNAT even build it? Restored $PATH, then:

$ DESTDIR=$PWD/root ./bootstrap.sh
gnatmake: numeric value out of range for switch: j

The older gnatmake doesn't recognize -j0. Pretty sad state of affairs - that a core build tool would require all the latest stuff - but so far it's easily bypassed so why not try:

$ DESTDIR=$PWD/root GNATMAKEFLAGS=-j1 ./bootstrap.sh
gcc -c -I./ -I/home/user/src/gprbuild-gpl-2017-src/src -I/home/user/src/gprbuild-gpl-2017-src/gpr/src -I../xmlada/sax -I../xmlada/dom -I../xmlada/schema -I../xmlada/unicode -I../xmlada/input_sources -I- /home/user/src/gprbuild-gpl-2017-src/src/gprbuild-main.adb
gprbuild-main.adb:27:06: "System.Multiprocessors" is not a predefined library unit
gpr_build_util.ads:191:04: proper body not allowed in package spec
gpr_build_util.ads:192:11: declaration expected
gpr_build_util.ads:466:01: missing "begin" for function "Is_Static" at line 191
gpr_build_util.ads:466:01: "end Is_Static;" expected

That's why not. OK, back to our 4.7.4-modern GNAT and setting the language level:

$ DESTDIR=$PWD/root GNATMAKEFLAGS=-gnat2012 ./bootstrap.sh
gcc -c -I./ -I/home/user/src/gprbuild-gpl-2017-src/src -I/home/user/src/gprbuild-gpl-2017-src/gpr/src -I../xmlada/sax -I../xmlada/dom -I../xmlada/schema -I../xmlada/unicode -I../xmlada/input_sources -gnat2012 -I- /home/user/src/gprbuild-gpl-2017-src/src/gprbuild-main.adb
gprbuild-main.adb:1872:10: "Try_Help" is undefined

I was expecting failure due to xmlada which I haven't grabbed yet, but what's this?? There's no definition of try_help to be found in the tree.

It's because gprbuild... depends on GNAT extensions!!(vii) and the 2017 version from ave1's work requires one born in 2014.

Alright, so maybe we can rig a bootstrap script for an older gprbuild. But for now, how about just using the one from the 2016 binary toolchain and seeing how Eulora goes. Simply edit the update_eulora2.sh to add the new $HOME/eulora2/gcc47/bin at the beginning of $PATH, so gcc, gnatmake etc will refer to the newly built versions but gprbuild will fall back.

Or for a narrower approach, set the PATH in euloraclient/build.sh and just rerun that. Except I got everything "up to date" so it didn't test much.

Building EuCore...
gcc -c -fPIC -O2 -fdump-scos -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatw.d -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc c_buffer.ads
gnat1: error: unrecognized command line option '-fdump-scos'

OK, the -fdump-scos flag comes from eucore/eucore.gpr and repeated in 3 other gpr files. Gnat_ugn says: "Generates SCO (Source Coverage Obligation) information in the ALI file. This information is used by advanced coverage tools. See unit SCOs in the compiler sources for details in files scos.ads and scos.adb." Can just remove the option for now. Next:

$ ./build.sh
Building EuCore...
gcc -c -fPIC -O2 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatw.d -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc c_buffer.ads
gnat1: invalid switch: -gnatw.d

Similar. Next:

$ ./build.sh
Building EuCore...
gcc -c -fPIC -O2 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc c_buffer.ads
/home/user/eulora2/euloraclient/eucore/restrict.adc:9:21: invalid restriction identifier "No_Access_Parameter_Allocators"
/home/user/eulora2/euloraclient/eucore/restrict.adc:13:21: invalid restriction identifier "No_Coextensions"
/home/user/eulora2/euloraclient/eucore/restrict.adc:34:21: invalid restriction identifier "No_Implicit_Task_Allocations"
/home/user/eulora2/euloraclient/eucore/restrict.adc:51:21: invalid restriction identifier "No_Task_At_Interrupt_Priority"
/home/user/eulora2/euloraclient/eucore/restrict.adc:61:21: invalid restriction identifier "Pure_Barriers"

Commenting out the noted restrictions. Next:

$ ./build.sh
Building EuCore...
gcc -c -fPIC -O2 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc c_buffer.ads
gcc -c -fPIC -O2 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc raw_types.adb
raw_types.adb:48:23: iterator is an Ada 2012 feature

Getting somewhere. Adding -gnat2012 to where I removed the others in the .gpr file(s). Looks like it'll need duplicating in the "debug" mode.

$ ./build.sh
Building EuCore...
gcc -c -fPIC -O2 -gnat2012 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc raw_types.adb
gcc -c -fPIC -O2 -gnat2012 -gnata -fstack-check -gnatyd -gnatwu -fdata-sections -ffunction-sections -gnatwr -gnatec=/home/user/eulora2/euloraclient/eucore/restrict.adc euinterface.adb
euinterface.ads:37:14: aspect identifier expected
euinterface.ads:40:14: aspect identifier expected
euinterface.ads:43:14: aspect identifier expected

And so on.

Fixed those by switching to pragma-style exports, per Diana Coman. Next:

euinterface.adb:290:63: prefix of "Image" attribute must be a type

We can revisit this path later but by now it clearly isn't going to "just work" with the older compiler.

Probing the GNAT/gcc-interface boundary

Tracking back to GCC. Can we run a newer GNAT on 4.7.4 by keeping the 'native' gcc-interface from 4.7.4 ?

$ ../configure --enable-languages=c,ada --disable-lto --disable-multilib
$ time make -j2

...
make[3]: Entering directory `/home/user/src/gcc-4.7.4/build/gcc'
gcc -c   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes  -Wmissing-format-attribute -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I.. -I. -Iada -I../../gcc -I../../gcc/ada -I../../gcc/../include -I../../gcc/../libcpp/include -I/home/user/src/gcc-4.7.4/mpc/src  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber    ../../gcc/ada/gcc-interface/decl.c -o ada/decl.o
../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_entity':
../../gcc/ada/gcc-interface/decl.c:1476:2: warning: implicit declaration of function 'Is_VMS_Exception' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:1587:26: warning: comparison between pointer and integer [enabled by default]
../../gcc/ada/gcc-interface/decl.c:1595:32: error: 'Setjmp_Longjmp' undeclared (first use in this function)
../../gcc/ada/gcc-interface/decl.c:1595:32: note: each undeclared identifier is reported only once for each function it appears in
../../gcc/ada/gcc-interface/decl.c:1700:2: warning: implicit declaration of function 'Is_Packed_Array_Type' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:1945:7: warning: implicit declaration of function 'Vax_Float' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:2030:10: error: 'E_String_Type' undeclared (first use in this function)
../../gcc/ada/gcc-interface/decl.c:2272:2: warning: implicit declaration of function 'Packed_Array_Type' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:2338:10: error: 'E_String_Subtype' undeclared (first use in this function)
../../gcc/ada/gcc-interface/decl.c:3681:7: warning: implicit declaration of function 'From_With_Type' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:4099:27: warning: comparison between pointer and integer [enabled by default]
../../gcc/ada/gcc-interface/decl.c:4270:15: error: 'By_Copy_Return' undeclared (first use in this function)
../../gcc/ada/gcc-interface/decl.c: In function 'gnat_to_gnu_param':
../../gcc/ada/gcc-interface/decl.c:5605:15: error: 'By_Copy_Return' undeclared (first use in this function)
../../gcc/ada/gcc-interface/decl.c:5645:7: warning: implicit declaration of function 'Is_Descendent_Of_Address' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c: In function 'create_concat_name':
../../gcc/ada/gcc-interface/decl.c:9326:7: error: unknown type name 'Fat_Pointer'
../../gcc/ada/gcc-interface/decl.c:9326:7: warning: initialization makes integer from pointer without a cast [enabled by default]
../../gcc/ada/gcc-interface/decl.c:9326:7: warning: (near initialization for 'fp') [enabled by default]
../../gcc/ada/gcc-interface/decl.c:9326:7: warning: excess elements in scalar initializer [enabled by default]
../../gcc/ada/gcc-interface/decl.c:9326:7: warning: (near initialization for 'fp') [enabled by default]
../../gcc/ada/gcc-interface/decl.c:9327:7: warning: implicit declaration of function 'Get_External_Name_With_Suffix' [-Wimplicit-function-declaration]
../../gcc/ada/gcc-interface/decl.c:9330:5: error: too few arguments to function 'exp_dbug__get_external_name'
In file included from ../../gcc/ada/gcc-interface/decl.c:47:0:
../../gcc/ada/fe.h:149:13: note: declared here
make[3]: *** [ada/decl.o] Error 1

I'd expected gnat (top-level ada/ stuff) to fail due to changes in gcc-interface; but this is even worse: gcc-interface depends on stuff in gnat. What's an interface to what now?!

There's no notion of layering. For instance, here we see that ada/gcc-interface/decl.c includes ada/fe.h. (And I can't even find where E_String_Type is supposed to come from.)

Thus, with all ideas exhausted for an easier path based on newer code, I now have cause to focus on making things work with the FSF 4.7.4 compiler, rougher as it may be around the edges.

  1. Most of GCC's code is in a "gcc" subdir, beside which are various odds and ends littering the top level. Within gcc are language-specific subdirs, of which "ada" is what's considered GNAT proper. This contains the Ada code for almost everything, in a huge list of files with godawful names "krunched" to eight characters, supposedly for MS-DOS compatibility but there are some longer names too so it's rather dubious. Then within ada there's a "gcc-interface" subdir containing ostensibly C code - a 38k-lines-"thin" interface to the larger compiler's C implementation. Or something like that, by now it's quite unclear to me how they make any separation of functionality at all. [^]
  2. Mostly "gnat_ugn", the GNAT User's Guide [for Native systems]. [^]
  3. http://ave1.org/2018/building-gnat-on-musl/ etc., blog meanwhile abandoned. [^]
  4. As far as I know so far, only their own custom gcc-4.9-gpl-2016-src.tar.gz will work. [^]
  5. Nope; I later found the gcc-4.7.4 version did the same. [^]
  6. Per ave1, older gprbuild versions themselves required gprbuild to build, herp. The 2017 one introduced a bootstrap script. [^]
  7. How did it go, "The great thing about standards is that there are so many to choose from!" [^]

1 Comment »

  1. In one glimmer of light to document amid the otherwise dense forest, I discovered that at least the 2012 vintage gprbuild configures and compiles successfully on the FSF 4.7.4 GNAT, without circular requirement of a prior gprbuild.

    It requires "make BUILD=production" to dodge a style warning being treated as fatal error.

    Comment by Jacob Welsh — 2024-08-28 @ 00:54

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by MP-WP. Copyright Jacob Welsh.