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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Help Linking Shared Objects for Library Use Date: Sat, 28 Apr 2018 21:32:30 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="915444d16cc310b7ec135f7251c14d92"; logging-data="29869"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/175C1iq8AKOTndgK40+dbL1EFYOHbkzY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:fxxOzryEc+xsbzakIxnCAcqdZvA= sha1:lj+ZuuRrT5KuuoyOKB8jrLIx49s= Xref: reader02.eternal-september.org comp.lang.ada:51765 Date: 2018-04-28T21:32:30+01:00 List-Id: patrick@spellingbeewinnars.org writes: > gnatmake barn.adb -lsounds > gcc-4.6 -c -lsounds barn.adb > gcc-4.6 -c -lsounds cow.ads > gnatbind -x barn.ali > gnatlink barn.ali > ./barn.o: In function `_ada_barn': > barn.adb:(.text+0x9): undefined reference to `moo' > collect2: ld returned 1 exit status > gnatlink: error when calling /usr/bin/gcc-4.6 > gnatmake: *** link failed. > > When I look at the Ada library code installed from my repo it has .ali > files but I don't think I am generating cow.ali Well, are you or aren't you? is it there or not? > Is there a step I am missing to build cow.ads properly? or am I doing > something else wrong? You might have thought that gnatmake would report that it's going to ignore that '-lsounds' at the link phase, after uselessly passing it through to the compile phase. Interestingly, it does recognise that -L only needs to be passed through to the link phase. The answer is to say $ gnatmake barn.adb -largs -lsounds > Thanks for reading-Patrick I very nearly didn't, because of the careless formatting of the code.