Ada 编译缺失子单元

发布于 2024-11-25 03:24:48 字数 8214 浏览 3 评论 0原文

我最近更新到了新版本的 GNAT 编译器。我正在尝试编译 GNADE 源代码(http://gnade.sourceforge.net/)

是否需要设置某种标志或某种方式来调试它?

我看到这个错误(当它在 GNATPro 6.22 下编译良好时):

gnatmake -g -O0 -fstack-check -pipe -gnatE -gnatU -gnatwl -gnatf   -gnatE -gnat05   -p  -PLibBuildGNADE.gpr
gcc -c -fPIC -g -O0 -fstack-check -pipe -gnatE -gnatU -gnatwl -gnatf -gnatE -gnat05 -I- -gnatA /home/user1/GNADE/src/gnu-db-sqlcli-generic_attr-boolean_attribute.adb
cannot generate code for file gnu-db-sqlcli-generic_attr-boolean_attribute.adb (missing subunits)

这是规范源(gnu-db-sqlcli-generic_attr-boolean_attribute.ads)

-------------------------------------------------------------------------------
--                                                                           --
--                      GNADE  : GNu Ada Database Environment                --
--                                                                           --
--  Author          : Juergen Pfeifer <[email protected]>
--
--  Copyright (C) 2000-2001 Juergen Pfeifer
--                                                                           --
--  GNADE is free software;  you can redistribute it  and/or modify it under --
--  terms of the  GNU General Public License as published  by the Free Soft- --
--  ware  Foundation;  either version 2,  or (at your option) any later ver- --
--  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--  for  more details.  You should have  received  a copy of the GNU General --
--  Public License  distributed with GNAT;  see file COPYING.  If not, write --
--  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--  MA 02111-1307, USA.                                                      --
--                                                                           --
--  As a special exception,  if other files  instantiate  generics from this --
--  unit, or you link  this unit with other files  to produce an executable, --
--  this  unit  does not  by itself cause  the resulting  executable  to  be --
--  covered  by the  GNU  General  Public  License.  This exception does not --
--  however invalidate  any other reasons why  the executable file  might be --
--  covered by the  GNU Public License.                                      --
--                                                                           --
--  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
--                                                                           --
-------------------------------------------------------------------------------
generic
   type Bool_Type is mod <>;
package GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute is

   type Attribute_Value_Pair_Boolean_Scalar is new Attribute_Value_Pair
     with
      record
         Value : Boolean;
      end record;
   function To_String (Object : Attribute_Value_Pair_Boolean_Scalar)
                      return String;

   function GetAttr (Handle    : Context;
                     Attribute : T;
                     Data      : Aux;
                     MaxLength : SQLSMALLINT := 0;
                     ErrorCode : access SQLRETURN)
                    return Attribute_Value_Pair_Boolean_Scalar;

   procedure SetAttr (Handle    : in  Context;
                      AV_Pair   : in  Attribute_Value_Pair_Boolean_Scalar;
                      Data      : in  Aux;
                      ErrorCode : out SQLRETURN);

private
   Default_Len : constant Base := Base (Length_Indicator (Bool_Type'Size));

end GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute;

这是正文源(gnu-db-sqlcli-generic_attr-boolean_attribute) .adb)

-------------------------------------------------------------------------------
--                                                                           --
--                      GNADE  : GNu Ada Database Environment                --
--                                                                           --
--  Author          : Juergen Pfeifer <[email protected]>
--
--  Copyright (C) 2000-2003 Juergen Pfeifer
--                                                                           --
--  GNADE is free software;  you can redistribute it  and/or modify it under --
--  terms of the  GNU General Public License as published  by the Free Soft- --
--  ware  Foundation;  either version 2,  or (at your option) any later ver- --
--  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--  for  more details.  You should have  received  a copy of the GNU General --
--  Public License  distributed with GNAT;  see file COPYING.  If not, write --
--  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--  MA 02111-1307, USA.                                                      --
--                                                                           --
--  As a special exception,  if other files  instantiate  generics from this --
--  unit, or you link  this unit with other files  to produce an executable, --
--  this  unit  does not  by itself cause  the resulting  executable  to  be --
--  covered  by the  GNU  General  Public  License.  This exception does not --
--  however invalidate  any other reasons why  the executable file  might be --
--  covered by the  GNU Public License.                                      --
--                                                                           --
--  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
--                                                                           --
-------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with System.Address_To_Access_Conversions;

package body GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute is

   function To_String (Object : Attribute_Value_Pair_Boolean_Scalar)
                      return String is
   begin
      return Boolean'Image (Object.Value);
   end To_String;

   function GetAttr (Handle    : Context;
                     Attribute : T;
                     Data      : Aux;
                     MaxLength : SQLSMALLINT := 0;
                     ErrorCode : access SQLRETURN)
                    return Attribute_Value_Pair_Boolean_Scalar
   is
      pragma Unreferenced (MaxLength);
      package P is new System.Address_To_Access_Conversions (Bool_Type);

      Value : aliased Bool_Type;
      Len   : Base := Default_Len;
      Res   : Boolean := False;
   begin
      Get (Handle,
           Attribute,
           To_SQLPOINTER (P.To_Address
                          (P.Object_Pointer'(Value'Access))),
           Len,
           Data,
           ErrorCode);
      if Value /= 0 then
         Res := True;
      end if;
      return Attribute_Value_Pair_Boolean_Scalar'
        (Attribute => Attribute,
         Value     => Res);
   end GetAttr;

   procedure SetAttr (Handle    : in Context;
                      AV_Pair   : in Attribute_Value_Pair_Boolean_Scalar;
                      Data      : in Aux;
                      ErrorCode : out SQLRETURN)
   is
      function Cvt is new Ada.Unchecked_Conversion (SQLINTEGER, SQLPOINTER);
      Len : constant Base     := Default_Len;
      Val : aliased Bool_Type := 0;
   begin
      if AV_Pair.Value then
         Val := 1;
      end if;
      Set (Handle, AV_Pair.Attribute,
           Cvt (SQLINTEGER (Val)),
           Len,
           Data,
           ErrorCode);
   end SetAttr;


end GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute;

I recently updated to a new version of the GNAT compiler.. I am trying to compile the GNADE source (http://gnade.sourceforge.net/)

Is there some sort of flag that I need to set or some way to debug this?

I am seeing this error (When it used to compile fine under GNATPro 6.22):

gnatmake -g -O0 -fstack-check -pipe -gnatE -gnatU -gnatwl -gnatf   -gnatE -gnat05   -p  -PLibBuildGNADE.gpr
gcc -c -fPIC -g -O0 -fstack-check -pipe -gnatE -gnatU -gnatwl -gnatf -gnatE -gnat05 -I- -gnatA /home/user1/GNADE/src/gnu-db-sqlcli-generic_attr-boolean_attribute.adb
cannot generate code for file gnu-db-sqlcli-generic_attr-boolean_attribute.adb (missing subunits)

Here is the spec source (gnu-db-sqlcli-generic_attr-boolean_attribute.ads)

-------------------------------------------------------------------------------
--                                                                           --
--                      GNADE  : GNu Ada Database Environment                --
--                                                                           --
--  Author          : Juergen Pfeifer <[email protected]>
--
--  Copyright (C) 2000-2001 Juergen Pfeifer
--                                                                           --
--  GNADE is free software;  you can redistribute it  and/or modify it under --
--  terms of the  GNU General Public License as published  by the Free Soft- --
--  ware  Foundation;  either version 2,  or (at your option) any later ver- --
--  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--  for  more details.  You should have  received  a copy of the GNU General --
--  Public License  distributed with GNAT;  see file COPYING.  If not, write --
--  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--  MA 02111-1307, USA.                                                      --
--                                                                           --
--  As a special exception,  if other files  instantiate  generics from this --
--  unit, or you link  this unit with other files  to produce an executable, --
--  this  unit  does not  by itself cause  the resulting  executable  to  be --
--  covered  by the  GNU  General  Public  License.  This exception does not --
--  however invalidate  any other reasons why  the executable file  might be --
--  covered by the  GNU Public License.                                      --
--                                                                           --
--  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
--                                                                           --
-------------------------------------------------------------------------------
generic
   type Bool_Type is mod <>;
package GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute is

   type Attribute_Value_Pair_Boolean_Scalar is new Attribute_Value_Pair
     with
      record
         Value : Boolean;
      end record;
   function To_String (Object : Attribute_Value_Pair_Boolean_Scalar)
                      return String;

   function GetAttr (Handle    : Context;
                     Attribute : T;
                     Data      : Aux;
                     MaxLength : SQLSMALLINT := 0;
                     ErrorCode : access SQLRETURN)
                    return Attribute_Value_Pair_Boolean_Scalar;

   procedure SetAttr (Handle    : in  Context;
                      AV_Pair   : in  Attribute_Value_Pair_Boolean_Scalar;
                      Data      : in  Aux;
                      ErrorCode : out SQLRETURN);

private
   Default_Len : constant Base := Base (Length_Indicator (Bool_Type'Size));

end GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute;

Here is the body source (gnu-db-sqlcli-generic_attr-boolean_attribute.adb)

-------------------------------------------------------------------------------
--                                                                           --
--                      GNADE  : GNu Ada Database Environment                --
--                                                                           --
--  Author          : Juergen Pfeifer <[email protected]>
--
--  Copyright (C) 2000-2003 Juergen Pfeifer
--                                                                           --
--  GNADE is free software;  you can redistribute it  and/or modify it under --
--  terms of the  GNU General Public License as published  by the Free Soft- --
--  ware  Foundation;  either version 2,  or (at your option) any later ver- --
--  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--  for  more details.  You should have  received  a copy of the GNU General --
--  Public License  distributed with GNAT;  see file COPYING.  If not, write --
--  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--  MA 02111-1307, USA.                                                      --
--                                                                           --
--  As a special exception,  if other files  instantiate  generics from this --
--  unit, or you link  this unit with other files  to produce an executable, --
--  this  unit  does not  by itself cause  the resulting  executable  to  be --
--  covered  by the  GNU  General  Public  License.  This exception does not --
--  however invalidate  any other reasons why  the executable file  might be --
--  covered by the  GNU Public License.                                      --
--                                                                           --
--  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
--                                                                           --
-------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with System.Address_To_Access_Conversions;

package body GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute is

   function To_String (Object : Attribute_Value_Pair_Boolean_Scalar)
                      return String is
   begin
      return Boolean'Image (Object.Value);
   end To_String;

   function GetAttr (Handle    : Context;
                     Attribute : T;
                     Data      : Aux;
                     MaxLength : SQLSMALLINT := 0;
                     ErrorCode : access SQLRETURN)
                    return Attribute_Value_Pair_Boolean_Scalar
   is
      pragma Unreferenced (MaxLength);
      package P is new System.Address_To_Access_Conversions (Bool_Type);

      Value : aliased Bool_Type;
      Len   : Base := Default_Len;
      Res   : Boolean := False;
   begin
      Get (Handle,
           Attribute,
           To_SQLPOINTER (P.To_Address
                          (P.Object_Pointer'(Value'Access))),
           Len,
           Data,
           ErrorCode);
      if Value /= 0 then
         Res := True;
      end if;
      return Attribute_Value_Pair_Boolean_Scalar'
        (Attribute => Attribute,
         Value     => Res);
   end GetAttr;

   procedure SetAttr (Handle    : in Context;
                      AV_Pair   : in Attribute_Value_Pair_Boolean_Scalar;
                      Data      : in Aux;
                      ErrorCode : out SQLRETURN)
   is
      function Cvt is new Ada.Unchecked_Conversion (SQLINTEGER, SQLPOINTER);
      Len : constant Base     := Default_Len;
      Val : aliased Bool_Type := 0;
   begin
      if AV_Pair.Value then
         Val := 1;
      end if;
      Set (Handle, AV_Pair.Attribute,
           Cvt (SQLINTEGER (Val)),
           Len,
           Data,
           ErrorCode);
   end SetAttr;


end GNU.DB.SQLCLI.Generic_Attr.Boolean_Attribute;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南…巷孤猫 2024-12-02 03:24:48

您在自我回答中提到的 -x 标志是这样描述的:

表明不属于任何项目文件的源可能是
编译。通常,使用项目文件时,仅使用以下源
项目文件的一部分可以被编译。当使用此开关时,
可以编译所有项目文件之外的源。 ALI 文件和
目标文件将被放入主程序的目标目录中
项目。使用的编译开关将仅是指定的那些
命令行。即使使用“-x”,电源上指定的
命令行需要是项目文件的来源。

因此,看起来发生的情况是您正在使用项目文件,并且您正在使用一些单元,但您没有费心将其放入任何项目文件中。我猜 GNU.DB 中的所有内容?

我认为解决方案是要么继续将这些额外的源放入项目文件中的某个位置,要么继续使用 -x 标志进行构建。

The -x flag you mentioned in your self-answer is described thusly:

Indicate that sources that are not part of any Project File may be
compiled. Normally, when using Project Files, only sources that are
part of a Project File may be compile. When this switch is used, a
source outside of all Project Files may be compiled. The ALI file and
the object file will be put in the object directory of the main
Project. The compilation switches used will only be those specified on
the command line. Even when `-x' is used, mains specified on the
command line need to be sources of a project file.

So it looks like what was happening was that you are using project files, and had some units that you were using that you hadn't bothered to put into any of your project files. I'm guessing everything in GNU.DB?

I suppose the solution would be to either go ahead and put those extra sources in a project file somewhere, or continue to build with that -x flag.

掐死时间 2024-12-02 03:24:48

一时兴起,我将“-x”标志传递给编译器,它似乎解决了这个问题。

On a whim, I passed in the '-x' flag to the compiler and it seemed to fix the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文