* Newbie Questions
@ 2008-04-01 13:32 Chris Yocum
2008-04-01 14:09 ` Georg Bauhaus
2008-04-01 15:04 ` Robert A Duff
0 siblings, 2 replies; 6+ messages in thread
From: Chris Yocum @ 2008-04-01 13:32 UTC (permalink / raw)
Hi Everyone,
I have been playing with GNAT and Ada for a little bit (GNAT 4.2.1
(Ubuntu 4.2.1-5ubuntu6) on Ubuntu 7.10). I have successfully written a
doubly linked list with generics so I think I am starting to have a feel
for the language. However, my binaries have always seemed a bit large
compared to my C/C++ ones for similar data structures. I looked in the
Wikibook FAQ about it and it instructed me to look at the various
compiler options.
In the course of this, I discovered GNAT's project files. I looked at
few examples and wrote my own. My problem is that it always runs just
the GCC without calling gnatbind or gnatlink as it does if I just call
gnatlink. In any case, I figure that I could call gnatbind and gnatlink
manually from there. When I do that, gnatlink fails with this error (it
also happens when I use gnat gps IDE and its project files so this is
happening often):
~/adastuff/testhello$ gnat make -Phello.gpr
gcc-4.2 -c -O3 -gnatn -funroll-loops -fPIC -fprofile-arcs -gnat05 -I-
-gnatA ~/adastuff/testhello/hello.adb
~/adastuff/testhello$ gnatbind -x hello.ali
~/adastuff/testhello$ gnatlink hello.ali
b~hello.o: In function `global constructors keyed to 0_ada_main_E':
b~hello.adb:(.text+0x2f2): undefined reference to `__gcov_init'
b~hello.o:(.data.rel+0x48): undefined reference to `__gcov_merge_add'
./hello.o: In function `global constructors keyed to 0__ada_hello':
hello.adb:(.text+0x82): undefined reference to `__gcov_init'
./hello.o:(.data.rel+0x48): undefined reference to `__gcov_merge_add'
collect2: ld returned 1 exit status
gnatlink: cannot call /usr/bin/gcc-4.2
Might anyone have any ideas? Have I missed something in the call to
gnatlink? I can post code if that will help.
Thanks in Advance!,
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie Questions
2008-04-01 13:32 Newbie Questions Chris Yocum
@ 2008-04-01 14:09 ` Georg Bauhaus
2008-04-01 14:27 ` Chris Yocum
2008-04-01 15:04 ` Robert A Duff
1 sibling, 1 reply; 6+ messages in thread
From: Georg Bauhaus @ 2008-04-01 14:09 UTC (permalink / raw)
Chris Yocum schrieb:
> Hi Everyone,
> I have been playing with GNAT and Ada for a little bit (GNAT 4.2.1
> (Ubuntu 4.2.1-5ubuntu6) on Ubuntu 7.10). I have successfully written a
> doubly linked list with generics so I think I am starting to have a feel
> for the language. However, my binaries have always seemed a bit large
> compared to my C/C++ ones for similar data structures. I looked in the
> Wikibook FAQ about it and it instructed me to look at the various
> compiler options.
The most important instruction should likely be to consider
how many bytes are important, really. For very small Ada
programs, the size of the run-time system might matter.
> ~/adastuff/testhello$ gnat make -Phello.gpr
> gcc-4.2 -c -O3 -gnatn -funroll-loops
Loop unrolling is not necessarily reducing code size,
if this is your goal?
> -fPIC -fprofile-arcs
Have you had a look at Chapter 9 of GCC 4.1, gcov? This
chapter should also have some info about the __gcov_* messages.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie Questions
2008-04-01 14:09 ` Georg Bauhaus
@ 2008-04-01 14:27 ` Chris Yocum
0 siblings, 0 replies; 6+ messages in thread
From: Chris Yocum @ 2008-04-01 14:27 UTC (permalink / raw)
Georg Bauhaus wrote:
> Chris Yocum schrieb:
>> Hi Everyone,
>> I have been playing with GNAT and Ada for a little bit (GNAT 4.2.1
>> (Ubuntu 4.2.1-5ubuntu6) on Ubuntu 7.10). I have successfully written
>> a doubly linked list with generics so I think I am starting to have a
>> feel for the language. However, my binaries have always seemed a bit
>> large compared to my C/C++ ones for similar data structures. I looked
>> in the Wikibook FAQ about it and it instructed me to look at the
>> various compiler options.
>
> The most important instruction should likely be to consider
> how many bytes are important, really. For very small Ada
> programs, the size of the run-time system might matter.
I had considered this but the Wikibook says
(http://en.wikibooks.org/wiki/Ada_Programming/Basic#FAQ:_Why_is_.22Hello.2C_world.21.22_so_big.3F)
that this program should be on the order of 8K rather than the 21K that
I am getting out of just a plain gnatmake.
>
>
>> ~/adastuff/testhello$ gnat make -Phello.gpr
>> gcc-4.2 -c -O3 -gnatn -funroll-loops
>
> Loop unrolling is not necessarily reducing code size,
> if this is your goal?
>
>> -fPIC -fprofile-arcs
>
> Have you had a look at Chapter 9 of GCC 4.1, gcov? This
> chapter should also have some info about the __gcov_* messages.
Thanks for the info. I will look more closely at what you suggest. The
unroll-loops was something that I copied out of Wikibook gpr file so I
had not looked very closely at it. Thanks again.
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie Questions
2008-04-01 13:32 Newbie Questions Chris Yocum
2008-04-01 14:09 ` Georg Bauhaus
@ 2008-04-01 15:04 ` Robert A Duff
2008-04-01 15:08 ` Chris Yocum
2008-04-01 21:16 ` Simon Wright
1 sibling, 2 replies; 6+ messages in thread
From: Robert A Duff @ 2008-04-01 15:04 UTC (permalink / raw)
Chris Yocum <cyocum@gmail.com> writes:
> Might anyone have any ideas? Have I missed something in the call to
> gnatlink? I can post code if that will help.
You should never have to call gnatlink or gnatbind or gcc by hand,
unless you're doing something weird. Gnatmake will do it all.
You should put "for Main use..." in your project file,
and/or mention the name of the main file on the gnatmake
command line. These things are covered in the docs.
- Bob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie Questions
2008-04-01 15:04 ` Robert A Duff
@ 2008-04-01 15:08 ` Chris Yocum
2008-04-01 21:16 ` Simon Wright
1 sibling, 0 replies; 6+ messages in thread
From: Chris Yocum @ 2008-04-01 15:08 UTC (permalink / raw)
Robert A Duff wrote:
> Chris Yocum <cyocum@gmail.com> writes:
>
>> Might anyone have any ideas? Have I missed something in the call to
>> gnatlink? I can post code if that will help.
>
> You should never have to call gnatlink or gnatbind or gcc by hand,
> unless you're doing something weird. Gnatmake will do it all.
>
> You should put "for Main use..." in your project file,
> and/or mention the name of the main file on the gnatmake
> command line. These things are covered in the docs.
>
> - Bob
Thanks. I had another look at the docs after going for a walk and saw that.
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie Questions
2008-04-01 15:04 ` Robert A Duff
2008-04-01 15:08 ` Chris Yocum
@ 2008-04-01 21:16 ` Simon Wright
1 sibling, 0 replies; 6+ messages in thread
From: Simon Wright @ 2008-04-01 21:16 UTC (permalink / raw)
Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> Chris Yocum <cyocum@gmail.com> writes:
>
>> Might anyone have any ideas? Have I missed something in the call to
>> gnatlink? I can post code if that will help.
>
> You should never have to call gnatlink or gnatbind or gcc by hand,
> unless you're doing something weird. Gnatmake will do it all.
>
> You should put "for Main use..." in your project file,
> and/or mention the name of the main file on the gnatmake
> command line. These things are covered in the docs.
True, of course, but it can sometimes be useful to say
gnatmake -P hello hello
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-01 21:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01 13:32 Newbie Questions Chris Yocum
2008-04-01 14:09 ` Georg Bauhaus
2008-04-01 14:27 ` Chris Yocum
2008-04-01 15:04 ` Robert A Duff
2008-04-01 15:08 ` Chris Yocum
2008-04-01 21:16 ` Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox