comp.lang.ada
 help / color / mirror / Atom feed
* Exporting linker options from library GPR
@ 2018-01-19 14:25 Simon Wright
  2018-01-19 16:10 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Simon Wright @ 2018-01-19 14:25 UTC (permalink / raw)


I'm working with SDLAda, thanks Luke, on macOS, using a prebuilt SDL2,
which comes as a framework.

Whenever another project needs to link against the library project
concerned, it has to use the options

   ("-F", external ("HOME") & "/Library/Frameworks",
    "-framework", "SDL2")

I tried (in this project)

   Linking_Options := ("-F", external ("HOME") & "/Library/Frameworks",
                       "-framework", "SDL2");
   for Library_Options use Linking_Options;
   package Linker is
      for Default_Switches ("ada") use Linking_Options;
   end Linker;

(which results in the warning that Linker switches aren't taken account
in library Projects)

and in the using project

   package Linker renames SDLAda.Linker;

I could avoid the warning by omitting SDLAda.Linker and writing in the
using project

   package Linker is
      for Default_Switches ("ada") use SDLAda.Linking_Options;
   end Linker;

These workrounds are all very well, but is there any way of telling the
final linker to add these switches automatically?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-01-19 14:25 Exporting linker options from library GPR Simon Wright
@ 2018-01-19 16:10 ` Dmitry A. Kazakov
  2018-01-19 17:25   ` Simon Wright
  2018-02-13  9:43 ` Luke A. Guest
  2018-02-13  9:50 ` Luke A. Guest
  2 siblings, 1 reply; 31+ messages in thread
From: Dmitry A. Kazakov @ 2018-01-19 16:10 UTC (permalink / raw)


On 2018-01-19 15:25, Simon Wright wrote:
> I'm working with SDLAda, thanks Luke, on macOS, using a prebuilt SDL2,
> which comes as a framework.

[...]

> These workrounds are all very well, but is there any way of telling the
> final linker to add these switches automatically?

AFAIK it should be

    for Library_Options use ...

and/or

    for Leading_Library_Options use ...

in the library project to be specified in "with".

And you cannot have build-library and with-library project files same. 
At least I never managed that.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-01-19 16:10 ` Dmitry A. Kazakov
@ 2018-01-19 17:25   ` Simon Wright
  2018-01-20 18:15     ` Stephen Leake
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-01-19 17:25 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On 2018-01-19 15:25, Simon Wright wrote:
>> I'm working with SDLAda, thanks Luke, on macOS, using a prebuilt SDL2,
>> which comes as a framework.
>
> [...]
>
>> These workrounds are all very well, but is there any way of telling the
>> final linker to add these switches automatically?
>
> AFAIK it should be
>
>    for Library_Options use ...

This in the build-library GPR tells the switches to build a shared
library. Itwas present in the build-library GPR, but didn't solve my
problem.  I just tried again ... and ... this time it worked, perhaps
because I was confused between shared & static ... it seems that things
are OK at least when the built library is dynamic ... this may be
Mac-related, since Darwin shared libraries (.dylib) contain references
to the paths of the dylibs they themselves use.

Still confused.

> and/or
>
>    for Leading_Library_Options use ...
>
> in the library project to be specified in "with".
>
> And you cannot have build-library and with-library project files
> same. At least I never managed that.

It seems they can be in this case (all a bit of a confusing mystery).

I do seem to have come across a couple of gprbuild/gprinstall issues in
this area. More investigation needed.

To answer my original question - it seems that a library project file
that contains a package Linker with an attribute Linker_Options was what
I was looking for.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-01-19 17:25   ` Simon Wright
@ 2018-01-20 18:15     ` Stephen Leake
  0 siblings, 0 replies; 31+ messages in thread
From: Stephen Leake @ 2018-01-20 18:15 UTC (permalink / raw)


On Friday, January 19, 2018 at 11:25:18 AM UTC-6, Simon Wright wrote:
> To answer my original question - it seems that a library project file
> that contains a package Linker with an attribute Linker_Options was what
> I was looking for.

You can also put that Linker_Options in a shared project file. See (gprbuild_ug) Package Linker Attributes, 'Linker_Options'. gprbuild_ug.info is in GNAT-gpl_2017/share/doc/gprbuild/info/


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-01-19 14:25 Exporting linker options from library GPR Simon Wright
  2018-01-19 16:10 ` Dmitry A. Kazakov
@ 2018-02-13  9:43 ` Luke A. Guest
  2018-02-13 18:37   ` Lucretia
  2018-02-13  9:50 ` Luke A. Guest
  2 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2018-02-13  9:43 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:
> I'm working with SDLAda, thanks Luke, on macOS, using a prebuilt SDL2,
> which comes as a framework.
> 

Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
the changes required to get the thing built with the SDL2 framework.

I’m currently trying to create a Mac OS X KVM, but it’s not going well 😫

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-01-19 14:25 Exporting linker options from library GPR Simon Wright
  2018-01-19 16:10 ` Dmitry A. Kazakov
  2018-02-13  9:43 ` Luke A. Guest
@ 2018-02-13  9:50 ` Luke A. Guest
  2 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2018-02-13  9:50 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:
> I'm working with SDLAda, thanks Luke, on

Ta 😝

I’ll check what my changes on my Mac and post them here for you to try. If
they work I’ll push em.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13  9:43 ` Luke A. Guest
@ 2018-02-13 18:37   ` Lucretia
  2018-02-13 20:30     ` Simon Wright
                       ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Lucretia @ 2018-02-13 18:37 UTC (permalink / raw)


On Tuesday, 13 February 2018 09:43:49 UTC, Luke A. Guest  wrote:

> Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
> the changes required to get the thing built with the SDL2 framework.

Just checked, I did it on the command line as a hack to get it compiling on Mac.

It seems that GPR's cannot expand `sdl2-config --cflags` when passed via the GPR Default_Switches mechanism, if there's a way, I could clean up the makefile a bit more and shift more to the GPR.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13 18:37   ` Lucretia
@ 2018-02-13 20:30     ` Simon Wright
  2018-02-13 20:37     ` Simon Wright
  2018-02-13 20:42     ` Simon Wright
  2 siblings, 0 replies; 31+ messages in thread
From: Simon Wright @ 2018-02-13 20:30 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Lucretia <laguest9000@googlemail.com> writes:

> On Tuesday, 13 February 2018 09:43:49 UTC, Luke A. Guest  wrote:
>
>> Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
>> the changes required to get the thing built with the SDL2 framework.
>
> Just checked, I did it on the command line as a hack to get it
> compiling on Mac.
>
> It seems that GPR's cannot expand `sdl2-config --cflags` when passed
> via the GPR Default_Switches mechanism, if there's a way, I could
> clean up the makefile a bit more and shift more to the GPR.

There's probably a way if you use the makefile.

I hacked an sdlada_mac.gpr:


[-- Attachment #2: Mac GPR - framework --]
[-- Type: application/octet-stream, Size: 1824 bytes --]

project SDLAda_Mac is
   Version := "2.2.0";

   type Platform_Type is ("linux", "bsd", "windows", "macosx", "ios", "android");
   type Mode_Type is ("debug", "release");
   type Build_Type is ("static", "shared");

   Platform : Platform_Type := external ("SDL_PLATFORM", "macosx");
   Mode     : Mode_Type     := external ("SDL_MODE", "debug");
   Build    : Build_Type    := external ("SDL_BUILD", "shared");

   for Languages    use ("Ada", "C");
   for Source_Dirs  use ("../../src", "../../src/" & Platform, "gen/src/");
   for Library_Name use "sdlada";
   for Object_Dir   use "gen/" & Build & "." & Mode & "/lib/.obj";
   for Library_Dir  use "gen/" & Build & "." & Mode &  "/lib";
   for Library_Version use "libsdlada.so." & Version;

   Linking_Options := ("-F", external ("HOME") & "/Library/Frameworks",
                       "-framework", "SDL2");

   case Build is
      when "static" =>
         for Library_Kind use "static";

      when "shared" =>
         for Library_Kind use "relocatable";
         for Library_Options use Linking_Options;
   end case;

   package Compiler is
      C_Switches := ("-I" & external ("HOME") & "/Library/Frameworks/SDL2.framework/Headers");
      Ada_Switches := ("-gnat2012", "-gnata", "-gnato", "-gnatE", "-gnaty", "-gnatyM120");

      case Mode is
         when "debug" =>
            C_Switches   := C_Switches & ("-O0", "-g");
            Ada_Switches := Ada_Switches & ("-O0", "-g");

         when "release" =>
            C_Switches   := C_Switches & ("-O2", "-g");
            Ada_Switches := Ada_Switches & ("-O2", "-g");
      end case;

      for Default_Switches ("C") use C_Switches;
      for Default_Switches ("Ada") use Ada_Switches;
   end Compiler;

   package Linker is
      for Linker_Options use Linking_Options;
   end Linker;

end SDLAda_Mac;

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13 18:37   ` Lucretia
  2018-02-13 20:30     ` Simon Wright
@ 2018-02-13 20:37     ` Simon Wright
  2018-02-14  6:29       ` Luke A. Guest
  2018-02-13 20:42     ` Simon Wright
  2 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-13 20:37 UTC (permalink / raw)


Lucretia <laguest9000@googlemail.com> writes:

> On Tuesday, 13 February 2018 09:43:49 UTC, Luke A. Guest  wrote:
>
>> Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
>> the changes required to get the thing built with the SDL2 framework.
>
> Just checked, I did it on the command line as a hack to get it
> compiling on Mac.
>
> It seems that GPR's cannot expand `sdl2-config --cflags` when passed
> via the GPR Default_Switches mechanism, if there's a way, I could
> clean up the makefile a bit more and shift more to the GPR.

The pre-built framework doesn't come with sdl2-config.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13 18:37   ` Lucretia
  2018-02-13 20:30     ` Simon Wright
  2018-02-13 20:37     ` Simon Wright
@ 2018-02-13 20:42     ` Simon Wright
  2018-02-14  7:10       ` Luke A. Guest
  2 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-13 20:42 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Lucretia <laguest9000@googlemail.com> writes:

> On Tuesday, 13 February 2018 09:43:49 UTC, Luke A. Guest  wrote:
>
>> Just seen this. I have actually built SDLAda on Mac OS X, but I didn’t push
>> the changes required to get the thing built with the SDL2 framework.
>
> Just checked, I did it on the command line as a hack to get it
> compiling on Mac.
>
> It seems that GPR's cannot expand `sdl2-config --cflags` when passed
> via the GPR Default_Switches mechanism, if there's a way, I could
> clean up the makefile a bit more and shift more to the GPR.

There's probably a way if you use the makefile.

I hacked an sdlada_mac.gpr:


[-- Attachment #2: Mac/Framework compatible GPR --]
[-- Type: text/plain, Size: 1824 bytes --]

project SDLAda_Mac is
   Version := "2.2.0";

   type Platform_Type is ("linux", "bsd", "windows", "macosx", "ios", "android");
   type Mode_Type is ("debug", "release");
   type Build_Type is ("static", "shared");

   Platform : Platform_Type := external ("SDL_PLATFORM", "macosx");
   Mode     : Mode_Type     := external ("SDL_MODE", "debug");
   Build    : Build_Type    := external ("SDL_BUILD", "shared");

   for Languages    use ("Ada", "C");
   for Source_Dirs  use ("../../src", "../../src/" & Platform, "gen/src/");
   for Library_Name use "sdlada";
   for Object_Dir   use "gen/" & Build & "." & Mode & "/lib/.obj";
   for Library_Dir  use "gen/" & Build & "." & Mode &  "/lib";
   for Library_Version use "libsdlada.so." & Version;

   Linking_Options := ("-F", external ("HOME") & "/Library/Frameworks",
                       "-framework", "SDL2");

   case Build is
      when "static" =>
         for Library_Kind use "static";

      when "shared" =>
         for Library_Kind use "relocatable";
         for Library_Options use Linking_Options;
   end case;

   package Compiler is
      C_Switches := ("-I" & external ("HOME") & "/Library/Frameworks/SDL2.framework/Headers");
      Ada_Switches := ("-gnat2012", "-gnata", "-gnato", "-gnatE", "-gnaty", "-gnatyM120");

      case Mode is
         when "debug" =>
            C_Switches   := C_Switches & ("-O0", "-g");
            Ada_Switches := Ada_Switches & ("-O0", "-g");

         when "release" =>
            C_Switches   := C_Switches & ("-O2", "-g");
            Ada_Switches := Ada_Switches & ("-O2", "-g");
      end case;

      for Default_Switches ("C") use C_Switches;
      for Default_Switches ("Ada") use Ada_Switches;
   end Compiler;

   package Linker is
      for Linker_Options use Linking_Options;
   end Linker;

end SDLAda_Mac;

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13 20:37     ` Simon Wright
@ 2018-02-14  6:29       ` Luke A. Guest
  0 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2018-02-14  6:29 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:
> Lucretia <laguest9000@googlemail.com> writes:

> 
> The pre-built framework doesn't come with sdl2-config.
> 


Well, you don’t really need it with the -framework flag.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-13 20:42     ` Simon Wright
@ 2018-02-14  7:10       ` Luke A. Guest
  2018-02-14  9:33         ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2018-02-14  7:10 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:
> Lucretia <laguest9000@googlemail.com> writes:

> I hacked an sdlada_mac.gpr:

I would question why GNAT isn’t finding the framework directory, it’s a
default path, afaik (which isn’t much re Mac). I’m fairly sure I didn’t
have to do that in the command line.

The makefile’s going to need some extra massaging to enable this, but it’s
required, I’ll get it going tonight then you can dump your gpr.



^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-14  7:10       ` Luke A. Guest
@ 2018-02-14  9:33         ` Simon Wright
  2018-02-14  9:59           ` Luke A. Guest
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-14  9:33 UTC (permalink / raw)


Luke A. Guest <laguest@archeia.com> writes:

> Simon Wright <simon@pushface.org> wrote:
>> Lucretia <laguest9000@googlemail.com> writes:
>
>> I hacked an sdlada_mac.gpr:
>
> I would question why GNAT isn’t finding the framework directory, it’s a
> default path, afaik (which isn’t much re Mac). I’m fairly sure I didn’t
> have to do that in the command line.

Without the -F, ld fails to find the framework. "man ld" says "The
default framework search path is /Library/Frameworks then
/System/Library/Frameworks".

Perhaps I should bite the bullet and install SDL2 in one of the standard
places :-)

Would I then still need the Compiler.C_Switches setting for the include
path, I wonder?

> The makefile’s going to need some extra massaging to enable this, but it’s
> required, I’ll get it going tonight then you can dump your gpr.

Tks

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-14  9:33         ` Simon Wright
@ 2018-02-14  9:59           ` Luke A. Guest
  2018-02-15  1:04             ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2018-02-14  9:59 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:

> Without the -F, ld fails to find the framework. "man ld" says "The
> default framework search path is /Library/Frameworks then
> /System/Library/Frameworks".
> 
> Perhaps I should bite the bullet and install SDL2 in one of the standard
> places :-)

Might help 😏

I updated mine to the latest last night and added ttf and image, I placed
them in one of those standard locations. 

> Would I then still need the Compiler.C_Switches setting for the include
> path, I wonder?

I don’t think you do.



^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-14  9:59           ` Luke A. Guest
@ 2018-02-15  1:04             ` Lucretia
  2018-02-15  8:49               ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-15  1:04 UTC (permalink / raw)


I have it building on Mac OS X as a static lib, but the options are controlled from the makefile. 

To make it consistent, I'd either have to remove the sdl2-config call for other all other OSes and get the flags from the script and copy them across, hoping they are correct. Or, the sdl2-config needs to be callable and expandable from the gpr file, which I don't think is possible.

So, before I push the changes, can anyone tell me if this is possible?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15  1:04             ` Lucretia
@ 2018-02-15  8:49               ` Simon Wright
  2018-02-15 10:06                 ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-15  8:49 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Lucretia <laguest9000@googlemail.com> writes:

Do you think we should raise an issue on github for this discussion? (to
take it off the group)

> I have it building on Mac OS X as a static lib, but the options are
> controlled from the makefile.

When I built it as a dynamic library, I got (with some builds) an ACCVIO
during elaboration, which I took to be down to failing to initialize
libsdlada.dylib (it's not built as an SAL).

> To make it consistent, I'd either have to remove the sdl2-config call
> for other all other OSes and get the flags from the script and copy
> them across, hoping they are correct. Or, the sdl2-config needs to be
> callable and expandable from the gpr file, which I don't think is
> possible.
>
> So, before I push the changes, can anyone tell me if this is possible?

As a possible alternative, the attached makefile fragment works out
whether you're on Darwin or not, so you could decide in the makefile how
to get the options & then pass them through to the gpr.


[-- Attachment #2: Mkaefile fragment --]
[-- Type: text/plain, Size: 294 bytes --]

DARWIN = $(shell if gcc -v 2>&1 | grep darwin >/dev/null 2>&1; then	\
		   echo 1;						\
		 else							\
		   echo 0;						\
		 fi)

FLAGS = $(shell if [ $(DARWIN) -eq 1 ]; then	\
	          echo "-framework SDL2";	\
		else				\
		  echo "result of sdl2-config";	\
		fi)

all:
	@echo $(FLAGS)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15  8:49               ` Simon Wright
@ 2018-02-15 10:06                 ` Lucretia
  2018-02-15 11:39                   ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-15 10:06 UTC (permalink / raw)


On Thursday, 15 February 2018 08:49:44 UTC, Simon Wright  wrote:
> Lucretia <me@me.com> writes:
> |
> Do you think we should raise an issue on github for this discussion? (to
> take it off the group)

That would see less people looking at it.
 
> > I have it building on Mac OS X as a static lib, but the options are
> > controlled from the makefile.
> 
> When I built it as a dynamic library, I got (with some builds) an ACCVIO
> during elaboration, which I took to be down to failing to initialize
> libsdlada.dylib (it's not built as an SAL).

What is ACCVIO and SAL?
 
> > So, before I push the changes, can anyone tell me if this is possible?
> 
> As a possible alternative, the attached makefile fragment works out
> whether you're on Darwin or not, so you could decide in the makefile how
> to get the options & then pass them through to the gpr.

TBH, putting this stuff in the gpr is better.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 10:06                 ` Lucretia
@ 2018-02-15 11:39                   ` Simon Wright
  2018-02-15 15:22                     ` Lucretia
  2018-02-15 15:24                     ` Lucretia
  0 siblings, 2 replies; 31+ messages in thread
From: Simon Wright @ 2018-02-15 11:39 UTC (permalink / raw)


Lucretia <laguest9000@googlemail.com> writes:

> On Thursday, 15 February 2018 08:49:44 UTC, Simon Wright  wrote:
>> Lucretia <me@me.com> writes:
>> > I have it building on Mac OS X as a static lib, but the options are
>> > controlled from the makefile.
>> 
>> When I built it as a dynamic library, I got (with some builds) an ACCVIO
>> during elaboration, which I took to be down to failing to initialize
>> libsdlada.dylib (it's not built as an SAL).
>
> What is ACCVIO and SAL?

ACCVIO : access violation

SAL: gprbuild term for a shared library that automatically runs
<lib-name>init to do elaboration on load.

So, although the binder calls in elaboration for the library components
that are explicitly used, it doesn't do complete elaboration for the
library, and you are open to runtime errors.

http://docs.adacore.com/live/wave/gprbuild/html/gprbuild_ug/gprbuild_ug/gnat_project_manager.html#stand-alone-library-projects

>> > So, before I push the changes, can anyone tell me if this is possible?
>> 
>> As a possible alternative, the attached makefile fragment works out
>> whether you're on Darwin or not, so you could decide in the makefile how
>> to get the options & then pass them through to the gpr.
>
> TBH, putting this stuff in the gpr is better.

It would be if it worked! but I don't see any way

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 11:39                   ` Simon Wright
@ 2018-02-15 15:22                     ` Lucretia
  2018-02-15 15:24                     ` Lucretia
  1 sibling, 0 replies; 31+ messages in thread
From: Lucretia @ 2018-02-15 15:22 UTC (permalink / raw)


On Thursday, 15 February 2018 11:39:27 UTC, Simon Wright  wrote:

> >> When I built it as a dynamic library, I got (with some builds) an ACCVIO
> >> during elaboration, which I took to be down to failing to initialize
> >> libsdlada.dylib (it's not built as an SAL).
> >
> > What is ACCVIO and SAL?
> 
> ACCVIO : access violation

Ok. This would likely fall into the elaboration issue I put up, but...I'm thinking about removing the ability to build a shared lib from it anyway, I just don't really see a need. 
 
> SAL: gprbuild term for a shared library that automatically runs
> <lib-name>init to do elaboration on load.

Ahhh.
 
> It would be if it worked! but I don't see any way

I think I'm just going to grab the options and copy them across.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 11:39                   ` Simon Wright
  2018-02-15 15:22                     ` Lucretia
@ 2018-02-15 15:24                     ` Lucretia
  2018-02-15 18:38                       ` Lucretia
  1 sibling, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-15 15:24 UTC (permalink / raw)


On Thursday, 15 February 2018 11:39:27 UTC, Simon Wright  wrote:

> >> When I built it as a dynamic library, I got (with some builds) an ACCVIO
> >> during elaboration, which I took to be down to failing to initialize
> >> libsdlada.dylib (it's not built as an SAL).

Forgot to mention. When I built it as shared, I got a ton of unreferenced symbols for some reason, so I'm probably missing extra libs that need to be linked. Like I said, I'm new to Mac OS stuff really.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 15:24                     ` Lucretia
@ 2018-02-15 18:38                       ` Lucretia
  2018-02-15 18:42                         ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-15 18:38 UTC (permalink / raw)


Ok, I've pushed the latest changes:

Adds Mac OS.
Removed dynamic library builds.
Fixed a few paths.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 18:38                       ` Lucretia
@ 2018-02-15 18:42                         ` Lucretia
  2018-02-15 20:52                           ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-15 18:42 UTC (permalink / raw)


1. GPRBuild whines about the Linker package in the library gpr, WTF?
2. GPRInstall removes the Linker package on install, WTF? That's really useful!

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 18:42                         ` Lucretia
@ 2018-02-15 20:52                           ` Simon Wright
  2018-02-15 23:14                             ` Luke A. Guest
  2018-02-16  7:29                             ` Lucretia
  0 siblings, 2 replies; 31+ messages in thread
From: Simon Wright @ 2018-02-15 20:52 UTC (permalink / raw)


Lucretia <laguest9000@googlemail.com> writes:

> 1. GPRBuild whines about the Linker package in the library gpr, WTF?
> 2. GPRInstall removes the Linker package on install, WTF? That's
> really useful!

Inside package Linker, you need to use Linker_Options rather than
Default_Switches ("ada")


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 20:52                           ` Simon Wright
@ 2018-02-15 23:14                             ` Luke A. Guest
  2018-02-16  8:29                               ` Simon Wright
  2018-02-16  7:29                             ` Lucretia
  1 sibling, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2018-02-15 23:14 UTC (permalink / raw)


Simon Wright <simon@pushface.org> wrote:
> Lucretia <laguest9000@googlemail.com> writes:
> 
>> 1. GPRBuild whines about the Linker package in the library gpr, WTF?
>> 2. GPRInstall removes the Linker package on install, WTF? That's
>> really useful!
> 
> Inside package Linker, you need to use Linker_Options rather than
> Default_Switches ("ada")
> 
> 

Strange. Ok, I’ll try it. Is there an equivalent one for c compiler
options? Just in case someone tries to rebuild the lib once it’s installed?

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 20:52                           ` Simon Wright
  2018-02-15 23:14                             ` Luke A. Guest
@ 2018-02-16  7:29                             ` Lucretia
  1 sibling, 0 replies; 31+ messages in thread
From: Lucretia @ 2018-02-16  7:29 UTC (permalink / raw)


On Thursday, 15 February 2018 22:29:42 UTC, Simon Wright  wrote:

> Inside package Linker, you need to use Linker_Options rather than
> Default_Switches ("ada")

Tried it, worked fine. Pushed to github, try that.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-15 23:14                             ` Luke A. Guest
@ 2018-02-16  8:29                               ` Simon Wright
  2018-02-16 23:26                                 ` Stephen Leake
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-16  8:29 UTC (permalink / raw)


Luke A. Guest <laguest@archeia.com> writes:

> Simon Wright <simon@pushface.org> wrote:
>> Lucretia <laguest9000@googlemail.com> writes:
>> 
>>> 1. GPRBuild whines about the Linker package in the library gpr, WTF?
>>> 2. GPRInstall removes the Linker package on install, WTF? That's
>>> really useful!
>> 
>> Inside package Linker, you need to use Linker_Options rather than
>> Default_Switches ("ada")
>> 
>> 
>
> Strange. Ok, I’ll try it. Is there an equivalent one for c compiler
> options? Just in case someone tries to rebuild the lib once it’s
> installed?

From the gprbuild references, Linker_Options

   "specifies a list of additional switches to be given to the linker
   when linking an executable. It is ignored when defined in the main
   project and taken into account in all other projects that are
   imported directly or indirectly. These switches complement the
   Linker'Switches defined in the main project. This is useful when a
   particular subsystem depends on an external library: adding this
   dependency as a Linker_Options in the project of the subsystem is
   more convenient than adding it to all the Linker'Switches of the main
   projects that depend upon this subsystem.

so (a) it only really applies to a library, (b) it's
language-independent.

We already have Compiler'[Default_]Switches ("c").

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-16  8:29                               ` Simon Wright
@ 2018-02-16 23:26                                 ` Stephen Leake
  2018-02-17  7:49                                   ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Stephen Leake @ 2018-02-16 23:26 UTC (permalink / raw)


You might be able to get gprbuild to run sdl2-config if you create your own xml file. See gnat/share/gprconfig/*.xml. Those files tell gprbuild how to run tools. I haven't played with that in a long time, and I'm sure it's changed since then (it changed often when I was playing with it), so I can't help more than this.

You can run sdl2-config in the makefile, put the result in an environment variable, and read that environment variable in the gpr (maybe that's what you mean by "in the makefile" above).

-- Stephe


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-16 23:26                                 ` Stephen Leake
@ 2018-02-17  7:49                                   ` Simon Wright
  2018-02-17 14:51                                     ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-17  7:49 UTC (permalink / raw)


Stephen Leake <stephen_leake@stephe-leake.org> writes:

> You might be able to get gprbuild to run sdl2-config if you create
> your own xml file. See gnat/share/gprconfig/*.xml. Those files tell
> gprbuild how to run tools. I haven't played with that in a long time,
> and I'm sure it's changed since then (it changed often when I was
> playing with it), so I can't help more than this.

I didn't think that would let you feed back the result of running the
tool into gprbuild; but worth a look, thanks.

> You can run sdl2-config in the makefile, put the result in an
> environment variable, and read that environment variable in the gpr
> (maybe that's what you mean by "in the makefile" above).

Yes.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-17  7:49                                   ` Simon Wright
@ 2018-02-17 14:51                                     ` Lucretia
  2018-02-17 15:43                                       ` Simon Wright
  0 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2018-02-17 14:51 UTC (permalink / raw)


On Saturday, 17 February 2018 07:49:20 UTC, Simon Wright  wrote:

> I didn't think that would let you feed back the result of running the
> tool into gprbuild; but worth a look, thanks.
> 
> > You can run sdl2-config in the makefile, put the result in an
> > environment variable, and read that environment variable in the gpr
> > (maybe that's what you mean by "in the makefile" above).

I can't see it working given that I had to break up "-framework SDL2" into 2 strings, means would need to do extra processing on the output from the sdl2-config.

The current solution works, so I'll stick with this, for now, until it breaks somewhere :/

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-17 14:51                                     ` Lucretia
@ 2018-02-17 15:43                                       ` Simon Wright
  2018-02-17 15:52                                         ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Wright @ 2018-02-17 15:43 UTC (permalink / raw)


Lucretia <laguest9000@googlemail.com> writes:

> On Saturday, 17 February 2018 07:49:20 UTC, Simon Wright  wrote:
(actually, this was Stephe)

>> > You can run sdl2-config in the makefile, put the result in an
>> > environment variable, and read that environment variable in the gpr
>> > (maybe that's what you mean by "in the makefile" above).
>
> I can't see it working given that I had to break up "-framework SDL2"
> into 2 strings, means would need to do extra processing on the output
> from the sdl2-config.

   FLAGS := external_as_list ("-framework SDL2", " ");

results in ("-framework", "SDL2")

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Exporting linker options from library GPR
  2018-02-17 15:43                                       ` Simon Wright
@ 2018-02-17 15:52                                         ` Lucretia
  0 siblings, 0 replies; 31+ messages in thread
From: Lucretia @ 2018-02-17 15:52 UTC (permalink / raw)


On Saturday, 17 February 2018 15:43:03 UTC, Simon Wright  wrote:

> > I can't see it working given that I had to break up "-framework SDL2"
> > into 2 strings, means would need to do extra processing on the output
> > from the sdl2-config.
> 
>    FLAGS := external_as_list ("-framework SDL2", " ");
> 
> results in ("-framework", "SDL2")

Ah, didn't know about that.

Ta.


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2018-02-17 15:52 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 14:25 Exporting linker options from library GPR Simon Wright
2018-01-19 16:10 ` Dmitry A. Kazakov
2018-01-19 17:25   ` Simon Wright
2018-01-20 18:15     ` Stephen Leake
2018-02-13  9:43 ` Luke A. Guest
2018-02-13 18:37   ` Lucretia
2018-02-13 20:30     ` Simon Wright
2018-02-13 20:37     ` Simon Wright
2018-02-14  6:29       ` Luke A. Guest
2018-02-13 20:42     ` Simon Wright
2018-02-14  7:10       ` Luke A. Guest
2018-02-14  9:33         ` Simon Wright
2018-02-14  9:59           ` Luke A. Guest
2018-02-15  1:04             ` Lucretia
2018-02-15  8:49               ` Simon Wright
2018-02-15 10:06                 ` Lucretia
2018-02-15 11:39                   ` Simon Wright
2018-02-15 15:22                     ` Lucretia
2018-02-15 15:24                     ` Lucretia
2018-02-15 18:38                       ` Lucretia
2018-02-15 18:42                         ` Lucretia
2018-02-15 20:52                           ` Simon Wright
2018-02-15 23:14                             ` Luke A. Guest
2018-02-16  8:29                               ` Simon Wright
2018-02-16 23:26                                 ` Stephen Leake
2018-02-17  7:49                                   ` Simon Wright
2018-02-17 14:51                                     ` Lucretia
2018-02-17 15:43                                       ` Simon Wright
2018-02-17 15:52                                         ` Lucretia
2018-02-16  7:29                             ` Lucretia
2018-02-13  9:50 ` Luke A. Guest

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