comp.lang.ada
 help / color / mirror / Atom feed
From: milouz <a.michelizza@gmail.com>
Subject: gnat : descendents of package System may not be compiled error
Date: Mon, 23 May 2011 08:34:19 -0700 (PDT)
Date: 2011-05-23T08:34:19-07:00	[thread overview]
Message-ID: <88d0df80-7887-4610-a3c6-9082678d8130@x1g2000yqb.googlegroups.com> (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,












             reply	other threads:[~2011-05-23 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 15:34 milouz [this message]
2011-05-23 15:45 ` gnat : descendents of package System may not be compiled error Robert A Duff
2011-05-23 16:38   ` milouz
replies disabled

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