Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Conquest is easy. Control is not. -- Kirk, "Mirror, Mirror", stardate unknown


devel / comp.lang.ada / Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?

SubjectAuthor
* Very basic question: How to use gnatmake (not gprbuild) usingKenneth Wolcott
`* Re: Very basic question: How to use gnatmake (not gprbuild) usingJeffrey R.Carter
 `* Re: Very basic question: How to use gnatmake (not gprbuild) usingKenneth Wolcott
  `* Re: Very basic question: How to use gnatmake (not gprbuild) usingJeffrey R.Carter
   `- Re: Very basic question: How to use gnatmake (not gprbuild) usingKenneth Wolcott

1
Very basic question: How to use gnatmake (not gprbuild) using external libraries?

<021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9760&group=comp.lang.ada#9760

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:8787:0:b0:75b:3962:8dc6 with SMTP id j129-20020a378787000000b0075b39628dc6mr3277777qkd.1.1687909448095;
Tue, 27 Jun 2023 16:44:08 -0700 (PDT)
X-Received: by 2002:a05:6808:30a4:b0:3a1:f295:3e with SMTP id
bl36-20020a05680830a400b003a1f295003emr360644oib.1.1687909447805; Tue, 27 Jun
2023 16:44:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!glou.org!news.glou.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 27 Jun 2023 16:44:07 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=98.59.238.112; posting-account=oHOvdQoAAACYgyEBjgPNvKFOGxg8pNns
NNTP-Posting-Host: 98.59.238.112
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>
Subject: Very basic question: How to use gnatmake (not gprbuild) using
external libraries?
From: kennethwolcott@gmail.com (Kenneth Wolcott)
Injection-Date: Tue, 27 Jun 2023 23:44:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Kenneth Wolcott - Tue, 27 Jun 2023 23:44 UTC

Hi;

Very basic question here.

I have downloaded several examples of Ada code from the Rosetta Code web site. Some very interesting stuff!

I'm on a Mac with an M1 chip using the gnat 13.1 compiler from Simon Wright...

I see many of these Rsoetta Code examples refer to external libraries (SDL, XML, GTK, etc). I have found most under ALIRE. I have found most of them in GitHub (etc).

I'm not using ALR much yet because I can't seem to successfully get full crates because I'm using an external gnat compiler (I'm on a Mac with a M1 chip) and it seems to only like crates bundled with the compiler on ALR :-( That is a question for a different post...

So, my questions are:
1. Where do I place the SDL library from GitHub?
2. Do I compile/install the package?
3. When using gnatmake do I use -I to specify where the library I'm referencing is found?
4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct?

Thanks,
Ken Wolcott

Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?

<u7gmv5$1mq6v$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9761&group=comp.lang.ada#9761

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (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 09:20:05 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <u7gmv5$1mq6v$1@dont-email.me>
References: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 28 Jun 2023 07:20:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f2a47a551e980a7158613db6b70f5f8a";
logging-data="1796319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lIaB0keHAnJ5iv/WCpbXyyu7AUvzRK40="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:trIZRIu0rBQSyxgqHjgBRvNyl9I=
Content-Language: en-US
In-Reply-To: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>
 by: Jeffrey R.Carter - Wed, 28 Jun 2023 07:20 UTC

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/.

> 2. Do I compile/install the package?

The library may have specific compilation/installation instructions. Generally
you should follow those.

> 3. When using gnatmake do I use -I to specify where the library I'm referencing is found?

This depends on the answer to 2. If you have all the source files for the
library in /path/to/SDL/, and have compiled them so their .ali and .o files are
also there, then using -I/path/to/SDL/ works fine. This is simple and easy. As
S/W engineers always try to keep things as simple as possible, this is the
approach I tend to use.

Coders, on the other hand, like to introduce unnecessary complexity, and you
will find lots of projects with baroque directory structures, maybe with source
files in /path/to/SDL/src/, .ali and .o files in /path/to/SDL/lib/, test program
source files in /path/to/SDL/test/src, their .ali and .o files in
/path/to/SDL/test/lib/, and executables in /path/to/SDL/test/bin/. Such
directory structures are gnatmake unfriendly, and the simple -I approach doesn't
work. You'll have to look into the exact meaning of -I and -a, and maybe others.

> 4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct?

The Ada language definition is independent of how and where source and
compilation artifacts are stored, so context clauses are necessarily independent
of such concepts. In other words, yes. This kind of information is handled by
the compilation options such as -I.

--
Jeff Carter
"He nevere yet no vileynye ne sayde
In al his lyf unto no maner wight."
Canterbury Tales
156

Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?

<9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9763&group=comp.lang.ada#9763

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ae9:dec5:0:b0:762:4579:d6a8 with SMTP id s188-20020ae9dec5000000b007624579d6a8mr1921237qkf.2.1687976726924;
Wed, 28 Jun 2023 11:25:26 -0700 (PDT)
X-Received: by 2002:a05:6808:2218:b0:3a1:f3b6:434a with SMTP id
bd24-20020a056808221800b003a1f3b6434amr2854432oib.4.1687976726626; Wed, 28
Jun 2023 11:25:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 28 Jun 2023 11:25:26 -0700 (PDT)
In-Reply-To: <u7gmv5$1mq6v$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=98.59.238.112; posting-account=oHOvdQoAAACYgyEBjgPNvKFOGxg8pNns
NNTP-Posting-Host: 98.59.238.112
References: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com> <u7gmv5$1mq6v$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com>
Subject: Re: Very basic question: How to use gnatmake (not gprbuild) using
external libraries?
From: kennethwolcott@gmail.com (Kenneth Wolcott)
Injection-Date: Wed, 28 Jun 2023 18:25:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3873
 by: Kenneth Wolcott - Wed, 28 Jun 2023 18:25 UTC

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.

> > 2. Do I compile/install the package?
> The library may have specific compilation/installation instructions. Generally
> you should follow those.

Ok.

> > 3. When using gnatmake do I use -I to specify where the library I'm referencing is found?
> This depends on the answer to 2. If you have all the source files for the
> library in /path/to/SDL/, and have compiled them so their .ali and .o files are
> also there, then using -I/path/to/SDL/ works fine. This is simple and easy. As
> S/W engineers always try to keep things as simple as possible, this is the
> approach I tend to use.

Use "-I/path", but do not use "-L/path"?

> Coders, on the other hand, like to introduce unnecessary complexity, and you
> will find lots of projects with baroque directory structures, maybe with source
> files in /path/to/SDL/src/, .ali and .o files in /path/to/SDL/lib/, test program
> source files in /path/to/SDL/test/src, their .ali and .o files in
> /path/to/SDL/test/lib/, and executables in /path/to/SDL/test/bin/. Such
> directory structures are gnatmake unfriendly, and the simple -I approach doesn't
> work. You'll have to look into the exact meaning of -I and -a, and maybe others.

Yeah, I like to keep things simple as well :-)

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?

> > 4. Once #3 is answered, I assume that I "with package" as if the '*.ad[sb]' files were co-located with my Ada program, is that correct?
> The Ada language definition is independent of how and where source and
> compilation artifacts are stored, so context clauses are necessarily independent
> of such concepts. In other words, yes. This kind of information is handled by
> the compilation options such as -I.

Thank you for the info!

Now I will make a new post regarding the compilation error I received with the SDL package.

Thanks,
Ken Wolcott

> --
> Jeff Carter
> "He nevere yet no vileynye ne sayde
> In al his lyf unto no maner wight."
> Canterbury Tales
> 156

Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?

<u7i03l$1nubt$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9765&group=comp.lang.ada#9765

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (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
Lines: 38
Message-ID: <u7i03l$1nubt$1@dont-email.me>
References: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>
<u7gmv5$1mq6v$1@dont-email.me>
<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>
 by: Jeffrey R.Carter - Wed, 28 Jun 2023 19:02 UTC

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

Re: Very basic question: How to use gnatmake (not gprbuild) using external libraries?

<ef67f2f3-cbee-4342-9918-2dd12323f4a5n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9766&group=comp.lang.ada#9766

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:59c5:0:b0:635:e771:474d with SMTP id el5-20020ad459c5000000b00635e771474dmr282467qvb.4.1687980863978;
Wed, 28 Jun 2023 12:34:23 -0700 (PDT)
X-Received: by 2002:a05:6870:4e0e:b0:1b0:7c1a:4a6e with SMTP id
pl14-20020a0568704e0e00b001b07c1a4a6emr2544616oab.3.1687980863645; Wed, 28
Jun 2023 12:34:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 28 Jun 2023 12:34:23 -0700 (PDT)
In-Reply-To: <u7i03l$1nubt$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=98.59.238.112; posting-account=oHOvdQoAAACYgyEBjgPNvKFOGxg8pNns
NNTP-Posting-Host: 98.59.238.112
References: <021a84aa-a34d-4e19-bc14-8643532f001fn@googlegroups.com>
<u7gmv5$1mq6v$1@dont-email.me> <9054de21-ec44-479f-adde-a65933cc5e44n@googlegroups.com>
<u7i03l$1nubt$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ef67f2f3-cbee-4342-9918-2dd12323f4a5n@googlegroups.com>
Subject: Re: Very basic question: How to use gnatmake (not gprbuild) using
external libraries?
From: kennethwolcott@gmail.com (Kenneth Wolcott)
Injection-Date: Wed, 28 Jun 2023 19:34:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 46
 by: Kenneth Wolcott - Wed, 28 Jun 2023 19:34 UTC

On Wednesday, June 28, 2023 at 12:02:16 PM UTC-7, Jeffrey R.Carter wrote:
> 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.

Thank you for the clarification/elaboration.

Ken

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor