开发者

Ada compilation issue (Looking for adbs I don't have?)

I am trying to compile a third part library into my existing application using gnatmake.. And I am getting this error:

gnatmake: "dds.adb" not found
gnatmake: "dds-domainparticipant.adb" not found
gnatmake: "dds-domainparticipantfactory.adb" not found
gnatmake: "dds-publisher.adb" not found
gnatmake: "dds-topic.adb" not found
gnatmake: "dds-publisher_impl.adb" not found
gnatmake: "dds-datawriter_impl.adb" not found
gnatmake: "dds-domainparticipant_impl.adb" not found
gnatmake: "dds-readcondition_impl.adb" not found
gnatmake: "dds-datareader_impl.adb" not found
gnatmake: "dds-subscriber.adb" not found
gnatmake: "dds-condition.adb" not found
gnatmake: "dds-datareader.adb" not found
gnatmake: "dds-statuscondition.adb" not found

I added these to the gnatmake which builds the adp. The -I contains all of the specs (.ads files), and the libnddsadad has al开发者_开发百科l of the o files:

       -I/lib/ndds.4.5d/include/ndds/dds_ada \
       -I/lib/ndds.4.5d/include/ndds/dds_ada/support     \
       -I/lib/ndds.4.5d/include/ndds/dds_ada/support/low-level \

       /lib/Linux/ndds.4.5d/lib/GNATgcc/static/debug/libnddsadad.a \

Why does it want the actual body files? Shouldn’t the specs + .a file be enough? How can I circumvent this?


Specs and an archive library are not enough. You need to specify the location of the .ali files. Also, try using the -aI and -aL flags instead of -I.


You need to specify:

-largs switches: Linker switches, where switches is a list of switches that are valid switches for gnatlink.

-Ldir: Add directory dir to the list of directories in which the linker will search for libraries.

For example,

-largs -L/lib/Linux/ndds.4.5d/lib/GNATgcc/static/debug -lnddsadad

Addendum: You might also look at

-Adir: Equivalent to -aLdir -aIdir.


You could create a gnat project file for the library, something like this:

project DDS_Lib is
   for Source_Dirs use ("/usr/include/dds_path");
   for Library_Name use "nddsadad";
   for Library_Dir use "/usr/lib/dds_path";
   for Library_ALI_Dir use "/usr/lib/dds_ali_path";
   for Externally_Built use "true";
end DDS_Lib;

and then in your project file, add with "dds_lib.gpr"; at the beginning. You don't have to add anything to your Linker flags to link with this library, since it is done automagically.

Good Ada libraries already provide such a gpr file, which should get installed in the standard search path (for example /usr/lib/gnat/). If it is installed at a non-standard path, you can add the path to the ADA_PROJECT_PATH environment variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜