Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error when running gcc from GPS

317 views
Skip to first unread message

resander

unread,
Apr 24, 2010, 7:03:12 AM4/24/10
to
Using GPS GPL Edition.
GPS 4.2.1 (20080115) hosted on i686-pc-linux-gnu
GNAT 4.3.2

I have only just started using GPS.

I created a directory Adaproj in the home directory
and requested the default project to be put there.
It now contains the files main.adb, test.c
and default.gpr.

The file main.adb compiles, links and runs
without problems. It is a small self-contained test
program. The second file test.c does not
compile and the following error message appears:

'Could not locate executable on path: gprbuild'

I have ticked the checkbox for language C in the
Languages tab in 'Edit Project Properties on the
Project menu.

I am guessing that 'executable' refers to gcc.
I did a search on gcc and found these:

/usr/bin/gcc -- linked to
/usr/bin/gcc-4.3

/usr/bin/gnatgcc -- linked to
/usr/bin/gcc-4.3

/home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin/gcc

I also searched on gprbuild and found it is available in

/home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin


How do I make GPS compile C files?

P.S.
default.gpr in Adaproj contains:
project Default is

type Mode_Type is
("Production", "Debug");
Mode : Mode_Type := external ("BUILD", "Debug");

package Ide is
for Vcs_Kind use "CVS";
end Ide;

package Compiler is

case Mode is

when "Debug" =>
for Default_Switches ("ada") use ("-g", "-gnato", "-fstack-
check", "-gnatVa");

when "Production" =>
for Default_Switches ("ada") use ("-gnatp", "-O2");
end case;
end Compiler;

case Mode is

when "Debug" =>
for Languages use ("Ada", "C");

when "Production" =>

end case;

end Default;


Simon Wright

unread,
Apr 24, 2010, 7:15:17 AM4/24/10
to
resander <kres...@gmail.com> writes:

> 'Could not locate executable on path: gprbuild'
>
> I have ticked the checkbox for language C in the
> Languages tab in 'Edit Project Properties on the
> Project menu.
>
> I am guessing that 'executable' refers to gcc.

No, it refers to gprbuild!

> I did a search on gcc and found these:
>
> /usr/bin/gcc -- linked to
> /usr/bin/gcc-4.3
>
> /usr/bin/gnatgcc -- linked to
> /usr/bin/gcc-4.3
>
> /home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin/gcc
>
> I also searched on gprbuild and found it is available in
>
> /home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin
>
> How do I make GPS compile C files?

Make a link to it,

$ sudo ln -s \
/home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin/gprbuild \
/usr/bin

(there may well be a more appropriate way, inclusing perhaps using GNAT
GPL 2009?)

resander

unread,
Apr 24, 2010, 12:53:42 PM4/24/10
to
On Apr 24, 12:15 pm, Simon Wright <si...@pushface.org> wrote:


Many thanks Simon.

Setting the link to gprbuild as you suggested made the C compile
proceed a bit further, but it then stumbled on gprconfig. I made a
link to that too in a similar way. This did not solve the problem, it
immediately stopped with a message about
/usr/share/gprconfig (don't remember the exact words).

I then installed GNAT GPL 2009 and now both Ada and C compilations
fail.
I specified the install base directory as /usr/gnat as suggested in
the install Readme file.

Have the logs this time:

gprbuild -ws -c -u -P/home/ken/Adaproj/default.gpr -XBUILD=Debug
main.adb
creating auto.cgpr
Directory not found: /usr/share/gprconfig
No valid configuration found
Generation of configuration files failed
gprbuild: could not create /home/ken/Adaproj/auto.cgpr

[2010-04-24 17:22:40] process exited with status 4 (elapsed time:
00.11s)


gprbuild -ws -c -u -P/home/ken/Adaproj/default.gpr -XBUILD=Debug
guidb.c
creating auto.cgpr
Directory not found: /usr/share/gprconfig
No valid configuration found
Generation of configuration files failed
gprbuild: could not create /home/ken/Adaproj/auto.cgpr

[2010-04-24 17:20:14] process exited with status 4 (elapsed time:
00.11s)


I don't know how to interpret and fix this.

Ludovic Brenta

unread,
Apr 24, 2010, 1:46:57 PM4/24/10
to
resander <kres...@gmail.com> writes:
> On Apr 24, 12:15 pm, Simon Wright <si...@pushface.org> wrote:
>> resander <kresan...@gmail.com> writes:
>> > 'Could not locate executable on path: gprbuild'
>>
>> > I have ticked the checkbox for language C in the
>> > Languages tab in 'Edit Project Properties on the
>> > Project menu.
>>
>> > I am guessing that 'executable' refers to gcc.
>>
>> No, it refers to gprbuild!
>>
>> > I did a search on gcc and found these:
>>
>> >   /usr/bin/gcc    -- linked to
>> >   /usr/bin/gcc-4.3
>>
>> >   /usr/bin/gnatgcc    -- linked to
>> >   /usr/bin/gcc-4.3

(Caution: shameless plug ahead)

These seem to be the executables installed by the Debian packages. Are
you using Debian or a derivative thereof?

Your problems seem to be a bad installation of GNAT GPL; I suggest you
either re-install GNAT GPL properly, i.e. following the installation
instructions _to the letter_, or upgrade to Debian GNU/Linux "testing"
(soon to be released as 6.0 "Squeeze"). Thanks to Stephen Leake, Debian
now includes gprbuild and installs it properly. All your problems would
go away if you installed the following packages:

gnat
gnat-gps
gprbuild

You can do this with "aptitude install gnat gnat-gps gprbuild".

(The entire purpose of a binary distribution like Debian is to ease the
burden of installing and configuring software, so you don't have to
troubleshoot such problems and can concentrate on your programming
instead).

--
Ludovic Brenta.

resander

unread,
Apr 25, 2010, 6:41:05 AM4/25/10
to
On Apr 24, 6:46 pm, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:

I am on Ubuntu 8.10 and have not used any other Linux.

I agree this is an installation problem, but I still don't know how to
fix it.

I downloaded GNAT GPL 2009 from Libre. I unpacked using the GUI
decompress program available from the Ubuntu menu and it ended up in
directory /home/ken/Desktop/gnat-2009-i686-gnu-linux-libc2.3-bin. I
used the doinstall script in this directory and gave the install base
direcory as /usr/gnat as suggested. Installation ran to completion
without errors and I added /usr/gnat/bin to the $PATH as the doinstall
script prompted me to do.

Result: I could enter the new GPS program, but it failed compiling Ada
and C with errors shown in my previous post.

I guess this has something to do with grpbuild. There is a gprbuild in
the old GNAT GPL 2008 install directory, but there are no gpr-related
files in the new install directory at /usr/gnat.

GNAT GPL 2008 is available via the Ubuntu Synaptic Package Manager (a
GUI front end for the commandline package manager) I used Synaptic. No
luck, still the same. I tried the commandline too by sudo aptitude
install gnat gnat-gps gprbuild and got message 'Couldn't find any
package whose name or description matched "gprbuild', so gprbuild is
not available via the repository used by ubuntu.

How do I install GNAT GPL 2009 on Ubuntu?

Stephen Leake

unread,
Apr 25, 2010, 8:42:02 AM4/25/10
to
Simon Wright <si...@pushface.org> writes:

As resander discovered, this is not the right solution. There are other
executables and files that gprbuild needs, and it uses the path to the
invoked executable to find them.

You need to put
/home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin in your PATH,
so gprbuild is invoked with the right path, and can find these other files.

The best way to do all of this is to use the Debian testing
distribution, as Ludovic says.

--
-- Stephe

resander

unread,
Apr 25, 2010, 11:07:50 AM4/25/10
to
On Apr 25, 1:42 pm, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
> Simon Wright <si...@pushface.org> writes:

Thanks Stephen,

I added to the PATH as you suggested, but it is still not working.

How do I get the Debian testing distribution onto my Ubuntu 8.04?

Simon Wright

unread,
Apr 25, 2010, 11:22:45 AM4/25/10
to
Stephen Leake <stephe...@stephe-leake.org> writes:

> You need to put
> /home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin/bin in your
> PATH, so gprbuild is invoked with the right path, and can find these
> other files.

This doesn't sound like the way it _should_ be installed. Something must
have gone wrong with OP's installation.

I have an 8.04 Ubuntu running in a VMWare Fusion VM, and it has GNAT GPL
2008 installed at /opt/gnat-gpl-2008 (I find it handy to keep several
compilers available), and the contents of the bin/ directory are

addr2line cbrowser cpp dbimp gcc gccbug gcov gdb gnat gnatbind
gnatcheck gnatchop gnatclean gnatelim gnatfind gnathtml.pl gnatkr
gnatlink gnatls gnatmake gnatmem gnatmetric gnatname gnatpp gnatprep
gnatstub gnatxref gprbuild gprbuild_debug gprclean gprclean_debug
gprconfig gprconfig_debug gprmake gprof gps gps_exe
i686-pc-linux-gnu-gcc i686-pc-linux-gnu-gcc-4.1.3 objdump

I'm a bit suspicious about the OP's file locations in
general. /home/ken/AdaGPL/gnat-2008-i686-gnu-linux-libc2.3-bin is the
place where the binary distribution would unpack to; whenever I've done
installs (which I do as root) it asks me where I want it to install
(default /usr/local, I think, but as I said above I don't use that) and
copies all the files it needs to to that location. You can delete the
distribution directory completely after the install.

Ludovic Brenta

unread,
Apr 25, 2010, 1:12:33 PM4/25/10
to
resander <kres...@gmail.com> writes:
> I am on Ubuntu 8.10 and have not used any other Linux.
>
> I agree this is an installation problem, but I still don't know how to
> fix it.
>
> I downloaded GNAT GPL 2009 from Libre. I unpacked using the GUI
> decompress program available from the Ubuntu menu and it ended up in
> directory /home/ken/Desktop/gnat-2009-i686-gnu-linux-libc2.3-bin. I
> used the doinstall script in this directory and gave the install base
> direcory as /usr/gnat as suggested. Installation ran to completion
> without errors and I added /usr/gnat/bin to the $PATH as the doinstall
> script prompted me to do.
>
> Result: I could enter the new GPS program, but it failed compiling Ada
> and C with errors shown in my previous post.
>
> I guess this has something to do with grpbuild. There is a gprbuild in
> the old GNAT GPL 2008 install directory, but there are no gpr-related
> files in the new install directory at /usr/gnat.

It seems you did not download all of GNAT GPL 2009, then. You should
have gprbuild as part of it.

> GNAT GPL 2008 is available via the Ubuntu Synaptic Package Manager

No, it is not.

What you see in Synaptic are the Debian packages that I made; they are
not GNAT GPL but rather GNAT from the FSF.

> (a GUI front end for the commandline package manager) I used
> Synaptic. No luck, still the same. I tried the commandline too by sudo
> aptitude install gnat gnat-gps gprbuild and got message 'Couldn't find
> any package whose name or description matched "gprbuild', so gprbuild
> is not available via the repository used by ubuntu.

gprbuild is indeed not present in Ubuntu 8.10; it appeared in Debian
unstable in January 2010 and migrated to Debian testing on 2010-04-14.
I do not know what the Ubuntu maintainers plan but chances are that
gprbuild will be present in the next release of Ubuntu (presumably 10.04
or 10.10).

So what you end up with is a partial install of GNAT GPL 2009 in
/usr/gnat, lacking gprbuild, and an installation of a few Debian
packages in /usr/bin; you should double-check your $PATH to make sure
which version of the IDE (GPS) and compiler (gcc) you use.

> How do I install GNAT GPL 2009 on Ubuntu?

I think you only need to add gprbuild to your machine, now. It is
available from libre.adacore.com and from Debian testing, but not from
Ubuntu 8.10.

--
Ludovic Brenta.

Ludovic Brenta

unread,
Apr 25, 2010, 1:13:43 PM4/25/10
to
resander <kres...@gmail.com> writes:
> How do I get the Debian testing distribution onto my Ubuntu 8.04?

Someone else asked the same question on this newsgroup a couple of
months ago; I saved my answer for future reference here:

http://lists.debian.org/debian-ada/2010/02/msg00003.html

HTH

--
Ludovic Brenta.

0 new messages