From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,540ef566e4c55af7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Martin Klaiber Newsgroups: comp.lang.ada Subject: Re: Debian Sarge: problem with libgnat.so Date: Sat, 24 Dec 2005 00:35:05 +0100 Organization: Freie Universitaet Berlin Sender: Martin Klaiber Message-ID: <96eu73-n92.ln1@martinkl.dialup.fu-berlin.de> References: <87lkycpuwu.fsf@ludovic-brenta.org> <87acesouf8.fsf@ludovic-brenta.org> X-Trace: news.uni-berlin.de vL2OXIIhCnqrCfkhHL1WFgH3OROfGXDWq/aqSDXT2TTvMGj27Gza/tWG0E X-Orig-Path: not-for-mail User-Agent: tin/1.5.12-20020427 ("Sugar") (UNIX) (Linux/2.4.32 (i686)) Xref: g2news1.google.com comp.lang.ada:6996 Date: 2005-12-24T00:35:05+01:00 List-Id: Ludovic Brenta wrote: > 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) Ok, I've modified my Makefile. It doesn't look exactly like yours but should provide the same functionality. Here the relevant parts: MAIN = libopensteuer SOURCE = *.ad[bs] *.h GNAT_LIB = /usr/lib/gcc-lib/i486-linux/2.8.1/adalib/libgnat.so SHARED = $(MAIN).so SHARED_API = $(SHARED).$(API) SHARED_VERSION = $(SHARED_API).$(VERSION) # Compile: .PHONY: default default: gnatmake $(MAIN) -c -fPIC -m -O3 -largs # Build the library: .PHONY: shared shared: default gnatgcc -shared -L$(GNAT_LIB) -lgnat -Wl,-soname,$(SHARED_API) -o $(SHARED_VERSION) *.o But this only moves the problem one step forward :-/ gnatmake libopensteuer -c -fPIC -m -O3 -largs gnatmake: objects up to date. gnatgcc -shared -L/usr/lib/gcc-lib/i486-linux/2.8.1/adalib/libgnat.so -lgnat -Wl,-soname,libopensteuer.so.0 -o libopensteuer.so.0.2004.3 *.o ld: cannot find -lgnat Is my system broken? Do you have an idea, why gnatgcc doesn't find libgnat? On the other hand, I don't want to use gnatgcc really, because there are systems out without gnatgcc (SuSE IIRC). So, I think, I will use the other option: ask the user if I should create /usr/lib/libgnat.so if it is missing. > 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. Indeed. But the paper doesn't mention a situation as we might have in my case: somebody installs the libraries needed for this program (for instance by a package-manager which only does the default installation, i.e. no extra creation of links). But this person does not install the Ada-compiler, as he only wants to build a C-program using my library. So he would only have $(CC), and as you said, C-compilers would look in /usr/lib vor libgnat.so, not in /usr/lib/gcc-lib/... Doesn't this mean that we always should have /usr/lib/libgnat.so? Or, to ask the other way round: is there a special reason why we don't have this link in /usr/lib? Martin