comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Debian Sarge: problem with libgnat.so
Date: Fri, 23 Dec 2005 13:43:39 +0100
Date: 2005-12-23T13:43:39+01:00	[thread overview]
Message-ID: <87acesouf8.fsf@ludovic-brenta.org> (raw)
In-Reply-To: a6sr73-ktb.ln1@martinkl.dialup.fu-berlin.de

Martin Klaiber <martinkl@zedat.fu-berlin.de> writes:

> Ludovic Brenta <ludovic@ludovic-brenta.org> wrote:
>
>> Your Makefile is correct, except that it calls the C compiler to link
>> your program.  If you call gnatgcc instead, you should be fine.  By
>> default, gnatgcc looks in /usr/lib/gcc-lib/i486-linux/2.8.1/adalib,
>> but gcc (the C compiler) only looks in /usr/lib.
>
> Hm, gnatgcc gives the same error:

Oops, sorry.  I think I meant gnatmake, but even that wouldn't solve
your problem.

> I want to keep it portable with other Linux-distros (if possible) as
> the code is public.  Would it be better to use gnatgcc oder gcc then?

I suggest that you hide libgnat from C programmers.  To do this, you
link your shared library with libgnat; unfortunately, as things stand
now, you must use the full path for that, like so:

# -*- Makefile -*- snippet
adalib:=/usr/lib/gcc-lib/`gnatgcc -dumpmachine`/`gnatgcc -dumpversion`/adalib

libopensteuer.so.$(major).$(minor): $(OBJECT_FILES)
        gnatgcc -shared -o $@ $(OBJECT_FILES) \
           -L$(adalib) -lgnat -Wl,--soname,libopensteuer.so.$(major)

install:
        cp -p libopensteuer.so.$(major).$(minor) /usr/local/lib
        cd /usr/local/lib; \
        ln -s libopensteuer.so.$(major).$(minor) libopensteuer.so; \
        ln -s libopensteuer.so.$(major).$(minor) libopensteuer.so.$(major)

CFLAGS := -Wall

test_c.o: test_c.c:
	gcc -c $< -o $@ $CFLAGS

test_c: test_c.o install
        gcc -o $@ $< -lopensteuer
# End of Makefile snippet

If libopensteuer is properly linked with libgnat, then it doesn't
matter what you use to do the final linking: gcc, gnatcc, gnatlink, or
even plain ld.

As to portability, the only standard layout for Ada files is the GNU
Ada Environment Specification[1].  It might be worthwhile to see if we
can improve this standard.  Also, the only GNU/Linux distribution I
know of that conforms to this standard is Debian.

[1] http://cert.uni-stuttgart.de/projects/ada/gnae.php

HTH

-- 
Ludovic Brenta.



  reply	other threads:[~2005-12-23 12:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22 21:12 Debian Sarge: problem with libgnat.so Martin Klaiber
2005-12-22 23:35 ` Ludovic Brenta
2005-12-23  0:15   ` Martin Klaiber
2005-12-23 12:43     ` Ludovic Brenta [this message]
2005-12-23 16:10       ` Georg Bauhaus
2005-12-23 23:35       ` Martin Klaiber
2005-12-24  0:23         ` Ludovic Brenta
2005-12-27 12:23           ` Martin Klaiber
2005-12-27 15:43             ` Ludovic Brenta
replies disabled

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