From: Marcelo Coraça de Freitas on
On 2 ago, 05:24, Stephen Leake <stephen_le...(a)stephe-leake.org> wrote:
> Marcelo Coraça de Freitas <marcelo.bat...(a)gmail.com> writes:
>
> > Hello there!
>
> > Do you guys know with what compilers should gprbuild be compatible?
>
> The GNAT version it is released with
>
> > I mean, should I be able to build it and use against gnat-gcc-4.3.1
> > (well, I can't).
>
> What version of gprbuild, what OS, what problems?

OS : Sabayon Linux amd64, kernel v2.6.34
GNAT : 4.3.1 FSF

Error:
gnatlink /home/ogro/tmp/ada/gprbuild/gprbuild-1.4.1-src/obj-debug/
gprconfig-main.ali /home/ogro/tmp/ada/gprbuild/gprbuild-1.4.1-src/obj-
debug/gprbuild_dummies.o /home/ogro/tmp/ada/gprbuild/gprbuild-1.4.1-
src/obj-debug/link.o -L/usr/local/lib/xmlada/static -lxmlada_schema -L/
usr/local/lib/xmlada/static -lxmlada_dom -L/usr/local/lib/xmlada/
static -lxmlada_sax -L/usr/local/lib/xmlada/static -
lxmlada_input_sources -L/usr/local/lib/xmlada/static -lxmlada_unicode -
Wl,-rpath,/usr/lib64/gnat-gcc/x86_64-pc-linux-gnu/4.3/adalib/ -o /home/
ogro/tmp/ada/gprbuild/gprbuild-1.4.1-src/gprconfig
/home/ogro/tmp/ada/gprbuild/gprbuild-1.4.1-src/obj-debug/osint.o: In
function `osint__file_length':
/home/ogro/tmp/ada/gprbuild/gprbuild-1.4.1-src/gnat/osint.adb:1065:
undefined reference to `__gnat_file_length_attr'
(...)


Several osint_* symbols can't be found when I build it. :)

I will try the binary from AdaCore's libre site I get:



1. GCC-ASM for Asm in /usr/bin/ version 4.4.2
2. GCC-ASM for Asm in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/
version 4.4.2
3. GCC-ASM for Asm2 in /usr/bin/ version 4.4.2
4. GCC-ASM for Asm2 in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/
version 4.4.2
5. GCC-ASM for Asm_Cpp in /usr/bin/ version 4.4.2
6. GCC-ASM for Asm_Cpp in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/
version 4.4.2
7. GCC for C in /usr/bin/ version 4.4.2
8. GCC for C in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/ version
4.4.2
9. G++ for C++ in /usr/bin/ version 4.4.2
10. G++ for C++ in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/ version
4.4.2
11. GFORTRAN for Fortran in /usr/bin/ version 4.4.2
12. GFORTRAN for Fortran in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.2/
version 4.4.2


while gnatmake is in /usr/x86_64-pc-linux-gnu/gnat-gcc-bin/4.3/ and
it's a different compiler from the system's gcc.


maybe the GNAT version I am using is too old?


regards,
From: Simon Wright on
I've remembered how I did it now.

gprbuild needs the 'gcc' that it finds in the path to match the target
that it was built with, or you have to tell it the target.

The 'gcc' part means that systems where the GNAT compiler is called
'gnatgcc' will have trouble. Perhaps a symlink

$ ln -s /usr/bin/gnatgcc ~/bin/gcc

The 'target' part is more tricky. In my case, having fixed up the PATH I
said

$ gprbuild -v

and near the top I saw

using project file test_extensions.gpr
gprconfig --batch -o /Users/simon/gnat-math-extn/test/.build/auto.cgpr --target=x86_64-apple-darwin10.2.0 --config=ada,,
Error: no matching compiler found for --config=ada,,,,

(note the bit about --target=) but when I say

$ gcc -v

it says a lot of stuff, in the middle of which is

Target: x86_64-apple-darwin10

which meant I was able to get gprbuild to recognise this as the compiler
to use by

$ gprbuild --target=x86_64-apple-darwin10

Of course it's much easier to build gprbuild with the compiler you
intend to use [if you can ;-( ] or, if there is one,to find a way of
fixing this permanently in the gprbuild configuration system.

(in your case, it'd be --target=x86_64-pc-linux-gnu).
From: Marcelo Coraça de Freitas on
Thanks Simon, but gprconfig still can't find the Ada compiler.


I did what you recomended and it found the gcc:


3. GCC-ASM for Asm in /home/ogro/bin/ version 4.3.1
6. GCC-ASM for Asm2 in /home/ogro/bin/ version 4.3.1
9. GCC-ASM for Asm_Cpp in /home/ogro/bin/ version 4.3.1
12. GCC for C in /home/ogro/bin/ version 4.3.1


But only for C and Asm2 and Asm_Cpp. Not gnat.


Do you know why? What GCC version are you using? Maybe it looks for a
different string comming out of the gcc command.

From: Simon Wright on
Marcelo Coraça de Freitas <marcelo.batera(a)gmail.com> writes:

> Thanks Simon, but gprconfig still can't find the Ada compiler.
>
>
> I did what you recomended and it found the gcc:
>
>
> 3. GCC-ASM for Asm in /home/ogro/bin/ version 4.3.1
> 6. GCC-ASM for Asm2 in /home/ogro/bin/ version 4.3.1
> 9. GCC-ASM for Asm_Cpp in /home/ogro/bin/ version 4.3.1
> 12. GCC for C in /home/ogro/bin/ version 4.3.1
>
>
> But only for C and Asm2 and Asm_Cpp. Not gnat.
>
>
> Do you know why? What GCC version are you using? Maybe it looks for a
> different string comming out of the gcc command.

No, I don't. The only explanation I can think of is that the command
'gcc' isn't picking up the Ada-aware compiler that you mean it to.

I did this:

$ PATH=/opt/gcc-4.5.0-x86_64/bin:$PATH gprconfig --target=x86_64-apple-darwin10
--------------------------------------------------
gprconfig has found the following compilers on your PATH.
Only those matching the target and the selected compilers are displayed.
1. GNAT for Ada in /opt/gcc-4.5.0-x86_64/bin/ version 4.5 (default runtime)
2. GCC-ASM for Asm in /opt/gcc-4.5.0-x86_64/bin/ version 4.5.0
3. GCC-ASM for Asm2 in /opt/gcc-4.5.0-x86_64/bin/ version 4.5.0
4. GCC-ASM for Asm_Cpp in /opt/gcc-4.5.0-x86_64/bin/ version 4.5.0
5. GCC for C in /opt/gcc-4.5.0-x86_64/bin/ version 4.5.0
Select or unselect the following compiler (or "s" to save): s

You can regenerate the same config file in batch mode
with the following command line:
gprconfig --batch --target=x86_64-apple-darwin10

Creating configuration file: x86_64-apple-darwin10.cgpr

but now when I say

$ PATH=/opt/gcc-4.5.0-x86_64/bin:$PATH gprbuild --target=x86_64-apple-darwin10

instead of building (which it will if I delete
x86_64-apple-darwin10.cgpr) it says

using project file test_extensions.gpr
test_extensions.gpr:17:09: no languages defined for this project
ada_math_build.gpr:15:09: warning: no compiler specified for language "ada", ignoring all its sources
ada_math_build.gpr:17:25: warning: libraries are not supported on this platform
gprbuild: "test_extensions.gpr" processing failed

I'm baffled.

Hmm, I tried

$ gprconfig --config=Ada,,,/opt/gcc-4.5.0-x86_64/bin --target=x86_64-apple-darwin10

and then

$ gprbuild --target=x86_64-apple-darwin10

and it was happy!
From: Marcelo Coraça de Freitas on
Tried that also and I couldn't make it work. Maybe it is the compiler
version I am using.

I can't spend much time on this right now but I'll try looking at the
source code for how the program locates the compiler and what are the
real requirements.


Thanks for all the ideas Simon.