-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gnat: init at 9 #62314
gnat: init at 9 #62314
Conversation
@GrahamcOfBorg build gnat |
The configure script fails in this part # Test for GNAT.
# We require the gnatbind & gnatmake programs, as well as a compiler driver
# that understands Ada. We use the user's CC setting, already found, and
# possibly add $1 to the command-line parameters.
#
# Sets the shell variable have_gnat to yes or no as appropriate, and
# substitutes GNATBIND and GNATMAKE.
AC_DEFUN([ACX_PROG_GNAT],
[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
AC_REQUIRE([AC_PROG_CC])
AC_CHECK_TOOL(GNATBIND, gnatbind, no)
AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
AC_CACHE_CHECK([whether compiler driver understands Ada],
acx_cv_cc_gcc_supports_ada,
[cat >conftest.adb <<EOF
procedure conftest is begin null; end conftest;
EOF
acx_cv_cc_gcc_supports_ada=no
# There is a bug in old released versions of GCC which causes the
# driver to exit successfully when the appropriate language module
# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
# Therefore we must check for the error message as well as an
# unsuccessful exit.
# Other compilers, like HP Tru64 UNIX cc, exit successfully when
# given a .adb file, but produce no object file. So we must check
# if an object file was really produced to guard against this.
errors=`(${CC} $1[]m4_ifval([$1], [ ])-c conftest.adb) 2>&1 || echo failure`
if test x"$errors" = x && test -f conftest.$ac_objext; then
acx_cv_cc_gcc_supports_ada=yes
fi
rm -f conftest.*])
if test "x$GNATBIND" != xno && test "x$GNATMAKE" != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
have_gnat=yes
else
have_gnat=no
fi
]) Apparently it desires that
|
|
Oh, the command above actually works if I add |
I just checked, it seems that originally, |
|
Yes, I managed to fish the output from the test command:
I expect the build probably wouldn't work just with |
I checked with |
That's not what I meant. I got
(the previously failing test for ADA working did succeed) The gnatboot from Gentoo seems not to support C++ (by looking at the files), but recent gcc versions are partially written in C++ and I suspect they can't automatically bootstrap without a C++ compiler. |
By placing |
Looks like an Ada error in the source, possibly because |
Have you looked what bootstrap sequence for gnat is used elsewhere? |
Applying the same approach to gnat6 leads even further – several minutes of compilation:
Commit 8bd9463. |
Looks like this still needs to be ported https://github.com/NixOS/nixpkgs/blob/b249f7f1a81765321d65c1f7861598ee4a5020a6/pkgs/development/compilers/gcc/gnat-cflags.patch |
I ported it and I'm currently investigating other errors. Will push later today. |
Just managed to build gnat6 using gcc6, but I will try to make it work using gcc7 for a bit. |
I assumed that if the gentoo gnatboot could be used to build some gnat version that's not too old, that one should hopefully be sufficiently new to build gnat9 and hopefully even some future versions. (I tried 6 first for greater ease of modifications ATM due to gcc6 not being in stdenv bootstrap.) |
I've repinned this PR and fixed |
@vcunat it would be nice if we can get this merged before the feature freeze in two days. Do you need me to do anything else? Please let me know. |
I'll test the build locally and merge (today), but I'm afraid we're probably a week or two too late for the 19.09 fork-off, as it will be done from the master branch. Still, I haven't kept a close look at the current plans, e.g. gcc8 default still isn't merged and "was planned" (originally). |
Hmm, it still does not build for me: dhx6br4f0m3kjnlvmc59ph7cpg54h3sv-ghdl-llvm-0.36.log – perhaps we'll disable that variant for now? |
Looks like this is an instance of the intermittent build failure. It worked for me with 4 and with 8 cores. It might work if you try a few more times with |
If one derivation is flaky when building in parallel, setting Can you do that and rebase on top of latest staging? As |
Btw, I'm not so sure about the state of that If we need to use binaries, what about something like that as bootstrap? { stdenv
, fetchurl
, autoPatchelfHook
, ncurses5 }:
stdenv.mkDerivation {
pname = "gnats-bootstrap";
version = "2014";
buildInputs = [
ncurses5
];
nativeBuildInputs = [
autoPatchelfHook
];
src = fetchurl {
name = "gnat-gpl-2014-x86_64-linux-bin.tar.gz";
url = "https://community.download.adacore.com/v1/6eb6eef6bb897e4c743a519bfebe0b1d6fc409c6?filename=gnat-gpl-2014-x86_64-linux-bin.tar.gz";
sha256 = "0cxpxbx3dnq6fsy4k3qil377znv8k13nn3xgfha9jmpm9p4shqw0";
};
buildPhase = ":";
installPhase = ''
mkdir -p $out
cp -R . $out
rm $out/bin/gps_exe
rm -R $out/lib/python2.7/ $out/share/gdb-7.7/python-2.7.3 $out/lib/gtk-3.0 $out/lib/gps/gdk-pixbuf-2.0 $out/lib/gps $out/lib/libpyglib-gi-2.0-python.so.0.0.0
'';
} There are also binaries for a lot of architectures, more than on the gentoo mirrors. |
I've rebased this and was able to build a coreboot toolchain with Ada support, which is required for building coreboot with native graphics initialization for some boards. |
@Lucus16 first of all, thanks for this PR. |
It's been a while since I've worked on this. I'll see if I can rebase on staging and build a few times to see if the intermittent build failure is still present. |
ba3801c
to
b0d9a7c
Compare
I rebased and squashed this. I built @sylv-io I'd appreciate it if you could take over and find someone to merge this. I don't have much energy left to spend on this. I'll be around for questions. |
great thx! it's understandable, that your tired of this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to build gnat6 and gnat9 on a machine with very high core count. I have previously looked at the changes while rebasing. I also tried to implement the suggestion by @flokli to use a different bootstrap compiler, but it was not successful and I would like to postpone this improvement to a later PR.
If there are no new concerns I will merge this next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-checked the diff, builds on x86_64 (once), building and running a trivial hello-world program. Even ghdl-llvm
built for me 🤷 On i686 all fails in gnat6
step already, but that doesn't seem interesting.
In any case I believe this should get merged in some form; to me it seems OK as-is.
I just did a bunch of small changes:
|
Motivation for this change
Gnat is the Ada compiler frontend in gcc. It used to be in nixpkgs based on gcc 4.5 but it broke when the cc wrappers were rewritten. I've been trying to get it to work with gcc 9 and the current cc wrapper scripts. I think I've ported all relevant parts, but for now, it seems the configure script is not convinced it has a gnat compiler available. I'm having a hard time figuring out why.
Currently, this PR needs a rebuild of the world because it needs some additions in
cc-wrapper/add-flags.sh
. An alternative option is to give gnat its own add-flags variant.I don't have the time to finish this right now, so help is appreciated.
TODO
add-flags.sh
change can be avoided so a world rebuild isn't necessary.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)