Ada Encapsulated Library Project GNAT

801 views Asked by At

I'm trying to use GNAT 95 to compile a program on my computer running CENTOS 7 64-bit with the GNAT-GPL 2015 bundle. I get a compiler message that looks like this:

gprbuild: encapsulated library projects not supported on this platform

My GPR file looks like this:

with "bc.gpr";  -- Pull in the booch95 components since ada95 doesnt have collections
with "mylibrary.gpr"; -- one of my library projects

library project Registry is
    for Source_Dirs use ("src/**");
    for Object_Dir use "bin";

    for Library_Name use "registry";
    for Library_Standalone use "encapsulated";
    for Library_ALI_Dir use "lib/registry";
    for Library_Dir use "plugins";
    for Library_Kind use "dynamic";
    for Library_Interfaces use ("...");

    package Compiler is
        for Default_Switches ("Ada") use ("-g", "-gnat95");
    end Compiler;

    package Linker is
        for Linker_Options use ("-ldl", "-lgcov");
    end Linker;
end project;

The Booch Components library is a static library project. Removing the encapsulated causes Ada to throw another error about trying to mix static and dynamic libraries:

shared library project "registry" cannot import static library project "bc"

Any Idea what might be causing the Ada compiler to crash?

1

There are 1 answers

3
Simon Wright On BEST ANSWER

Unless you’re using a very old version of the BCs, you can build as a shared or dynamic library by setting the scenario variable LIBRARY_TYPE to relocatable; either by setting as an environment variable, or

gprbuild -XLIBRARY_TYPE=relocatable ...

or with GPS. I’m not a GPS user, but having investigated it seems (with GPS GPL 2014) you select Scenario in the tabs on the left hand side, which should show the scenario variables in your project and the projects it depends on (bc in your case). Select the one you want to change and click the pen icon, you get a dialog box to update it.

Setting a scenario variable in GPS