comp.lang.ada
 help / color / mirror / Atom feed
* Question about GNAT gprconfig
@ 2016-03-06  7:59 Zack Boll
  2016-03-06  9:20 ` Dmitry A. Kazakov
  2016-03-06 11:17 ` Simon Wright
  0 siblings, 2 replies; 13+ messages in thread
From: Zack Boll @ 2016-03-06  7:59 UTC (permalink / raw)


Hello,

I recently built a GCC Ada cross-compiler for the PowerPC64 architecture using crosstool-ng.  I can compile my Ada programs fine using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to build with gprbuild and appropriate project files.  I have traced this down to an issue with gprconfig not recognizing my compiler.  

When I run gprconfig --show-targets
I get:
arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from Adacores website)
x86_64-linux-gnu

But I don't see powerpc64-e6500-linux-gnu even though the compiler executable is in my path.  Does anyone know what the issue might be?

Thanks,
Zack


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

* Re: Question about GNAT gprconfig
  2016-03-06  7:59 Question about GNAT gprconfig Zack Boll
@ 2016-03-06  9:20 ` Dmitry A. Kazakov
  2016-03-06 11:17 ` Simon Wright
  1 sibling, 0 replies; 13+ messages in thread
From: Dmitry A. Kazakov @ 2016-03-06  9:20 UTC (permalink / raw)


On 2016-03-06 08:59, Zack Boll wrote:

> I recently built a GCC Ada cross-compiler for the PowerPC64
> architecture using crosstool-ng. I can compile my Ada programs fine
> using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to build
> with gprbuild and appropriate project files. I have traced this down to
> an issue with gprconfig not recognizing my compiler.
>
> When I run gprconfig --show-targets
> I get:
> arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from Adacores website)
> x86_64-linux-gnu
>
> But I don't see powerpc64-e6500-linux-gnu even though the compiler
> executable is in my path. Does anyone know what the issue might be?

What about:

gprconfig --config Ada,,,<compiler-bin-path>,<compiler-name-if-not-gcc>

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

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

* Re: Question about GNAT gprconfig
  2016-03-06  7:59 Question about GNAT gprconfig Zack Boll
  2016-03-06  9:20 ` Dmitry A. Kazakov
@ 2016-03-06 11:17 ` Simon Wright
  2016-03-06 22:26   ` Zack Boll
  1 sibling, 1 reply; 13+ messages in thread
From: Simon Wright @ 2016-03-06 11:17 UTC (permalink / raw)


Zack Boll <zackboll@gmail.com> writes:

> I recently built a GCC Ada cross-compiler for the PowerPC64
> architecture using crosstool-ng.  I can compile my Ada programs fine
> using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> build with gprbuild and appropriate project files.  I have traced this
> down to an issue with gprconfig not recognizing my compiler.
>
> When I run gprconfig --show-targets
> I get:
> arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> Adacores website)
> x86_64-linux-gnu
>
> But I don't see powerpc64-e6500-linux-gnu even though the compiler
> executable is in my path.  Does anyone know what the issue might be?

I think that gprconfig's compiler description file (at
$prefix/share/gprconfig/compilers.xml) doesn't recognise your target.

You could edit that file directly; might be better to start by writing a
description just for your compiler, starting just from the GNAT section
at about line 687,

<?xml version="1.0" ?>
<gprconfig>
  <compiler_description>
    <name>GNAT-PPC64</name>
    <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
    <version>
      <external>${PREFIX}gnatls -v --version</external>
      <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
    </version>
    <languages>Ada</languages>
    <variable name="gcc_version">
      <external>${PREFIX}gcc -v</external>
      <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
    </variable>
    <runtimes default="default,kernel,native">
       <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
       <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
       <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
       <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
    </runtimes>
    <target>
      <external>${PREFIX}gcc -dumpmachine</external>
      <grep regexp="[^\r\n]+"></grep>
    </target>
  </compiler_description>
</gprconfig>

(not sure you need all of the <runtimes/> section) and put this in
x-compilers.xml alongside the original compilers.xml (or locally, using
the gprbuild --db switch).

You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
GPR.

If this works, you'll probably want to add sections for C, C++, ASM.


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

* Re: Question about GNAT gprconfig
  2016-03-06 11:17 ` Simon Wright
@ 2016-03-06 22:26   ` Zack Boll
  2016-03-07  0:11     ` Zack Boll
  0 siblings, 1 reply; 13+ messages in thread
From: Zack Boll @ 2016-03-06 22:26 UTC (permalink / raw)


On Sunday, March 6, 2016 at 6:17:17 AM UTC-5, Simon Wright wrote:
> Zack Boll <zackboll@gmail.com> writes:
> 
> > I recently built a GCC Ada cross-compiler for the PowerPC64
> > architecture using crosstool-ng.  I can compile my Ada programs fine
> > using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> > build with gprbuild and appropriate project files.  I have traced this
> > down to an issue with gprconfig not recognizing my compiler.
> >
> > When I run gprconfig --show-targets
> > I get:
> > arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> > Adacores website)
> > x86_64-linux-gnu
> >
> > But I don't see powerpc64-e6500-linux-gnu even though the compiler
> > executable is in my path.  Does anyone know what the issue might be?
> 
> I think that gprconfig's compiler description file (at
> $prefix/share/gprconfig/compilers.xml) doesn't recognise your target.
> 
> You could edit that file directly; might be better to start by writing a
> description just for your compiler, starting just from the GNAT section
> at about line 687,
> 
> <?xml version="1.0" ?>
> <gprconfig>
>   <compiler_description>
>     <name>GNAT-PPC64</name>
>     <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
>     <version>
>       <external>${PREFIX}gnatls -v --version</external>
>       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
>     </version>
>     <languages>Ada</languages>
>     <variable name="gcc_version">
>       <external>${PREFIX}gcc -v</external>
>       <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
>     </variable>
>     <runtimes default="default,kernel,native">
>        <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
>        <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
>        <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
>        <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
>     </runtimes>
>     <target>
>       <external>${PREFIX}gcc -dumpmachine</external>
>       <grep regexp="[^\r\n]+"></grep>
>     </target>
>   </compiler_description>
> </gprconfig>
> 
> (not sure you need all of the <runtimes/> section) and put this in
> x-compilers.xml alongside the original compilers.xml (or locally, using
> the gprbuild --db switch).
> 
> You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
> command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
> GPR.
> 
> If this works, you'll probably want to add sections for C, C++, ASM.

Thanks, I was able to edit the existing GNAT line to support powerpc64-linux as a target.  Hopefully I will be able to get C and C++ building correctly with gprbuild.


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

* Re: Question about GNAT gprconfig
  2016-03-06 22:26   ` Zack Boll
@ 2016-03-07  0:11     ` Zack Boll
  2016-03-07  1:33       ` Zack Boll
  0 siblings, 1 reply; 13+ messages in thread
From: Zack Boll @ 2016-03-07  0:11 UTC (permalink / raw)


On Sunday, March 6, 2016 at 5:26:20 PM UTC-5, Zack Boll wrote:
> On Sunday, March 6, 2016 at 6:17:17 AM UTC-5, Simon Wright wrote:
> > Zack Boll <zackboll@gmail.com> writes:
> > 
> > > I recently built a GCC Ada cross-compiler for the PowerPC64
> > > architecture using crosstool-ng.  I can compile my Ada programs fine
> > > using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> > > build with gprbuild and appropriate project files.  I have traced this
> > > down to an issue with gprconfig not recognizing my compiler.
> > >
> > > When I run gprconfig --show-targets
> > > I get:
> > > arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> > > Adacores website)
> > > x86_64-linux-gnu
> > >
> > > But I don't see powerpc64-e6500-linux-gnu even though the compiler
> > > executable is in my path.  Does anyone know what the issue might be?
> > 
> > I think that gprconfig's compiler description file (at
> > $prefix/share/gprconfig/compilers.xml) doesn't recognise your target.
> > 
> > You could edit that file directly; might be better to start by writing a
> > description just for your compiler, starting just from the GNAT section
> > at about line 687,
> > 
> > <?xml version="1.0" ?>
> > <gprconfig>
> >   <compiler_description>
> >     <name>GNAT-PPC64</name>
> >     <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
> >     <version>
> >       <external>${PREFIX}gnatls -v --version</external>
> >       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
> >     </version>
> >     <languages>Ada</languages>
> >     <variable name="gcc_version">
> >       <external>${PREFIX}gcc -v</external>
> >       <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
> >     </variable>
> >     <runtimes default="default,kernel,native">
> >        <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
> >        <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
> >        <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
> >        <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
> >     </runtimes>
> >     <target>
> >       <external>${PREFIX}gcc -dumpmachine</external>
> >       <grep regexp="[^\r\n]+"></grep>
> >     </target>
> >   </compiler_description>
> > </gprconfig>
> > 
> > (not sure you need all of the <runtimes/> section) and put this in
> > x-compilers.xml alongside the original compilers.xml (or locally, using
> > the gprbuild --db switch).
> > 
> > You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
> > command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
> > GPR.
> > 
> > If this works, you'll probably want to add sections for C, C++, ASM.
> 
> Thanks, I was able to edit the existing GNAT line to support powerpc64-linux as a target.  Hopefully I will be able to get C and C++ building correctly with gprbuild.

I seem to be having trouble getting my hello world C++ program to compile with gprbuild.  I think it is trying to use the x86_64 version of "ar".  Below is my output from gprbuild with the "-v" flag.

gprbuild --target=powerpc64-e6500-linux-gnu -v -d -P/project/hello_world_cpp/hello_world_cpp.gpr -XADA_DIALECT=Ada_2012 -XARCHITECTURE=PowerPC64_Linux -XBUILD_FLAGS=Optimize -XELABORATION_CHECKS=Static -XCOMPILER_MULTIPROCESS=8 -XDEBUG_TARGET=local hello_world.cpp -s -j6
GPRBUILD GPL 2015 (20150428) (x86_64-pc-linux-gnu)
Copyright (C) 2004-2015, Free Software Foundation, Inc.
 18 lines: No errors
gprconfig --batch -o /project/hello_world_cpp/auto.cgpr --target=powerpc64-e6500-linux-gnu --config=c++,,,,powerpc64-e6500-linux-gnu-g++ --config=ada,,,,powerpc64-e6500-linux-gnu-gnatmake
Creating configuration file: /project/hello_world_cpp/auto.cgpr
Checking configuration /project/hello_world_cpp/auto.cgpr
   Checking /project/hello_world_cpp/hello_world.cpp ...
      -> object file /project/hello_world_cpp/hello_world.o does not exist
Changing to object directory of "hello_world_cpp": "/project/hello_world_cpp/"
/tools/gnat/powerpc64-e6500-linux-gnu/bin/powerpc64-e6500-linux-gnu-g++ -mtune=e6500 -mlongcall -mpowerpc -maltivec /project/hello_world_cpp/hello_world.cpp
   Checking /project/common/dummy_common.adb ...
   Checking binder generated files for hello_world.cpp...
      -> up to date
   Checking libhello_world_cpp.a ...
      -> archive does not exist
/tools/gnat/x86_64_gpl/bin/ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
/tools/gnat/x86_64_gpl/bin/ar: /project/hello_world_cpp/hello_world.o: No such file or directory
global archive for project hello_world_cpp could not be built
gprbuild: link of hello_world.cpp failed
[2016-03-06 19:04:50] process exited with status 4, 100% (2/2), elapsed time: 00.42s

Below is the C++ compiler I defined in the compilers.xml file.
  <!-- G++ for GNU Linux -->
  <compiler_description>
  <name>G++-PPC64</name>
  <executable prefix="1">(powerpc64-e6500-linux-gnu)-g\+\+</executable>
  <version>
      <external>${PREFIX}-g++ -v</external>
      <nogrep regexp="for GNAT Pro"></nogrep>
      <grep regexp="^gcc \S+ (\S+)" group="1"></grep>    
  </version>
  <languages>C++</languages>
  <target>
    <external>${PREFIX}-g++ -dumpmachine</external>
      <grep regexp="[^\r\n]+"></grep>
    </target>
  </compiler_description>


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

* Re: Question about GNAT gprconfig
  2016-03-07  0:11     ` Zack Boll
@ 2016-03-07  1:33       ` Zack Boll
  2016-03-07  4:51         ` Zack Boll
  0 siblings, 1 reply; 13+ messages in thread
From: Zack Boll @ 2016-03-07  1:33 UTC (permalink / raw)


On Sunday, March 6, 2016 at 7:11:49 PM UTC-5, Zack Boll wrote:
> On Sunday, March 6, 2016 at 5:26:20 PM UTC-5, Zack Boll wrote:
> > On Sunday, March 6, 2016 at 6:17:17 AM UTC-5, Simon Wright wrote:
> > > Zack Boll <zackboll@gmail.com> writes:
> > > 
> > > > I recently built a GCC Ada cross-compiler for the PowerPC64
> > > > architecture using crosstool-ng.  I can compile my Ada programs fine
> > > > using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> > > > build with gprbuild and appropriate project files.  I have traced this
> > > > down to an issue with gprconfig not recognizing my compiler.
> > > >
> > > > When I run gprconfig --show-targets
> > > > I get:
> > > > arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> > > > Adacores website)
> > > > x86_64-linux-gnu
> > > >
> > > > But I don't see powerpc64-e6500-linux-gnu even though the compiler
> > > > executable is in my path.  Does anyone know what the issue might be?
> > > 
> > > I think that gprconfig's compiler description file (at
> > > $prefix/share/gprconfig/compilers.xml) doesn't recognise your target.
> > > 
> > > You could edit that file directly; might be better to start by writing a
> > > description just for your compiler, starting just from the GNAT section
> > > at about line 687,
> > > 
> > > <?xml version="1.0" ?>
> > > <gprconfig>
> > >   <compiler_description>
> > >     <name>GNAT-PPC64</name>
> > >     <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
> > >     <version>
> > >       <external>${PREFIX}gnatls -v --version</external>
> > >       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
> > >     </version>
> > >     <languages>Ada</languages>
> > >     <variable name="gcc_version">
> > >       <external>${PREFIX}gcc -v</external>
> > >       <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
> > >     </variable>
> > >     <runtimes default="default,kernel,native">
> > >        <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
> > >        <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
> > >        <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
> > >        <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
> > >     </runtimes>
> > >     <target>
> > >       <external>${PREFIX}gcc -dumpmachine</external>
> > >       <grep regexp="[^\r\n]+"></grep>
> > >     </target>
> > >   </compiler_description>
> > > </gprconfig>
> > > 
> > > (not sure you need all of the <runtimes/> section) and put this in
> > > x-compilers.xml alongside the original compilers.xml (or locally, using
> > > the gprbuild --db switch).
> > > 
> > > You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
> > > command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
> > > GPR.
> > > 
> > > If this works, you'll probably want to add sections for C, C++, ASM.
> > 
> > Thanks, I was able to edit the existing GNAT line to support powerpc64-linux as a target.  Hopefully I will be able to get C and C++ building correctly with gprbuild.
> 
> I seem to be having trouble getting my hello world C++ program to compile with gprbuild.  I think it is trying to use the x86_64 version of "ar".  Below is my output from gprbuild with the "-v" flag.
> 
> gprbuild --target=powerpc64-e6500-linux-gnu -v -d -P/project/hello_world_cpp/hello_world_cpp.gpr -XADA_DIALECT=Ada_2012 -XARCHITECTURE=PowerPC64_Linux -XBUILD_FLAGS=Optimize -XELABORATION_CHECKS=Static -XCOMPILER_MULTIPROCESS=8 -XDEBUG_TARGET=local hello_world.cpp -s -j6
> GPRBUILD GPL 2015 (20150428) (x86_64-pc-linux-gnu)
> Copyright (C) 2004-2015, Free Software Foundation, Inc.
>  18 lines: No errors
> gprconfig --batch -o /project/hello_world_cpp/auto.cgpr --target=powerpc64-e6500-linux-gnu --config=c++,,,,powerpc64-e6500-linux-gnu-g++ --config=ada,,,,powerpc64-e6500-linux-gnu-gnatmake
> Creating configuration file: /project/hello_world_cpp/auto.cgpr
> Checking configuration /project/hello_world_cpp/auto.cgpr
>    Checking /project/hello_world_cpp/hello_world.cpp ...
>       -> object file /project/hello_world_cpp/hello_world.o does not exist
> Changing to object directory of "hello_world_cpp": "/project/hello_world_cpp/"
> /tools/gnat/powerpc64-e6500-linux-gnu/bin/powerpc64-e6500-linux-gnu-g++ -mtune=e6500 -mlongcall -mpowerpc -maltivec /project/hello_world_cpp/hello_world.cpp
>    Checking /project/common/dummy_common.adb ...
>    Checking binder generated files for hello_world.cpp...
>       -> up to date
>    Checking libhello_world_cpp.a ...
>       -> archive does not exist
> /tools/gnat/x86_64_gpl/bin/ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
> /tools/gnat/x86_64_gpl/bin/ar: /project/hello_world_cpp/hello_world.o: No such file or directory
> global archive for project hello_world_cpp could not be built
> gprbuild: link of hello_world.cpp failed
> [2016-03-06 19:04:50] process exited with status 4, 100% (2/2), elapsed time: 00.42s
> 
> Below is the C++ compiler I defined in the compilers.xml file.
>   <!-- G++ for GNU Linux -->
>   <compiler_description>
>   <name>G++-PPC64</name>
>   <executable prefix="1">(powerpc64-e6500-linux-gnu)-g\+\+</executable>
>   <version>
>       <external>${PREFIX}-g++ -v</external>
>       <nogrep regexp="for GNAT Pro"></nogrep>
>       <grep regexp="^gcc \S+ (\S+)" group="1"></grep>    
>   </version>
>   <languages>C++</languages>
>   <target>
>     <external>${PREFIX}-g++ -dumpmachine</external>
>       <grep regexp="[^\r\n]+"></grep>
>     </target>
>   </compiler_description>

I have tried adding 

  PowerPC64_Linux_Archiver        := "powerpc64-e6500-linux-gnu-ar";
  PowerPC64_Linux_Archive_Indexer := "powerpc64-e6500-linux-gnu-ranlib";

  for Archive_Builder use (PowerPC64_Linux_Archiver, "cr");
  for Archive_Indexer use (PowerPC64_Linux_Archive_Indexer);

but that does not resolve my issue.  Does anyone have an idea what I am doing wrong?

Thanks,
Zack

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

* Re: Question about GNAT gprconfig
  2016-03-07  1:33       ` Zack Boll
@ 2016-03-07  4:51         ` Zack Boll
  2016-03-07  5:35           ` Zack Boll
  0 siblings, 1 reply; 13+ messages in thread
From: Zack Boll @ 2016-03-07  4:51 UTC (permalink / raw)


On Sunday, March 6, 2016 at 8:33:22 PM UTC-5, Zack Boll wrote:
> On Sunday, March 6, 2016 at 7:11:49 PM UTC-5, Zack Boll wrote:
> > On Sunday, March 6, 2016 at 5:26:20 PM UTC-5, Zack Boll wrote:
> > > On Sunday, March 6, 2016 at 6:17:17 AM UTC-5, Simon Wright wrote:
> > > > Zack Boll <zackboll@gmail.com> writes:
> > > > 
> > > > > I recently built a GCC Ada cross-compiler for the PowerPC64
> > > > > architecture using crosstool-ng.  I can compile my Ada programs fine
> > > > > using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> > > > > build with gprbuild and appropriate project files.  I have traced this
> > > > > down to an issue with gprconfig not recognizing my compiler.
> > > > >
> > > > > When I run gprconfig --show-targets
> > > > > I get:
> > > > > arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> > > > > Adacores website)
> > > > > x86_64-linux-gnu
> > > > >
> > > > > But I don't see powerpc64-e6500-linux-gnu even though the compiler
> > > > > executable is in my path.  Does anyone know what the issue might be?
> > > > 
> > > > I think that gprconfig's compiler description file (at
> > > > $prefix/share/gprconfig/compilers.xml) doesn't recognise your target.
> > > > 
> > > > You could edit that file directly; might be better to start by writing a
> > > > description just for your compiler, starting just from the GNAT section
> > > > at about line 687,
> > > > 
> > > > <?xml version="1.0" ?>
> > > > <gprconfig>
> > > >   <compiler_description>
> > > >     <name>GNAT-PPC64</name>
> > > >     <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
> > > >     <version>
> > > >       <external>${PREFIX}gnatls -v --version</external>
> > > >       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
> > > >     </version>
> > > >     <languages>Ada</languages>
> > > >     <variable name="gcc_version">
> > > >       <external>${PREFIX}gcc -v</external>
> > > >       <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
> > > >     </variable>
> > > >     <runtimes default="default,kernel,native">
> > > >        <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
> > > >        <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
> > > >        <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
> > > >        <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
> > > >     </runtimes>
> > > >     <target>
> > > >       <external>${PREFIX}gcc -dumpmachine</external>
> > > >       <grep regexp="[^\r\n]+"></grep>
> > > >     </target>
> > > >   </compiler_description>
> > > > </gprconfig>
> > > > 
> > > > (not sure you need all of the <runtimes/> section) and put this in
> > > > x-compilers.xml alongside the original compilers.xml (or locally, using
> > > > the gprbuild --db switch).
> > > > 
> > > > You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
> > > > command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
> > > > GPR.
> > > > 
> > > > If this works, you'll probably want to add sections for C, C++, ASM.
> > > 
> > > Thanks, I was able to edit the existing GNAT line to support powerpc64-linux as a target.  Hopefully I will be able to get C and C++ building correctly with gprbuild.
> > 
> > I seem to be having trouble getting my hello world C++ program to compile with gprbuild.  I think it is trying to use the x86_64 version of "ar".  Below is my output from gprbuild with the "-v" flag.
> > 
> > gprbuild --target=powerpc64-e6500-linux-gnu -v -d -P/project/hello_world_cpp/hello_world_cpp.gpr -XADA_DIALECT=Ada_2012 -XARCHITECTURE=PowerPC64_Linux -XBUILD_FLAGS=Optimize -XELABORATION_CHECKS=Static -XCOMPILER_MULTIPROCESS=8 -XDEBUG_TARGET=local hello_world.cpp -s -j6
> > GPRBUILD GPL 2015 (20150428) (x86_64-pc-linux-gnu)
> > Copyright (C) 2004-2015, Free Software Foundation, Inc.
> >  18 lines: No errors
> > gprconfig --batch -o /project/hello_world_cpp/auto.cgpr --target=powerpc64-e6500-linux-gnu --config=c++,,,,powerpc64-e6500-linux-gnu-g++ --config=ada,,,,powerpc64-e6500-linux-gnu-gnatmake
> > Creating configuration file: /project/hello_world_cpp/auto.cgpr
> > Checking configuration /project/hello_world_cpp/auto.cgpr
> >    Checking /project/hello_world_cpp/hello_world.cpp ...
> >       -> object file /project/hello_world_cpp/hello_world.o does not exist
> > Changing to object directory of "hello_world_cpp": "/project/hello_world_cpp/"
> > /tools/gnat/powerpc64-e6500-linux-gnu/bin/powerpc64-e6500-linux-gnu-g++ -mtune=e6500 -mlongcall -mpowerpc -maltivec /project/hello_world_cpp/hello_world.cpp
> >    Checking /project/common/dummy_common.adb ...
> >    Checking binder generated files for hello_world.cpp...
> >       -> up to date
> >    Checking libhello_world_cpp.a ...
> >       -> archive does not exist
> > /tools/gnat/x86_64_gpl/bin/ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
> > /tools/gnat/x86_64_gpl/bin/ar: /project/hello_world_cpp/hello_world.o: No such file or directory
> > global archive for project hello_world_cpp could not be built
> > gprbuild: link of hello_world.cpp failed
> > [2016-03-06 19:04:50] process exited with status 4, 100% (2/2), elapsed time: 00.42s
> > 
> > Below is the C++ compiler I defined in the compilers.xml file.
> >   <!-- G++ for GNU Linux -->
> >   <compiler_description>
> >   <name>G++-PPC64</name>
> >   <executable prefix="1">(powerpc64-e6500-linux-gnu)-g\+\+</executable>
> >   <version>
> >       <external>${PREFIX}-g++ -v</external>
> >       <nogrep regexp="for GNAT Pro"></nogrep>
> >       <grep regexp="^gcc \S+ (\S+)" group="1"></grep>    
> >   </version>
> >   <languages>C++</languages>
> >   <target>
> >     <external>${PREFIX}-g++ -dumpmachine</external>
> >       <grep regexp="[^\r\n]+"></grep>
> >     </target>
> >   </compiler_description>
> 
> I have tried adding 
> 
>   PowerPC64_Linux_Archiver        := "powerpc64-e6500-linux-gnu-ar";
>   PowerPC64_Linux_Archive_Indexer := "powerpc64-e6500-linux-gnu-ranlib";
> 
>   for Archive_Builder use (PowerPC64_Linux_Archiver, "cr");
>   for Archive_Indexer use (PowerPC64_Linux_Archive_Indexer);
> 
> but that does not resolve my issue.  Does anyone have an idea what I am doing wrong?
> 
> Thanks,
> Zack

I confirmed what the issue is, but I am not sure how to fix it.  Basically, the wrong "ar" and "ranlib" executables are being called by gprbuild.  I am a little stumped how to fix this one (I already tried Archive_Builder and Archive_Indexer attributes, but if I run the 3 commands on the command line with the correct ar and ranlib, I get a correct executable.

1.) powerpc64-e6500-linux-gnu-ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
2.) powerpc64-e6500-linux-gnu-ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
3.) powerpc64-e6500-linux-gnu-g++ hello_world.o b__hello_world.o /project/common/dummy_common.o libhello_world_cpp.a -L/project/common/ -L/project/hello_world_cpp/ -L/project/common/ -L/tools/gnat/powerpc64-e6500-linux-gnu/lib/gcc/powerpc64-e6500-linux-gnu/5.3.0/adalib/ /tools/gnat/powerpc64-e6500-linux-gnu/lib/gcc/powerpc64-e6500-linux-gnu/5.3.0/adalib/libgnat.a -shared-libgcc -Wl,-z,origin,-rpath,$ORIGIN/../../../tools/gnat/powerpc64-e6500-linux-gnu/lib -o hello_world


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

* Re: Question about GNAT gprconfig
  2016-03-07  4:51         ` Zack Boll
@ 2016-03-07  5:35           ` Zack Boll
  2016-03-07  8:28             ` Dmitry A. Kazakov
  2016-03-07  8:31             ` Simon Wright
  0 siblings, 2 replies; 13+ messages in thread
From: Zack Boll @ 2016-03-07  5:35 UTC (permalink / raw)


On Sunday, March 6, 2016 at 11:51:42 PM UTC-5, Zack Boll wrote:
> On Sunday, March 6, 2016 at 8:33:22 PM UTC-5, Zack Boll wrote:
> > On Sunday, March 6, 2016 at 7:11:49 PM UTC-5, Zack Boll wrote:
> > > On Sunday, March 6, 2016 at 5:26:20 PM UTC-5, Zack Boll wrote:
> > > > On Sunday, March 6, 2016 at 6:17:17 AM UTC-5, Simon Wright wrote:
> > > > > Zack Boll <zackboll@gmail.com> writes:
> > > > > 
> > > > > > I recently built a GCC Ada cross-compiler for the PowerPC64
> > > > > > architecture using crosstool-ng.  I can compile my Ada programs fine
> > > > > > using powerpc64-e6500-linux-gnu-gnatmake but I have been unable to
> > > > > > build with gprbuild and appropriate project files.  I have traced this
> > > > > > down to an issue with gprconfig not recognizing my compiler.
> > > > > >
> > > > > > When I run gprconfig --show-targets
> > > > > > I get:
> > > > > > arm-linux-gnueabihf (Raspberry Pi2 Cross Compiler downloaded from
> > > > > > Adacores website)
> > > > > > x86_64-linux-gnu
> > > > > >
> > > > > > But I don't see powerpc64-e6500-linux-gnu even though the compiler
> > > > > > executable is in my path.  Does anyone know what the issue might be?
> > > > > 
> > > > > I think that gprconfig's compiler description file (at
> > > > > $prefix/share/gprconfig/compilers.xml) doesn't recognise your target.
> > > > > 
> > > > > You could edit that file directly; might be better to start by writing a
> > > > > description just for your compiler, starting just from the GNAT section
> > > > > at about line 687,
> > > > > 
> > > > > <?xml version="1.0" ?>
> > > > > <gprconfig>
> > > > >   <compiler_description>
> > > > >     <name>GNAT-PPC64</name>
> > > > >     <executable prefix="1">(powerpc64-e6500-linux-gnu-)?gnatmake</executable>
> > > > >     <version>
> > > > >       <external>${PREFIX}gnatls -v --version</external>
> > > > >       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
> > > > >     </version>
> > > > >     <languages>Ada</languages>
> > > > >     <variable name="gcc_version">
> > > > >       <external>${PREFIX}gcc -v</external>
> > > > >       <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
> > > > >     </variable>
> > > > >     <runtimes default="default,kernel,native">
> > > > >        <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
> > > > >        <directory group="default" contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
> > > > >        <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
> > > > >        <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
> > > > >     </runtimes>
> > > > >     <target>
> > > > >       <external>${PREFIX}gcc -dumpmachine</external>
> > > > >       <grep regexp="[^\r\n]+"></grep>
> > > > >     </target>
> > > > >   </compiler_description>
> > > > > </gprconfig>
> > > > > 
> > > > > (not sure you need all of the <runtimes/> section) and put this in
> > > > > x-compilers.xml alongside the original compilers.xml (or locally, using
> > > > > the gprbuild --db switch).
> > > > > 
> > > > > You'll still need to specify --target=powerpc64-e6500-linux-gnu on the
> > > > > command line, or for Target use "powerpc64-e6500-linux-gnu"; in your
> > > > > GPR.
> > > > > 
> > > > > If this works, you'll probably want to add sections for C, C++, ASM.
> > > > 
> > > > Thanks, I was able to edit the existing GNAT line to support powerpc64-linux as a target.  Hopefully I will be able to get C and C++ building correctly with gprbuild.
> > > 
> > > I seem to be having trouble getting my hello world C++ program to compile with gprbuild.  I think it is trying to use the x86_64 version of "ar".  Below is my output from gprbuild with the "-v" flag.
> > > 
> > > gprbuild --target=powerpc64-e6500-linux-gnu -v -d -P/project/hello_world_cpp/hello_world_cpp.gpr -XADA_DIALECT=Ada_2012 -XARCHITECTURE=PowerPC64_Linux -XBUILD_FLAGS=Optimize -XELABORATION_CHECKS=Static -XCOMPILER_MULTIPROCESS=8 -XDEBUG_TARGET=local hello_world.cpp -s -j6
> > > GPRBUILD GPL 2015 (20150428) (x86_64-pc-linux-gnu)
> > > Copyright (C) 2004-2015, Free Software Foundation, Inc.
> > >  18 lines: No errors
> > > gprconfig --batch -o /project/hello_world_cpp/auto.cgpr --target=powerpc64-e6500-linux-gnu --config=c++,,,,powerpc64-e6500-linux-gnu-g++ --config=ada,,,,powerpc64-e6500-linux-gnu-gnatmake
> > > Creating configuration file: /project/hello_world_cpp/auto.cgpr
> > > Checking configuration /project/hello_world_cpp/auto.cgpr
> > >    Checking /project/hello_world_cpp/hello_world.cpp ...
> > >       -> object file /project/hello_world_cpp/hello_world.o does not exist
> > > Changing to object directory of "hello_world_cpp": "/project/hello_world_cpp/"
> > > /tools/gnat/powerpc64-e6500-linux-gnu/bin/powerpc64-e6500-linux-gnu-g++ -mtune=e6500 -mlongcall -mpowerpc -maltivec /project/hello_world_cpp/hello_world.cpp
> > >    Checking /project/common/dummy_common.adb ...
> > >    Checking binder generated files for hello_world.cpp...
> > >       -> up to date
> > >    Checking libhello_world_cpp.a ...
> > >       -> archive does not exist
> > > /tools/gnat/x86_64_gpl/bin/ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
> > > /tools/gnat/x86_64_gpl/bin/ar: /project/hello_world_cpp/hello_world.o: No such file or directory
> > > global archive for project hello_world_cpp could not be built
> > > gprbuild: link of hello_world.cpp failed
> > > [2016-03-06 19:04:50] process exited with status 4, 100% (2/2), elapsed time: 00.42s
> > > 
> > > Below is the C++ compiler I defined in the compilers.xml file.
> > >   <!-- G++ for GNU Linux -->
> > >   <compiler_description>
> > >   <name>G++-PPC64</name>
> > >   <executable prefix="1">(powerpc64-e6500-linux-gnu)-g\+\+</executable>
> > >   <version>
> > >       <external>${PREFIX}-g++ -v</external>
> > >       <nogrep regexp="for GNAT Pro"></nogrep>
> > >       <grep regexp="^gcc \S+ (\S+)" group="1"></grep>    
> > >   </version>
> > >   <languages>C++</languages>
> > >   <target>
> > >     <external>${PREFIX}-g++ -dumpmachine</external>
> > >       <grep regexp="[^\r\n]+"></grep>
> > >     </target>
> > >   </compiler_description>
> > 
> > I have tried adding 
> > 
> >   PowerPC64_Linux_Archiver        := "powerpc64-e6500-linux-gnu-ar";
> >   PowerPC64_Linux_Archive_Indexer := "powerpc64-e6500-linux-gnu-ranlib";
> > 
> >   for Archive_Builder use (PowerPC64_Linux_Archiver, "cr");
> >   for Archive_Indexer use (PowerPC64_Linux_Archive_Indexer);
> > 
> > but that does not resolve my issue.  Does anyone have an idea what I am doing wrong?
> > 
> > Thanks,
> > Zack
> 
> I confirmed what the issue is, but I am not sure how to fix it.  Basically, the wrong "ar" and "ranlib" executables are being called by gprbuild.  I am a little stumped how to fix this one (I already tried Archive_Builder and Archive_Indexer attributes, but if I run the 3 commands on the command line with the correct ar and ranlib, I get a correct executable.
> 
> 1.) powerpc64-e6500-linux-gnu-ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
> 2.) powerpc64-e6500-linux-gnu-ar cr libhello_world_cpp.a /project/hello_world_cpp/hello_world.o
> 3.) powerpc64-e6500-linux-gnu-g++ hello_world.o b__hello_world.o /project/common/dummy_common.o libhello_world_cpp.a -L/project/common/ -L/project/hello_world_cpp/ -L/project/common/ -L/tools/gnat/powerpc64-e6500-linux-gnu/lib/gcc/powerpc64-e6500-linux-gnu/5.3.0/adalib/ /tools/gnat/powerpc64-e6500-linux-gnu/lib/gcc/powerpc64-e6500-linux-gnu/5.3.0/adalib/libgnat.a -shared-libgcc -Wl,-z,origin,-rpath,$ORIGIN/../../../tools/gnat/powerpc64-e6500-linux-gnu/lib -o hello_world

Ok, I finally got it working, I needed to edit linker.xml in shared/gprconfig directory.

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

* Re: Question about GNAT gprconfig
  2016-03-07  5:35           ` Zack Boll
@ 2016-03-07  8:28             ` Dmitry A. Kazakov
  2016-03-08  3:03               ` zackius
  2016-03-07  8:31             ` Simon Wright
  1 sibling, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2016-03-07  8:28 UTC (permalink / raw)


On 07/03/2016 06:35, Zack Boll wrote:
> On Sunday, March 6, 2016 at 11:51:42 PM UTC-5, Zack Boll wrote:
...

> Ok, I finally got it working, I needed to edit linker.xml in shared/gprconfig directory.

BTW, when you compile and build, do you set ENV_PREFIX environment 
variable to the target system root?

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


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

* Re: Question about GNAT gprconfig
  2016-03-07  5:35           ` Zack Boll
  2016-03-07  8:28             ` Dmitry A. Kazakov
@ 2016-03-07  8:31             ` Simon Wright
  1 sibling, 0 replies; 13+ messages in thread
From: Simon Wright @ 2016-03-07  8:31 UTC (permalink / raw)


Zack Boll <zackboll@gmail.com> writes:

> Ok, I finally got it working, I needed to edit linker.xml in
> shared/gprconfig directory.

Good!

(thanks for bottom-posting: but to help those of us who use older
newsreaders like Emacs Gnus, could you quote only the relevant bits of
the message you're replying to? the last one was >150 lines, nested 6
deep!)

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

* Re: Question about GNAT gprconfig
  2016-03-07  8:28             ` Dmitry A. Kazakov
@ 2016-03-08  3:03               ` zackius
  2016-03-08  8:43                 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: zackius @ 2016-03-08  3:03 UTC (permalink / raw)


I do not set env_prefix.  The compilers I builts for raspberrypi3 and powerpc64 appear to work fine, but I have not attempted to run ACATS on it yet.

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

* Re: Question about GNAT gprconfig
  2016-03-08  3:03               ` zackius
@ 2016-03-08  8:43                 ` Dmitry A. Kazakov
  2016-03-13  3:00                   ` Zack Boll
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2016-03-08  8:43 UTC (permalink / raw)


On 08/03/2016 04:03, zackius@gmail.com wrote:
> I do not set env_prefix.  The compilers I builts for raspberrypi3 and
> powerpc64 appear to work fine, but I have not attempted to run ACATS
> on it yet.

It hit me once. When the ENV_PREFIX is not set, I just had pushed needed 
libraries to the GNAT lib directory, the things were compiled OK, but 
there popped subtle errors upon binding and linking, not in hello-world, 
in the real size project. I don't know the exact reason,  AdaCore guys 
told me to set PREFIX and after that everything went perfect.

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

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

* Re: Question about GNAT gprconfig
  2016-03-08  8:43                 ` Dmitry A. Kazakov
@ 2016-03-13  3:00                   ` Zack Boll
  0 siblings, 0 replies; 13+ messages in thread
From: Zack Boll @ 2016-03-13  3:00 UTC (permalink / raw)


> It hit me once. When the ENV_PREFIX is not set, I just had pushed needed 
> libraries to the GNAT lib directory, the things were compiled OK, but 
> there popped subtle errors upon binding and linking, not in hello-world, 
> in the real size project. I don't know the exact reason,  AdaCore guys 
> told me to set PREFIX and after that everything went perfect.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thanks, I had that issue with ENV_PREFIX when testing out a GPL cross-compiler built by Adacore.  I did not need the ENV_PREFIX when building GCC 5.3 with crosstool-ng.

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

end of thread, other threads:[~2016-03-13  3:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-06  7:59 Question about GNAT gprconfig Zack Boll
2016-03-06  9:20 ` Dmitry A. Kazakov
2016-03-06 11:17 ` Simon Wright
2016-03-06 22:26   ` Zack Boll
2016-03-07  0:11     ` Zack Boll
2016-03-07  1:33       ` Zack Boll
2016-03-07  4:51         ` Zack Boll
2016-03-07  5:35           ` Zack Boll
2016-03-07  8:28             ` Dmitry A. Kazakov
2016-03-08  3:03               ` zackius
2016-03-08  8:43                 ` Dmitry A. Kazakov
2016-03-13  3:00                   ` Zack Boll
2016-03-07  8:31             ` Simon Wright

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