comp.lang.ada
 help / color / mirror / Atom feed
* gnat : descendents of package System may not be compiled error
@ 2011-05-23 15:34 milouz
  2011-05-23 15:45 ` Robert A Duff
  0 siblings, 1 reply; 3+ messages in thread
From: milouz @ 2011-05-23 15:34 UTC (permalink / raw)


Hi,
I'm pretty new with Ada programming and I have a little problem.

I want to write a very small kernel. So, I can't use the standard
adainclude and adalib. Then, I created my own include directory (named
sys/). I put in it some very few packages :

  $ ls sys/
  ada.ads  a-unccon.ads  interfac.ads  s-expint.adb  s-expint.ads  s-
stoele.adb  s-stoele.ads  system.ads

And everything compiled and worked fine. But then, I created a
function that use the exponentiation '**' operator. But now, when I
try to compile my kernel :

  $ make
      ...
  $ gcc -m32 -gnato -gnatf -fstack-check -nostdinc -nostdlib -Isys/ -c
lib.adb
  lib.adb:24:33: run-time library configuration error
  lib.adb:24:33: file s-expint.ads not found
  lib.adb:24:33: entity "System.Exp_Int.Exp_Integer" not available
  compilation abandoned

Ok, gnat complains about a missing lib. It's a bit odd that '**' needs
a lib to be implemented !!!
Anyway, I copy s-expint.ad* in sys/ directory (which contains runtime
library suitable for my kernel) :

  $ cp /opt/gcc-4.4.5/lib/gcc/x86_64-unknown-linux-gnu/4.4.5/32/
adainclude/s-expint* sys/
  $ gcc -m32 -gnato -gnatf -fstack-check -nostdinc -nostdlib -Isys/ -c
lib.adb
  $ ld -m elf_i386 --oformat binary -Ttext 1000 -e_ada_kernel kernel.o
video.o exceptions.o lib.o -o kernel
  lib.o: In function `lib__integer_to_ascii':
  lib.adb:(.text+0x1e4): undefined reference to
`system__exp_int__exp_integer'

Mmmh.... the linker can't find Exp_Integer function which is defined
in sys/s-expint.adb. I logicaly have to compile it to generate a .o
object with the `system__exp_int__exp_integer' function.

  $ gcc -m32 -gnato -gnatf -fstack-check -nostdinc -nostdlib -Isys/ -c
sys/s-expint.adb
  s-expint.adb:32:01: descendents of package System may not be
compiled

Another error ! But now, it looks like a dead end as Gnat don't want
me to compile it with no other reason than the package name !!!

A kludge is to define that function in another package and to export
it via that kind of pragma : pragma Export(C, my_exp_int,
"system__exp_int__exp_integer").
But redefining that function in another package is really ugly.

Perhaps there's something I missed, but if someone have an explanation
and a solution, it would be very great :-)

Regards,












^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnat : descendents of package System may not be compiled error
  2011-05-23 15:34 gnat : descendents of package System may not be compiled error milouz
@ 2011-05-23 15:45 ` Robert A Duff
  2011-05-23 16:38   ` milouz
  0 siblings, 1 reply; 3+ messages in thread
From: Robert A Duff @ 2011-05-23 15:45 UTC (permalink / raw)


milouz <a.michelizza@gmail.com> writes:

>   $ gcc -m32 -gnato -gnatf -fstack-check -nostdinc -nostdlib -Isys/ -c
> sys/s-expint.adb
>   s-expint.adb:32:01: descendents of package System may not be
> compiled

You have to use the -gnatg switch to recompile children of System.

- Bob



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnat : descendents of package System may not be compiled error
  2011-05-23 15:45 ` Robert A Duff
@ 2011-05-23 16:38   ` milouz
  0 siblings, 0 replies; 3+ messages in thread
From: milouz @ 2011-05-23 16:38 UTC (permalink / raw)


On May 23, 5:45 pm, Robert A Duff <bobd...@shell01.TheWorld.com>
wrote:
> You have to use the -gnatg switch to recompile children of System.

It works fine :-D
Thank you very much !





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-23 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 15:34 gnat : descendents of package System may not be compiled error milouz
2011-05-23 15:45 ` Robert A Duff
2011-05-23 16:38   ` milouz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox