From: Zack Boll <zackboll@gmail.com>
Subject: Re: Question about GNAT gprconfig
Date: Sun, 6 Mar 2016 21:35:43 -0800 (PST)
Date: 2016-03-06T21:35:43-08:00 [thread overview]
Message-ID: <a734529a-0d3b-4316-bb48-72c49324bc20@googlegroups.com> (raw)
In-Reply-To: <480c58db-e2d8-4b08-abad-d5c4dd86e3d7@googlegroups.com>
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.
next prev parent reply other threads:[~2016-03-07 5:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox