comp.lang.ada
 help / color / mirror / Atom feed
* Emacs Ada mode with RTS
@ 2015-06-17 18:12 Patrick Noffke
  2015-06-17 21:30 ` Simon Wright
  2015-06-18 15:34 ` Stephen Leake
  0 siblings, 2 replies; 17+ messages in thread
From: Patrick Noffke @ 2015-06-17 18:12 UTC (permalink / raw)


I'm trying to use Emacs Ada mode with a .gpr project file that works with GPS and uses a Ravenscar runtime.  When I compile with GPS or from my own Makefile, I have no problems, but when I compile a file from Emacs using Ada mode's Compile file command, I get an error:

s-osinte.ads:591:07: size for "Address" too small, minimum allowed is 64

This is when it's compiling the "main" file.

It appears that from Ada mode, the system adainclude directory is getting used.  I wrote the .adp project file by hand, using Simon's suggestion from here:
http://sourceforge.net/p/stm32f4-gnat-rts/discussion/general/thread/0ccef570/

But when I edit the project file with the Ada mode GUI (using Ada mode's Project -> Edit command), it shows /usr/lib/gcc/x86_64-redhat-linux/4.9.2/adainclude listed under Source directories.  /usr/lib/gcc/x86_64-redhat-linux/4.9.2/adalib is also listed under Object directories.  These directories do not exist in my .adp file.

gprbuild (and the resulting call to gcc) appear to be called as I expect from within Ada mode, but something must be set up as an environment variable that I'm not seeing in the compilation output window.

Here are some variables from my .adp file:

toolchain_dir=/home/pnoffke/projects/proj1/output/toolchain/gnat/bin
ada_compiler=${toolchain_dir}/arm-eabi-gnat
gpr_file=/home/pnoffke/projects/proj1/proj1.gpr
config_file=/home/pnoffke/projects/proj1/obj/proj1.cgpr
check_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file} --target=arm-eabi --config=${config_file} ${full_current}
make_cmd=PATH=${toolchain_dir}:$PATH ${toolchain_dir}/gprbuild -p --target=arm-eabi -P${gpr_file} --config=${config_file}
comp_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file} --target=arm-eabi --config=${config_file} ${full_current}

The .cgpr file was created using gprconfig (I found this was how GPS works for an RTS project).

Is there a way to have Ada mode not bring in the system directories?

Thanks,
Patrick

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

* Re: Emacs Ada mode with RTS
  2015-06-17 18:12 Emacs Ada mode with RTS Patrick Noffke
@ 2015-06-17 21:30 ` Simon Wright
  2015-06-18 13:48   ` Patrick Noffke
  2015-06-18 15:34 ` Stephen Leake
  1 sibling, 1 reply; 17+ messages in thread
From: Simon Wright @ 2015-06-17 21:30 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> check_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> --target=arm-eabi --config=${config_file} ${full_current}

I've seen this sort of thing before, though not while compiling outside
the RTS itself.

It may have nothing to do with your problem, but when I was getting a
segfault with -gnatc I was told not to use -gnatc in the runtime[1]! So
now I have it set to compile the file instead of doing a check:

   gprbuild -c -u -f -p -P${gpr_file} ${full_current}

Following other hints like this[2] I've asked AdaCore whether they have
a secret list of things that you shouldn't do in the runtime, without
success. Probably sticking to Ada95 language would help.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66162#c3
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64866#c2

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

* Re: Emacs Ada mode with RTS
  2015-06-17 21:30 ` Simon Wright
@ 2015-06-18 13:48   ` Patrick Noffke
  2015-06-18 14:06     ` Simon Wright
  0 siblings, 1 reply; 17+ messages in thread
From: Patrick Noffke @ 2015-06-18 13:48 UTC (permalink / raw)


On Wednesday, June 17, 2015 at 4:30:32 PM UTC-5, Simon Wright wrote:
> Patrick Noffke writes:
> 
> > check_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> > --target=arm-eabi --config=${config_file} ${full_current}
> 
> It may have nothing to do with your problem, but when I was getting a
> segfault with -gnatc I was told not to use -gnatc in the runtime[1]! So
> now I have it set to compile the file instead of doing a check:
> 
>    gprbuild -c -u -f -p -P${gpr_file} ${full_current}
> 

Thanks, Simon.  Removing -gnatc does not help.

Here is the output from within Emacs when doing the Check file command:

/home/pnoffke/projects/proj1/output/toolchain/gnat/bin/gprbuild -f -u -c -p -P/home/pnoffke/projects/proj1/proj1.gpr --target=arm-eabi --config=/home/pnoffke/projects/proj1/obj/proj1.cgpr /home/pnoffke/projects/proj1/src/proj1.adb
warning: --RTS is taken into account only in auto-configuration
arm-eabi-gcc -c -g -gnatwa.X -gnatQ -gnat12 -gnatyO proj1.adb
s-osinte.ads:591:07: size for "Address" too small, minimum allowed is 64
gprbuild: *** compilation phase failed

When I run the same command from a terminal, it succeeds:

/home/pnoffke/projects/proj1/output/toolchain/gnat/bin/gprbuild -f -u -c -p -P/home/pnoffke/projects/proj1/proj1.gpr --target=arm-eabi --config=/home/pnoffke/projects/proj1/obj/proj1.cgpr /home/pnoffke/projects/proj1/src/proj1.adb
warning: --RTS is taken into account only in auto-configuration
arm-eabi-gcc -c -g -gnatwa.X -gnatQ -gnat12 -gnatyO proj1.adb


It's the exact same command, so there must be some environment variable that Ada mode is setting, or maybe some command is run prior whose output isn't shown.

Regards,
Patrick


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

* Re: Emacs Ada mode with RTS
  2015-06-18 13:48   ` Patrick Noffke
@ 2015-06-18 14:06     ` Simon Wright
  2015-06-18 15:09       ` Patrick Noffke
  2015-06-19 13:56       ` Stephen Leake
  0 siblings, 2 replies; 17+ messages in thread
From: Simon Wright @ 2015-06-18 14:06 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> It's the exact same command, so there must be some environment
> variable that Ada mode is setting, or maybe some command is run prior
> whose output isn't shown.

Annoyingly, gprbuild doesn't report all the options it passes to the
compiler. I found that "-cargs -v" helped. You could probably get the
same effect by adding "-v" to the options in package Compiler in the
GPR.

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

* Re: Emacs Ada mode with RTS
  2015-06-18 14:06     ` Simon Wright
@ 2015-06-18 15:09       ` Patrick Noffke
  2015-06-18 15:21         ` Patrick Noffke
  2015-06-19 13:56       ` Stephen Leake
  1 sibling, 1 reply; 17+ messages in thread
From: Patrick Noffke @ 2015-06-18 15:09 UTC (permalink / raw)


On Thursday, June 18, 2015 at 9:06:13 AM UTC-5, Simon Wright wrote:
> Patrick Noffke writes:
> 
> > It's the exact same command, so there must be some environment
> > variable that Ada mode is setting, or maybe some command is run prior
> > whose output isn't shown.
> 
> Annoyingly, gprbuild doesn't report all the options it passes to the
> compiler. I found that "-cargs -v" helped. You could probably get the
> same effect by adding "-v" to the options in package Compiler in the
> GPR.

Both command line and Emacs Ada mode call gnat1 with the same options, aside from a different tmp file.  The command line then goes on to call as, but not Ada mode since gnat1 fails with the error I gave earlier.

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

* Re: Emacs Ada mode with RTS
  2015-06-18 15:09       ` Patrick Noffke
@ 2015-06-18 15:21         ` Patrick Noffke
  0 siblings, 0 replies; 17+ messages in thread
From: Patrick Noffke @ 2015-06-18 15:21 UTC (permalink / raw)


On Thursday, June 18, 2015 at 10:09:53 AM UTC-5, Patrick Noffke wrote:
> On Thursday, June 18, 2015 at 9:06:13 AM UTC-5, Simon Wright wrote:
> > Patrick Noffke writes:
> > 
> > > It's the exact same command, so there must be some environment
> > > variable that Ada mode is setting, or maybe some command is run prior
> > > whose output isn't shown.
> > 
> > Annoyingly, gprbuild doesn't report all the options it passes to the
> > compiler. I found that "-cargs -v" helped. You could probably get the
> > same effect by adding "-v" to the options in package Compiler in the
> > GPR.
> 
> Both command line and Emacs Ada mode call gnat1 with the same options, aside from a different tmp file.  The command line then goes on to call as, but not Ada mode since gnat1 fails with the error I gave earlier.

Interestingly, if I run the "Check file" command from Ada mode, I get the error.  But then if I use the Emacs compile command (Tools -> Compile), using the same compile command that Check file used, the compilation succeeds.


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

* Re: Emacs Ada mode with RTS
  2015-06-17 18:12 Emacs Ada mode with RTS Patrick Noffke
  2015-06-17 21:30 ` Simon Wright
@ 2015-06-18 15:34 ` Stephen Leake
  2015-06-18 18:19   ` Patrick Noffke
  2015-06-18 18:39   ` Patrick Noffke
  1 sibling, 2 replies; 17+ messages in thread
From: Stephen Leake @ 2015-06-18 15:34 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> I'm trying to use Emacs Ada mode with a .gpr project file that works
> with GPS and uses a Ravenscar runtime. When I compile with GPS or from
> my own Makefile, I have no problems, but when I compile a file from
> Emacs using Ada mode's Compile file command, 

That command is intended for newbies only; serious projects should use
a Makefile, so you have more control.

> I get an error:
>
> s-osinte.ads:591:07: size for "Address" too small, minimum allowed is 64
>
> This is when it's compiling the "main" file.

Just a guess, but this looks like you are mixing 64 bit and 32 bit
systems? Are you trying to cross-compile?

> It appears that from Ada mode, the system adainclude directory is
> getting used. I wrote the .adp project file by hand, using Simon's
> suggestion from here:
> http://sourceforge.net/p/stm32f4-gnat-rts/discussion/general/thread/0ccef570/

That definitely suggests cross-compiling.

> But when I edit the project file with the Ada mode GUI (using Ada
> mode's Project -> Edit command), 

That's only in ada-mode 4.x; please upgrade to ada-mode 5.x, from Gnu
ELPA. To do that:

    First enable packages in your ~/.emacs: (package-initialize)
    
    Then invoke M-x list-packages, select ada-mode 5.1.8, install. 

For more on ada-mode 5.x, see
http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html

> it shows /usr/lib/gcc/x86_64-redhat-linux/4.9.2/adainclude listed
> under Source directories.
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/adalib is also listed under
> Object directories. These directories do not exist in my .adp file.
>
> gprbuild (and the resulting call to gcc) appear to be called as I
> expect from within Ada mode, but something must be set up as an
> environment variable that I'm not seeing in the compilation output
> window.

5.1.8 is better about this; the Ada | Build | Build command may do what
you want (but I still recommend a Makefile).

> Here are some variables from my .adp file:
>
> toolchain_dir=/home/pnoffke/projects/proj1/output/toolchain/gnat/bin
> ada_compiler=${toolchain_dir}/arm-eabi-gnat
> gpr_file=/home/pnoffke/projects/proj1/proj1.gpr
> config_file=/home/pnoffke/projects/proj1/obj/proj1.cgpr
> check_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> --target=arm-eabi --config=${config_file} ${full_current}
> make_cmd=PATH=${toolchain_dir}:$PATH ${toolchain_dir}/gprbuild -p
> --target=arm-eabi -P${gpr_file} --config=${config_file}
> comp_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> --target=arm-eabi --config=${config_file} ${full_current}

Some of this may no longer be supported in 5.1.8, but I have not checked
in detail.

If it doesn't work, please report bugs on the ada-mode mailing list (see
the above web site for subscription info); I'd like to enhance ada-mode
5.1.8 to support this sort of thing.

> The .cgpr file was created using gprconfig (I found this was how GPS
> works for an RTS project).

I guess by "RTS project" you mean one for which you specify an alternate
run time system via the various --RTS options. ada-mode does not support
that directly (see above about Makefile :).

I've been messing with that myself recently for Emacs, and have notes
about what needs to be added. There are several places where --RTS must
be specified on a command line, not just in a .gpr file. Also, it should
use the _correct_ system libraries as specified by the RTS setting,
not the default ones.

-- 
-- Stephe

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

* Re: Emacs Ada mode with RTS
  2015-06-18 15:34 ` Stephen Leake
@ 2015-06-18 18:19   ` Patrick Noffke
  2015-06-19 14:01     ` Stephen Leake
  2015-06-18 18:39   ` Patrick Noffke
  1 sibling, 1 reply; 17+ messages in thread
From: Patrick Noffke @ 2015-06-18 18:19 UTC (permalink / raw)


On Thursday, June 18, 2015 at 10:34:35 AM UTC-5, Stephen Leake wrote:
> 
> That's only in ada-mode 4.x; please upgrade to ada-mode 5.x, from Gnu
> ELPA. To do that:
> 
>     First enable packages in your ~/.emacs: (package-initialize)
>     
>     Then invoke M-x list-packages, select ada-mode 5.1.8, install. 
> 

When I installed ada-mode 5.1.8, I got the following error:

In ada-goto-declaration:
ada-mode.el:2814:1:Error: Symbol's value as variable is void: ada-prj-default-list

Let me know if you want the full compile log.  I'm using emacs 24.5.1 on Fedora 21.

Ada mode 5.1.8 seems to run though -- I'll play around with my issue next.

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

* Re: Emacs Ada mode with RTS
  2015-06-18 15:34 ` Stephen Leake
  2015-06-18 18:19   ` Patrick Noffke
@ 2015-06-18 18:39   ` Patrick Noffke
  2015-06-18 19:19     ` Simon Wright
  2015-06-19 14:08     ` Stephen Leake
  1 sibling, 2 replies; 17+ messages in thread
From: Patrick Noffke @ 2015-06-18 18:39 UTC (permalink / raw)


On Thursday, June 18, 2015 at 10:34:35 AM UTC-5, Stephen Leake wrote:
> Patrick Noffke writes:
> 
> Just a guess, but this looks like you are mixing 64 bit and 32 bit
> systems? Are you trying to cross-compile?
> 

Yes, I'm cross-compiling for an ARM Cortex-M4 target on a x86_64 host, using a Ravenscar-sfp runtime.

With 5.1.8, the problem is gone.  I can "check syntax" and build the project (still using the same custom check_cmd, make_cmd, and comp_cmd that call gprbuild with my config file).

> > Here are some variables from my .adp file:
> >
> > toolchain_dir=/home/pnoffke/projects/proj1/output/toolchain/gnat/bin
> > ada_compiler=${toolchain_dir}/arm-eabi-gnat
> > gpr_file=/home/pnoffke/projects/proj1/proj1.gpr
> > config_file=/home/pnoffke/projects/proj1/obj/proj1.cgpr
> > check_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> > --target=arm-eabi --config=${config_file} ${full_current}
> > make_cmd=PATH=${toolchain_dir}:$PATH ${toolchain_dir}/gprbuild -p
> > --target=arm-eabi -P${gpr_file} --config=${config_file}
> > comp_cmd=${toolchain_dir}/gprbuild -u -c -gnatc -p -P${gpr_file}
> > --target=arm-eabi --config=${config_file} ${full_current}
> 
> Some of this may no longer be supported in 5.1.8, but I have not checked
> in detail.
> 

It seems to work in 5.1.8.  I haven't played with using a Makefile yet.  I'll give that a shot.  Is there a way to make ada-mode's Check syntax or Build commands dependent on a rule (i.e. generating the config file) in my Makefile?

> If it doesn't work, please report bugs on the ada-mode mailing list (see
> the above web site for subscription info); I'd like to enhance ada-mode
> 5.1.8 to support this sort of thing.
> 
> > The .cgpr file was created using gprconfig (I found this was how GPS
> > works for an RTS project).
> 
> I guess by "RTS project" you mean one for which you specify an alternate
> run time system via the various --RTS options. ada-mode does not support
> that directly (see above about Makefile :).
> 
> I've been messing with that myself recently for Emacs, and have notes
> about what needs to be added. There are several places where --RTS must
> be specified on a command line, not just in a .gpr file. Also, it should
> use the _correct_ system libraries as specified by the RTS setting,
> not the default ones.

Perhaps you can use gprbuild instead of gnatmake?  Would that take care of it for you?

Thanks for your help.

Patrick


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

* Re: Emacs Ada mode with RTS
  2015-06-18 18:39   ` Patrick Noffke
@ 2015-06-18 19:19     ` Simon Wright
  2015-06-19 14:12       ` Stephen Leake
  2015-06-19 14:08     ` Stephen Leake
  1 sibling, 1 reply; 17+ messages in thread
From: Simon Wright @ 2015-06-18 19:19 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> Perhaps you can use gprbuild instead of gnatmake?  Would that take
> care of it for you?

This is pretty-much a must, since gnatmake doesn't understand all the
options you can put in a GPR file.

Also gnatmake will lose the ability to deal with project files at all,
spit spit

It used to be that gprbuild understood relative paths for --RTS=, but
the GPL 2015 one needs absolute paths.

This GPR works perfectly in ada-mode 5.1.8 ..

project Testbed is
   for Main use ("testbed.adb");
   for Object_Dir use ".build";
   for Source_Dirs use (".");
   for Exec_Dir use ".";
   for Target use "arm-eabi";
   package Builder is
      for Default_Switches ("ada") use
        (
         "-g",
         "-Og",
         "--RTS=" & Project'Project_Dir & "../stm32f429i-disco-rtos",
         "--create-map-file"
        );
   end Builder;
   package Compiler is
      for Default_Switches ("ada") use
        (
         "-gnatqQafoy",
         "-gnatwaL.X"
        );
   end Compiler;
   package Linker is
      for Map_File_Option use "-Wl,-Map," & Project'Project_Dir;
   end Linker;
end Testbed;

I believe that the new gprbuild will allow

   for Runtime ("ada") use "stm32f429i-disco-rtos";

(not sure about paths for RTSs that aren't installed)
(see http://docs.adacore.com/gnat_ugx-docs/html/gnat_ugx/gnat_ugx/specifying_the_run-time_library_and_target.html#selecting-the-run-time-library)


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

* Re: Emacs Ada mode with RTS
  2015-06-18 14:06     ` Simon Wright
  2015-06-18 15:09       ` Patrick Noffke
@ 2015-06-19 13:56       ` Stephen Leake
  1 sibling, 0 replies; 17+ messages in thread
From: Stephen Leake @ 2015-06-19 13:56 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> Patrick Noffke <patrick.noffke@gmail.com> writes:
>
>> It's the exact same command, so there must be some environment
>> variable that Ada mode is setting, or maybe some command is run prior
>> whose output isn't shown.
>
> Annoyingly, gprbuild doesn't report all the options it passes to the
> compiler. 

It passes some via environment variables


-- 
-- Stephe


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

* Re: Emacs Ada mode with RTS
  2015-06-18 18:19   ` Patrick Noffke
@ 2015-06-19 14:01     ` Stephen Leake
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Leake @ 2015-06-19 14:01 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> On Thursday, June 18, 2015 at 10:34:35 AM UTC-5, Stephen Leake wrote:
>> 
>> That's only in ada-mode 4.x; please upgrade to ada-mode 5.x, from Gnu
>> ELPA. To do that:
>> 
>>     First enable packages in your ~/.emacs: (package-initialize)
>>     
>>     Then invoke M-x list-packages, select ada-mode 5.1.8, install. 
>> 
>
> When I installed ada-mode 5.1.8, I got the following error:
>
> In ada-goto-declaration:
> ada-mode.el:2814:1:Error: Symbol's value as variable is void:
> ada-prj-default-list

I don't get that when starting from emacs -Q

It may be due to ada-mode 4.x loaded when you are installing 5.1.8; the
package installer doesn't start a separate emacs process to byte-compile
the new package.

-- 
-- Stephe


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

* Re: Emacs Ada mode with RTS
  2015-06-18 18:39   ` Patrick Noffke
  2015-06-18 19:19     ` Simon Wright
@ 2015-06-19 14:08     ` Stephen Leake
  2015-06-19 14:47       ` Patrick Noffke
  1 sibling, 1 reply; 17+ messages in thread
From: Stephen Leake @ 2015-06-19 14:08 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> On Thursday, June 18, 2015 at 10:34:35 AM UTC-5, Stephen Leake wrote:
>> Patrick Noffke writes:
>> 
>> Just a guess, but this looks like you are mixing 64 bit and 32 bit
>> systems? Are you trying to cross-compile?
>> 
>
> Yes, I'm cross-compiling for an ARM Cortex-M4 target on a x86_64 host,
> using a Ravenscar-sfp runtime.
>
> With 5.1.8, the problem is gone. I can "check syntax" and build the
> project (still using the same custom check_cmd, make_cmd, and comp_cmd
> that call gprbuild with my config file).

Excellent!

> Is there a way to make ada-mode's Check syntax
> or Build commands dependent on a rule (i.e. generating the config
> file) in my Makefile?

I'm not sure what you are asking.

When I use a Makefile, I put check and build targets in there; I never
use the Ada | Build menu.

You can set the Ada | Build | Check command to run 'make check' in your .adp:

check_cmd=make check

>> I've been messing with that myself recently for Emacs, and have notes
>> about what needs to be added. There are several places where --RTS must
>> be specified on a command line, not just in a .gpr file. Also, it should
>> use the _correct_ system libraries as specified by the RTS setting,
>> not the default ones.
>
> Perhaps you can use gprbuild instead of gnatmake?  Would that take
> care of it for you?

I am using gprbuild; it also requires --RTS on the command line.
That may be redundant with some setting in the gpr file, but if so, I
have not found it.

It may be the --RTS option is only used for running gprconfig. But I
need to do that at least once, so it's still required.

-- 
-- Stephe

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

* Re: Emacs Ada mode with RTS
  2015-06-18 19:19     ` Simon Wright
@ 2015-06-19 14:12       ` Stephen Leake
  2015-06-19 19:19         ` Simon Wright
  0 siblings, 1 reply; 17+ messages in thread
From: Stephen Leake @ 2015-06-19 14:12 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> Patrick Noffke <patrick.noffke@gmail.com> writes:
>
>> Perhaps you can use gprbuild instead of gnatmake?  Would that take
>> care of it for you?
>
> This is pretty-much a must, since gnatmake doesn't understand all the
> options you can put in a GPR file.
>
> Also gnatmake will lose the ability to deal with project files at all,
> spit spit
>
> It used to be that gprbuild understood relative paths for --RTS=, but
> the GPL 2015 one needs absolute paths.
>
> This GPR works perfectly in ada-mode 5.1.8 ..

Just to be clear, are you saying you can run:

gprbuild testbed.gpr

that is, you _don't_ need --RTS on the gprbuild command line?

The AdaCore docs do a really bad job of saying what packages correspond
to what command line options.

-- 
-- Stephe


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

* Re: Emacs Ada mode with RTS
  2015-06-19 14:08     ` Stephen Leake
@ 2015-06-19 14:47       ` Patrick Noffke
  2015-06-21  9:48         ` Stephen Leake
  0 siblings, 1 reply; 17+ messages in thread
From: Patrick Noffke @ 2015-06-19 14:47 UTC (permalink / raw)


On Friday, June 19, 2015 at 9:09:01 AM UTC-5, Stephen Leake wrote:
> Patrick Noffke writes:
> 
> > Is there a way to make ada-mode's Check syntax
> > or Build commands dependent on a rule (i.e. generating the config
> > file) in my Makefile?
> 
> I'm not sure what you are asking.
> 
> When I use a Makefile, I put check and build targets in there; I never
> use the Ada | Build menu.
> 
> You can set the Ada | Build | Check command to run 'make check' in your .adp:
> 
> check_cmd=make check
> 

If I want to use the Ada | Build | Check syntax command to check that a single file compiles, then I would need to first ensure the config file is created with gprconfig (i.e. as a make dependency).

How would the file name get passed to the Makefile?  Do I need to grab the last command-line argument from within the Makefile, or is there another way?

It's not that big of a deal right now -- I can just build the entire project as I'm editing to check my syntax.

Thanks,
Patrick

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

* Re: Emacs Ada mode with RTS
  2015-06-19 14:12       ` Stephen Leake
@ 2015-06-19 19:19         ` Simon Wright
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Wright @ 2015-06-19 19:19 UTC (permalink / raw)


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

> Simon Wright <simon@pushface.org> writes:
>
>> Patrick Noffke <patrick.noffke@gmail.com> writes:
>>
>>> Perhaps you can use gprbuild instead of gnatmake?  Would that take
>>> care of it for you?
>>
>> This is pretty-much a must, since gnatmake doesn't understand all the
>> options you can put in a GPR file.
>>
>> Also gnatmake will lose the ability to deal with project files at all,
>> spit spit
>>
>> It used to be that gprbuild understood relative paths for --RTS=, but
>> the GPL 2015 one needs absolute paths.
>>
>> This GPR works perfectly in ada-mode 5.1.8 ..
>
> Just to be clear, are you saying you can run:
>
> gprbuild testbed.gpr
>
> that is, you _don't_ need --RTS on the gprbuild command line?

Yes; I don't need --RTS on the gprbuild command line.

Turns out that with Gprbuild GPL 2015 I can say

   for Runtime ("ada") use Project'Project_Dir & "../stm32f429i-disco-rtos";

instead of the equivalent --RTS line in package Builder.


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

* Re: Emacs Ada mode with RTS
  2015-06-19 14:47       ` Patrick Noffke
@ 2015-06-21  9:48         ` Stephen Leake
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Leake @ 2015-06-21  9:48 UTC (permalink / raw)


Patrick Noffke <patrick.noffke@gmail.com> writes:

> On Friday, June 19, 2015 at 9:09:01 AM UTC-5, Stephen Leake wrote:
>> Patrick Noffke writes:
>>
>> > Is there a way to make ada-mode's Check syntax
>> > or Build commands dependent on a rule (i.e. generating the config
>> > file) in my Makefile?
>>
>> I'm not sure what you are asking.
>>
>> When I use a Makefile, I put check and build targets in there; I never
>> use the Ada | Build menu.
>>
>> You can set the Ada | Build | Check command to run 'make check' in your .adp:
>>
>> check_cmd=make check
>>
>
> If I want to use the Ada | Build | Check syntax command to check that
> a single file compiles, then I would need to first ensure the config
> file is created with gprconfig (i.e. as a make dependency).

In the 'check_cmd' string, "${full_current}" is replaced by the current
file name:

check_cmd=make check SOURCE_FILE=${full_current}

Then you have a makefile rule like:

check : $(SOURCE_FILE)
    gnatmake -gnatc -P$(GNAT_PROJECT) $<

This assumes GNAT_PROJECT is set elsewhere in the Makefile.

Note that this will also syntax-check any files that SOURCE_FILE
"with"s; I find that useful.

There should be a similar option for gprbuild, but I have not found a
need for it yet.



Alternately, you can use a makefile target like:

%.check : %.adb
    gnatmake -gnatc -P$(GNAT_PROJECT) $*


Then to check a single file foo.adb, from the Makefile do:

M-x compile
make -r foo.check

--
-- Stephe


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

end of thread, other threads:[~2015-06-21  9:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 18:12 Emacs Ada mode with RTS Patrick Noffke
2015-06-17 21:30 ` Simon Wright
2015-06-18 13:48   ` Patrick Noffke
2015-06-18 14:06     ` Simon Wright
2015-06-18 15:09       ` Patrick Noffke
2015-06-18 15:21         ` Patrick Noffke
2015-06-19 13:56       ` Stephen Leake
2015-06-18 15:34 ` Stephen Leake
2015-06-18 18:19   ` Patrick Noffke
2015-06-19 14:01     ` Stephen Leake
2015-06-18 18:39   ` Patrick Noffke
2015-06-18 19:19     ` Simon Wright
2015-06-19 14:12       ` Stephen Leake
2015-06-19 19:19         ` Simon Wright
2015-06-19 14:08     ` Stephen Leake
2015-06-19 14:47       ` Patrick Noffke
2015-06-21  9:48         ` Stephen Leake

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