comp.lang.ada
 help / color / mirror / Atom feed
* gprbuild worked for GNAT GPL 2010, fails for 2011 edition
@ 2012-05-05  1:08 Jerry
  2012-05-07  6:10 ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry @ 2012-05-05  1:08 UTC (permalink / raw)


I'm on OS X 10.7.3 (Lion) and recently changed the Ada tools from
Adacore's 2010 GPL edition to their 2011 edition. Unfortunately, my
_simple_ project build process using gprbuild now fails, where it
worked with the 2010 edition.

The problem is in making a project file for externally built
libraries. (I find the GPRbuild's user guide a little vague on this
subject.) The external library in question is that made by cmake
during the PLplot installation. There are two libraries: the "core"
PLplot library which is compiled from C and which I am linking
sucessfully (see PLplot_Library_1 below).

The other kind of library contains the Ada bindings (which I wrote)
which are built (from cmake) using gnatmake. As I see it, there are
two versions of this library: (1) a dynamic library which lives at

  /usr/local/plplot/lib/libplplotadad.dylib

and (2) an Ada-style library directory containing the .ali and .o
files for the Ada bindings which is at

  /usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplotadad.dir

(I don't know which of these is preferred, if either. I'm not getting
either one to work.) For my own work, I can arrange for the PLplot
bindings to be re-compiled from source but I prefer to link to the pre-
built library because I think that is the way that users would work
and it provides me with a small bit of testing to work this way.

Note that the PLplot_Library_2 uses

  for Library_Dir use "/usr/local/plplot/lib/ada/adalib/plplotadad";

which contains the bindings' .ali files but not .o files--this worked
for 2010 but seems to be a problem for 2011. However, when I reference
the directory mentioned above which does contain both .o and .ali
files, the process still fails.

In one of my attempts, the process aborted, asking for the sources for
the Ada bindings. Why would sources be required for a pre-built
library?

Now, using the 2011 edition, using the below project files which work
for 2010, the process fails with

  gcc: /usr/local/plplot/lib/ada/adalib/plplotadad//libplplotadad.a:
No such file or directory

Incidentally, if I build the library using 2010 and try to link with
2011, failure happens with

  fatal error: file plplot.ali is incorrectly formatted
  make sure you are using consistent versions of gcc/gnatbind

Sorry for the long post.
Jerry


-- Library for core (C) PLplot functionality; this works.
library project PLplot_Library_1 is
	for Externally_Built use "true";
	for Library_Dir use "/usr/local/plplot/lib";
    for Library_Name use "plplotd";
	for Library_Kind use "dynamic";
end PLplot_Library_1;



-- Library for Ada bindings; worked for Adacore 2010, broken for 2011.
library project PLplot_Library_2 is
	for Externally_Built use "true";
	for Source_Dirs use ("/usr/local/plplot/share/ada/adainclude/
plplotadad");
    for Library_Dir use "/usr/local/plplot/lib/ada/adalib/plplotadad";
    for Library_Name use "plplotadad";
end PLplot_Library_2;



-- Main project file
with "PLplot_Library_1";
with "PLplot_Library_2";
project Build is
	for Source_Dirs use
	   ("source",
		"/Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/
Sampling",
		"/Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/Sampling/
Post-processing",
		"/Users/me/Documents/Programs/Ada/Code/My_Code/My_Tools");
	for Object_Dir use "build-normal";
	for Exec_Dir use ".";
	for Main use ("third.adb");

	package Builder is
		for Default_Switches ("Ada") use ("-O2", "-gnat05", "-gnato");
        for Executable ("third.adb") use "product-normal/run";
	end Builder;

	package Compiler is
	end Compiler;

	package Binder is
	end Binder;

	package Linker is
	end Linker;
end Build;



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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-05  1:08 gprbuild worked for GNAT GPL 2010, fails for 2011 edition Jerry
@ 2012-05-07  6:10 ` Simon Wright
  2012-05-08  4:02   ` Jerry
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2012-05-07  6:10 UTC (permalink / raw)


Jerry <lanceboyle@qwest.net> writes:

> and (2) an Ada-style library directory containing the .ali and .o
> files for the Ada bindings which is at
>
>   /usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplotadad.dir

This looks like the directory where the library (I think it'll be a
static library, libplplotadad.a, by default) is initially compiled
before the .ali files and the constructed .a are moved to the proper
place.

> Note that the PLplot_Library_2 uses
>
>   for Library_Dir use "/usr/local/plplot/lib/ada/adalib/plplotadad";
>
> which contains the bindings' .ali files but not .o files--this worked
> for 2010 but seems to be a problem for 2011.

This looks like the target directory, which should contain a single .a
and no .o's.

> In one of my attempts, the process aborted, asking for the sources for
> the Ada bindings. Why would sources be required for a pre-built
> library?

In the same way as the sources to the standard library are needed; the
.ali files are only a partial representation of the source, the full
source is needed to compile against.

> Now, using the 2011 edition, using the below project files which work
> for 2010, the process fails with
>
>   gcc: /usr/local/plplot/lib/ada/adalib/plplotadad//libplplotadad.a:
> No such file or directory

I don't know why this should have changed.


You've shown us three .gpr files, but I'd expect there to be a fourth,
which tells gprbuild how to build libplplotadad.a.

The BCs have a gpr[1] for use when the library is installed, which has
Externlly_Built set to True, and a gpr[2] for use while building the
library.

These two gprs use entirely different file structures; I use Make to
install the built library into its destination.

gprbuild copies the .a and .ali files from the Object_Dir into the
Library_Dir, but doesn't touch the source files unless you're defining a
stand-alone library (in which case I think you would definitely need a
'build' and a 'use' gpr). I'm only slowly coming to grips with this,
there's info at [3].

[1]
http://booch95.svn.sourceforge.net/viewvc/booch95/trunk/bc.gpr-for-installation?revision=1495&view=markup
[2]
http://booch95.svn.sourceforge.net/viewvc/booch95/trunk/bc.gpr?revision=1477&view=markup
[3]
http://docs.adacore.com/gprbuild-docs/html/gprbuild_ug.html#Library-Projects




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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-07  6:10 ` Simon Wright
@ 2012-05-08  4:02   ` Jerry
  2012-05-09  7:36     ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry @ 2012-05-08  4:02 UTC (permalink / raw)


On May 6, 11:10 pm, Simon Wright <si...@pushface.org> wrote:

To save time, just skip to my last comment about the "good news." 8^)

> Jerry <lancebo...@qwest.net> writes:
> > and (2) an Ada-style library directory containing the .ali and .o
> > files for the Ada bindings which is at
>
> >   /usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplotadad.dir
>
> This looks like the directory where the library (I think it'll be a
> static library, libplplotadad.a, by default) is initially compiled
> before the .ali files and the constructed .a are moved to the proper
> place.

Good guess. But it is a .dylib and is a couple directories up. There
is no libplplotadad.a on my computer, so obviously it was built
without the default static. However, the .o and .ali _are_ in this
directory, plplotadad.dir, before being installed elsewhere.

> > Note that the PLplot_Library_2 uses
>
> >   for Library_Dir use "/usr/local/plplot/lib/ada/adalib/plplotadad";
>
> > which contains the bindings' .ali files but not .o files--this worked
> > for 2010 but seems to be a problem for 2011.
>
> This looks like the target directory, which should contain a single .a
> and no .o's.

It contains only .ali files, no .a or .dylib. (As I said, setting
Library_Dir here worked for the 2010 GPL. I thought it looked funny at
the time but it worked so I never thought about it again, until now.

> > In one of my attempts, the process aborted, asking for the sources for
> > the Ada bindings. Why would sources be required for a pre-built
> > library?
>
> In the same way as the sources to the standard library are needed; the
> .ali files are only a partial representation of the source, the full
> source is needed to compile against.

But I was asked for sources to complete the linking. (I' pretty sure--
I might have misread this--if the process didn't find any .ali then it
also would ask for sources for compilation.)

> > Now, using the 2011 edition, using the below project files which work
> > for 2010, the process fails with
>
> >   gcc: /usr/local/plplot/lib/ada/adalib/plplotadad//libplplotadad.a:
> > No such file or directory
>
> I don't know why this should have changed.

I don't either, which is why I got confused. I can (and have, a few
times) reverted everything back to the 2010 GPL and PLplot_Library_2
as described and it really does work without any .dylib or .a in
  /usr/local/plplot/lib/ada/adalib/plplotadad

> You've shown us three .gpr files, but I'd expect there to be a fourth,
> which tells gprbuild how to build libplplotadad.a.

The PLplot guys with their cmake smarts use gnatmake to make
libplplotadad.dylib. So I would guess it's in their largs rather than
another .gpr.

So here's the good news. I moved

  /usr/local/plplot/lib/libplplotadad.0.0.0.dylib
  /usr/local/plplot/lib/libplplotadad.0.dylib
  /usr/local/plplot/lib/libplplotadad.dylib

to

  /usr/local/plplot/lib/ada/adalib/plplotadad

which also contains the .ali files (and nothing else), and the link
succeeded. Thanks for pointing me in this direction.

The 2010 mystery notwithstanding, I think the problem is solved. I'll
tell the PLplot team to move the .dylib and its symlinks to the other
directory and we should be done.

Thanks once again, Simon.

Jerry



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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-08  4:02   ` Jerry
@ 2012-05-09  7:36     ` Simon Wright
  2012-05-10  1:19       ` Jerry
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2012-05-09  7:36 UTC (permalink / raw)


Jerry <lanceboyle@qwest.net> writes:

> Thanks once again, Simon.

Glad to be of help (not that I'm quite sure _how_! it all seems very
mysterious ...)



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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-09  7:36     ` Simon Wright
@ 2012-05-10  1:19       ` Jerry
  2012-05-10  7:26         ` Ludovic Brenta
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry @ 2012-05-10  1:19 UTC (permalink / raw)


On May 9, 12:36 am, Simon Wright <si...@pushface.org> wrote:
> Glad to be of help (not that I'm quite sure _how_! it all seems very
> mysterious ...)

You clued me in that the .ali's and .dylib need to be in the same
library.

But here is another question, to which I can't find the answer in any
docs:

In the PLplot build directory, there is a directory that contains all
the .ali and .o files for the Ada bindings. (I know, they should be in
the installation directory, but I don't think that affects my
question. The current installation directory has a directory that
contains only .alis but no .o's. I can fix this later.)

So, knowing that all the .ali's and .o's are here:

/usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplotadad.dir

how do I make a .gpr file to describe this? What strings do I use for
Library_Dir and Library_Name? I suppose it will look something like
this:


library project PLplot_Library_2 is
	for Externally_Built use "true";
	for Source_Dirs use ("/usr/local/plplot/share/ada/adainclude/
plplotadad");
    for Library_Dir use "/usr/local/plplot_build_dir/bindings/ada/
CMakeFiles/";
    for Library_Name use "plplotadad.dir";
end PLplot_Library_2;


Jerry



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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-10  1:19       ` Jerry
@ 2012-05-10  7:26         ` Ludovic Brenta
  2012-05-11  1:01           ` Jerry
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Brenta @ 2012-05-10  7:26 UTC (permalink / raw)


Jerry wrote on comp.lang.ada:
> You clued me in that the .ali's and .dylib need to be in the same
> library.

They don't have to.  The .dylib must be in the Library_Dir, the
.ali files must be in the Library_ALI_Dir. By default these two
directories are the same but you can choose to make them different.
See the Debian Policy for Ada for an example; the .ali files are,
per policy section 5.3.6, in /usr/lib/ada/adalib/$LIBRARY and the
shared libraries are in /usr/lib.

http://people.debian.org/~lbrenta/debian-ada-policy.html

This document is likely to answer all your other questions, too.

-- 
Ludovic Brenta.
A pre-plan proactively generates a guideline.



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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-10  7:26         ` Ludovic Brenta
@ 2012-05-11  1:01           ` Jerry
  2012-05-15  6:13             ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry @ 2012-05-11  1:01 UTC (permalink / raw)


On May 10, 12:26 am, Ludovic Brenta <ludo...@ludovic-brenta.org>
wrote:
> Jerry wrote on comp.lang.ada:
>
> > You clued me in that the .ali's and .dylib need to be in the same
> > library.
>
> They don't have to.  The .dylib must be in the Library_Dir, the
> .ali files must be in the Library_ALI_Dir. By default these two
> directories are the same but you can choose to make them different.

Great! This is what I needed. Many thanks. My problem seems to be
solved. I don't know why the 2010 GPL worked with my (then)
defective .gpr file. The only thing that I can figure out is that
the .ali(s) was (were) referencing the .dylib because I certainly
wasn't doing so in my .gpr. I did get an indication that the file
format for .ali's had changed, so maybe that was it.

> See the Debian Policy for Ada for an example; the .ali files are,
> per policy section 5.3.6, in /usr/lib/ada/adalib/$LIBRARY and the
> shared libraries are in /usr/lib.
>
> http://people.debian.org/~lbrenta/debian-ada-policy.html
>
> This document is likely to answer all your other questions, too.

That's a good reference--very informative.

Jerry
>
> --
> Ludovic Brenta.
> A pre-plan proactively generates a guideline.




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

* Re: gprbuild worked for GNAT GPL 2010, fails for 2011 edition
  2012-05-11  1:01           ` Jerry
@ 2012-05-15  6:13             ` Simon Wright
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Wright @ 2012-05-15  6:13 UTC (permalink / raw)


Jerry <lanceboyle@qwest.net> writes:

> Great! This is what I needed. Many thanks. My problem seems to be
> solved.

Good!

>          I don't know why the 2010 GPL worked with my (then)
> defective .gpr file. The only thing that I can figure out is that
> the .ali(s) was (were) referencing the .dylib because I certainly
> wasn't doing so in my .gpr. I did get an indication that the file
> format for .ali's had changed, so maybe that was it.

I doubt that was it. Hmm.



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

end of thread, other threads:[~2012-05-15  6:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-05  1:08 gprbuild worked for GNAT GPL 2010, fails for 2011 edition Jerry
2012-05-07  6:10 ` Simon Wright
2012-05-08  4:02   ` Jerry
2012-05-09  7:36     ` Simon Wright
2012-05-10  1:19       ` Jerry
2012-05-10  7:26         ` Ludovic Brenta
2012-05-11  1:01           ` Jerry
2012-05-15  6:13             ` Simon Wright

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