comp.lang.ada
 help / color / mirror / Atom feed
From: Qun-Ying <zhu.qunying@gmail.com>
Subject: gprbuild and Linker_Options bug?
Date: Mon, 31 Mar 2014 16:21:51 -0700
Date: 2014-03-31T16:21:51-07:00	[thread overview]
Message-ID: <lhcta0$pfj$1@speranza.aioe.org> (raw)

With gnat 2013, GPRBUILD GPL 2013 (20130314) (x86_64-pc-linux-gnu)

For this simple program:

a.gpr:
--------
project A is

    for Main use ("main.adb");

    package Linker is
       for Linker_Options use ("-lgs");
    end Linker;

end A;

main.adb:
----------
with Interfaces.C; use Interfaces.C;
with b; use b;

procedure Main is
    revision: aliased revision_t;
    ret : int;
begin
    ret := b.revision (revision'Access, revision'Size / 8);
end Main;

b.ads
---------
-- simple single function binding for gs to illustrate the bug
with Interfaces.C;         use Interfaces.C;
with Interfaces.C.Strings;
with System;

package b is
    type revision_t is limited private;
    function revision (pr : access revision_t; len : int) return int;
    pragma Import (C, revision, "gsapi_revision");

private
    type revision_t is limited record
       product      : Interfaces.C.Strings.chars_ptr;
       copyright    : Interfaces.C.Strings.chars_ptr;
       revision     : long;
       revisiondate : long;
    end record;
    pragma Convention (C_Pass_By_Copy, revision_t);
end b;

When running under gprbuild -P a, It will failed with the following message:
gcc main.o -o main
main.o: In function `_ada_main':
main.adb:(.text+0x21): undefined reference to `gsapi_revision'
collect2: error: ld returned 1 exit status
gprbuild: link of main.adb failed

Where it fails to use the Linker_Options defined in the project file.
But "gnatmake -P a" will build the program without problem.

Is this a known problem? Or something I have missed?

If  added a line of 'pragma Linker_Options ("-lgs")' in b.ads, then
gprbuild could build without problem.

             reply	other threads:[~2014-03-31 23:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 23:21 Qun-Ying [this message]
2014-03-31 23:38 ` gprbuild and Linker_Options bug? Qun-Ying
2014-04-01  7:41 ` 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