1

I am trying to use GPS IDE as my alternative development tool on OS X El Capitan (moving away from OS X 10.5 Xcode 3.0). But I have stumbled on one strange error:

gnat bind myprog.bexch
gnatbind: Cannot find: myprog.bexch.ali
gprbuild: unable to bind myprog.adb [2016-01-20 18:49:07] process
exited with status 4, 100% (13/13), elapsed time: 04.77s

In my directory, I can only find myprog.bexch. Looks like gnatbind does not produce myprog.bexch.ali

My GPR looks like this:

project Amygdala_Cortex is

    for Object_Dir use "Build/";
    for Exec_Dir use "Build/Debug/";
    for Library_Name use "";
    for Library_Ali_Dir use "";
    for Library_Kind use "static";


    package Compiler is
        for Default_Switches ("ada") use ("-g", "-O2", "-I/opt/local/include/aws", "-I/opt/local/include/aws/components");
    end Compiler;

    package Binder is
        for Driver ("ada") use "/usr/local/gnat/bin/gnatbind";
    end Binder;

    package Linker is
        for Linker_Options use ();
    end Linker;

    for Main use ("amygdala_cortex.adb");

end Amygdala_Cortex;

Apparently, I don't have gprbind in my directories.

Have I done something wrong or missed something in the GPR?

I am using gnat-gpl-2015-x86_64-darwin (GNAT GPL 2015 (20150428-49)) on El Capitan (10.11.2).

Thanks.

Adrian Hoe
  • 2,081
  • 2
  • 12
  • 12
  • The error message suggests that no .ali file has been created for `myprog.bexch`, i.e. that something called `myprog.bexch.ad[s|b]` has not been compiled. (Or possibly, in the wrong folder). Which points to something wrong earlier in the build process, yes? –  Jan 20 '16 at 12:04
  • Everything compiled fine. Had .ali and .o and I thought myprog.bexch was produced by gnatbind. Yes? – Adrian Hoe Jan 20 '16 at 12:06
  • Including the named .ali? –  Jan 20 '16 at 12:07
  • Yes, myprog.ali and myprog.o – Adrian Hoe Jan 20 '16 at 12:08
  • Never seen such a thing. Maybe binding works differently on mac, I'll fold... –  Jan 20 '16 at 12:10
  • I am suspecting that gnatbind wasn't binding or lacking appropriate switched. Yes? What then? – Adrian Hoe Jan 20 '16 at 12:14
  • Well, googling "gnatbind .bexch" produces precisely ONE hit, which suggests the .bexch is a binder-generated file, apparently Mac-specific. So we probably need Simon... You may find some clues on his blog, at http://forward-in-code.blogspot.co.uk/ –  Jan 20 '16 at 12:23
  • 1
    I’m pretty sure that gprbuild’s behaviour isn’t OS-dependent (at least as far as this problem is concerned). As @manuBriot says, you ought not to override `Binder’Driver` (why did you?). Here, gprbuild runs `gprbind main.bexch`, which runs `gnatbind main.ali`, which generates & compiles `b__main.adb`. Also, but irrelevant, you shouldn’t have the Library-related attributes in the project. – Simon Wright Jan 20 '16 at 13:07

2 Answers2

4

I think you should try to comment out the Binder'Driver attribute. Let gprbuild find and run gnatbind on its own as needed. It will find it on your PATH, via a tool named gprconfig, which generates a configuration file (generally auto.cgpr).

You are using AWS. Do not use -I switches to the compiler, instead simply add

with "aws";

in your project, which will add the relevant switches for the compiler, linker,...

manuBriot
  • 2,755
  • 13
  • 21
0

Thanks for the help.

Here is my new GPR in case someone has similar problem:

with "aws";

project myprog is

   for Object_Dir use "Build/";
   for Exec_Dir use "Build/Debug/";
   for Library_Name use "";
   for Library_Ali_Dir use "";
   for Library_Kind use "static";

   package Compiler is
      for Default_Switches ("ada") use ("-g", "-O2");
   end Compiler;


   package Linker is
      for Linker_Options use ();
   end Linker;

   for Main use ("myprog.adb");

end myprog;
Adrian Hoe
  • 2,081
  • 2
  • 12
  • 12