From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries? Date: Wed, 28 Jun 2023 21:02:13 +0200 Organization: A noiseless patient Spider Message-ID: References: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com> <9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 28 Jun 2023 19:02:13 -0000 (UTC) Injection-Info: dont-email.me; posting-host="8cf4ea0992b986b1128c73b534ac691d"; logging-data="1833341"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181jOA4FgiCMWpvr+o2VEMfN9kc4EZ15AA=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:Ax3i4bXRGWCwUB4kbarHmi1UKlI= Content-Language: en-US In-Reply-To: <9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com> Xref: news.eternal-september.org comp.lang.ada:65364 List-Id: On 2023-06-28 20:25, Kenneth Wolcott wrote: > On Wednesday, June 28, 2023 at 12:20:09 AM UTC-7, Jeffrey R.Carter wrote: >> On 2023-06-28 01:44, Kenneth Wolcott wrote: >>> >>> 1. Where do I place the SDL library from GitHub? >> That is up to you. It goes in /path/to/SDL/, where you choose /path/to/. > > Cool. I probably should have mentioned that the library build procedure may expect a specific directory structure under /path/to/SDL/, and failure to create/keep that may result in the build process failing. > I'm not sure I understand the distinction between "-I/path" and "-L/path". I think when one includes ("-I/path") something it will be compiled along with what I'm trying to compile and when I use "-L/path" it means use *.obj, *.ali, etc at the linking stage. Is that correct? From the GNAT user guide (https://docs.adacore.com/live/wave/gnat_ugn/html/gnat_ugn/gnat_ugn/building_executable_programs_with_gnat.html#switches-for-gnatmake), -I/path/ is equivalent to -aO/path/ -aI/path/. -aO/path/ says to look for library and object files (.ali & .o) in /path/ in addition to the current directory. -aI/path/ says to look for source files in /path/ in addition to the current directory. -L/path/ is equivalent to -largs -L/path/, so it's a linker switch. I should probably have mentioned that it's probably a good idea to write-protect the library's .ali files one the library is built. This prevents other compilations from recompiling the library. In my experience, if you have the library's source, .ali, and .o files in /path/, then -I/path/ is all you need to compile and link against the library. -- Jeff Carter "He nevere yet no vileynye ne sayde In al his lyf unto no maner wight." Canterbury Tales 156