1

I have no idea why suddenly my gprbuild is getting stuck. Here's a pretty straightforward way to replicate what I'm seeing:

mkdir test
mkdir build
printf 'with Ada.Text_IO; use Ada.Text_IO;\nprocedure Main is begin Put_Line ("Hello, World!"); end Main;' > test/main.adb
printf 'project Test is\n    for Source_Dirs use ("test");\n    for Object_Dir use "build";\n    for Exec_Dir use ".";\n    for Main use ("main.adb");\n    package Builder is\n        for Executable ("main.adb") use "host";\n    end Builder;\nend Test;' > test.gpr
gprbuild -Ptest # This hangs forever

Contents of files after executing:

test/main.adb

with Ada.Text_IO; use Ada.Text_IO;
procedure Main is begin Put_Line ("Hello, World!"); end Main;

test.gpr

project Test is
    for Source_Dirs use ("test");
    for Object_Dir use "build";
    for Exec_Dir use ".";
    for Main use ("main.adb");
    package Builder is
        for Executable ("main.adb") use "host";
    end Builder;
end Test;

The result is no output whatsoever and the process has to be killed with ^C.

I ran it again with the -v flag and found that it hanged on gprconfig --batch -o /some/directory/src/build/GNAT-TEMP-000001.TMP --target=x86_64-linux --config=ada,,. The results of env are:

HADOOP_LOG_DIR=/tmp/hadoop/log
LANG=en_CA.utf8
DISPLAY=:0
COLORTERM=truecolor
LCLIMPORTDIR=/usr/share/splint/imports
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
HADOOP_SLAVES=/etc/hadoop/slaves
TERMINAL=xfce4-terminal
XDG_VTNR=1
XDG_SESSION_ID=c1
USER=user
GRADLE_HOME=/usr/share/java/gradle
PWD=/home/user
HOME=/home/user
HADOOP_CONF_DIR=/etc/hadoop
SPARK_HOME=/opt/apache-spark
arch=x86_64
MAIL=/var/spool/mail/user
VISUAL=gvim
WINDOWPATH=1
TERM=xterm-termite
SHELL=/bin/bash
VTE_VERSION=4803
HADOOP_PID_DIR=/tmp/hadoop/run
XDG_SEAT=seat0
SHLVL=3
WINDOWID=71303171
LOGNAME=user
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
XAUTHORITY=/home/user/.Xauthority
ANT_HOME=/usr/share/apache-ant
LARCH_PATH=/usr/share/splint/lib
PATH=/home/user/bin:/usr/lib/hardening-wrapper/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/user/.gem/ruby/2.4.0/bin
_=/usr/bin/env

I'm wondering if something is wrong with my GPR install? or perhaps my environment variables.

LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
  • 1
    Your source text is not very readable. Could you please format it for readability? – Jacob Sparre Andersen Sep 19 '17 at 17:48
  • 2
    There you go. I had it formatted is a bash command line so you could just run it to see what happens, but the source is helpful, though I can't see any problem with it. – LambdaBeta Sep 19 '17 at 18:36
  • 1
    Works for me (macOS, gcc 7.1.0). – Simon Wright Sep 19 '17 at 19:07
  • 1
    Works for me (Debian/Jessie). – Jacob Sparre Andersen Sep 20 '17 at 04:26
  • 1
    Does it hang? Or is it in a busy-loop? – Jacob Sparre Andersen Sep 20 '17 at 04:27
  • 2
    You could see what `gprbuild -v -Ptest` says – Simon Wright Sep 20 '17 at 11:48
  • With the `-v` flag it hangs on what appears to be step 1 (gprconfig step). The exact command that seems to hang `gprconfig --batch -o /some/directory/src/build/GNAT-TEMP-000001.TMP --target=x86_64-linux --config=ada,,`. Running that command also hangs on its own for me. – LambdaBeta Sep 21 '17 at 22:13
  • Please [edit] your question to show the new findings. While your example works for me, I also noticed the [activity](http://www.adacore.com/developers/development-log/category/gprbuild) in `TMPDIR`. Odd that that it would _hang_, but you might check your `env`. – trashgod Sep 23 '17 at 08:12
  • Done, though I don't see anything wrong with my env. I also updated my gprbuild package (with pacman [arch]) - to no avail. – LambdaBeta Sep 23 '17 at 22:24
  • maybe reduce the system PATH and retry. gprbuild tries a lot of commands to figure out which compilers are available on your system. Reducing the path (temporarily) to only /bin and the compiler bin could help. – Jean-François Fabre Oct 25 '17 at 13:11
  • Wow, after much delay that was indeed the problem. Reducing to the minimal path that would work caused it to run almost instantly. – LambdaBeta Oct 26 '17 at 15:11

1 Answers1

0

It turns out the problem was having too much in my PATH. gprbuild was looking through all the directories and trying some long running commands to see if they were the correct compilers.

Thanks to Jean-François Fabre for suggesting it.

LambdaBeta
  • 1,479
  • 1
  • 13
  • 25