我很难再次编译申请人花店图书馆。事实证明,我对花店有一个更大的问题(在Debian的档案中,最新的2010年Adacore GPL下载和2009年版本的错误结果相同)。花店有一些低级问题,但是当我查看生成的文件时,似乎正确地包含了errno.h。

这是我建立花店时发生的事情:

GCC -4.4 -C -I/usr/share/ada/ada/adainclude/florist demo.adb gcc -4.4 -c -i./-i/usr/share/share/ada/ada/adainclude/adainclude/florist -i-/usr/share/share/ada /AdainClude/florist/posix.adb GCC -4.4 -C -I./ -I/USR/SHARE/ADA/ADA/ADAINCLUDE/FLORIST -II-/usr/SHARE/ADA/ADAINCLUDE/ADAINCLUDE/FLORIST/POSIX-IO.ADB GCC- gcc--gcc--gcc- 4.4 -C -I ./ -i/usr/share/ada/ada/adainclude/florist -ii-/usr/share/ada/adainclude/florist/posix-triminal_functions.adb gcc-4.4 -c -i./-i///////// usr/share/ada/adainclude/florist -ii-/usr/share/ada/adainclude/florist/posix-c.adb gcc-4.4 -c -i./-i/usr/share/share/ada/ada/ada/ada/adainclude/florist- I- /usr/share/ada/adainclude/florist/posix-implementation.adb posix-implementation.gpb:45:06: warning: "SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS" is an internal GNAT unit posix-implementation.gpb:45: 06:警告:本单元的使用是不可携带的,依赖版本的posix-implement.gpb:47:06:警告:“ system.soft_links”是一个内部gnat单元posix-implementation.gpb:47:06:06:警告:警告:警告:警告:警告:警告:该单元的使用是不可携带的且依赖版本的GCC -4.4 -C -I./ -I/ U sr/share/ada/adainclude/florist -ii-/usr/share/ada/adainclude/florist/ada_streams.ads gcc-4.4 -c -i./-i/usr/share/share/ada/ada/ada/ada/adaclude/florist -ii----- /USR/share/ada/adainclude/florist/posix-permissions.adb gcc-4.4 -c -i./-i/usr/share/ada/ada/ada/adainclude/forist/florist -i-/usr/usr/share/ada/ada/adainclude/adainclude/florist/florist/florist/florist /posix -permissions -implementation.ADB GCC -4.4 -C -I./-I/usr/share/ada/ada/adainclude/adainClude/florist -i-/usr/share/ada/adainclude/AdainClude/posix-posix-process_identification.adb gnatbind-gnatbind--gnatbind--gnatbind--gnatbind- I/usr/share/ada/adainclude/florist -x demo.ali gnatlink demo.ali -o demoapp ./posix-implementation.o:in Function`posix__implementation_set_set_set_ada_ertor_eror_code':posix -implementation':posix -implementation.adb:adb:at。未定义的引用“ store_errno” ./posix-implementation.o:在函数`posix__implementation__get_ate_ada_error_code':posix-implementation.adb :(。 posix__implementation__RAISE_POSIX_ERROR':posix-implement.adb :(。text+0x234):未定义的引用fetch_errno' ./posix-implementation.o: In function `posix__implementation__check__2': posix-implementation.adb:(.text+0x2e5): undefined reference to `fetch_errno' ./posix-implementation.o: In function `posix__implementation__check__3': posix -implementation.adb :(。文本+0x313):未定义的引用`fetch_errno'./posix-implement.o:在函数`posix__implementation__check_nneg':posix-implementation.adb :(。 './posix-implement.o:posix-implement.adb :(.text +0x34e):``fetch_errno''''control ./posix-implementation.o:in Function`nosys_neg_one':posix-implement.Adb:adbemix-implementation.o: (.Text+0xaef):未定义的引用“ store_errno” ./posix-implement.o:在函数`notsup_neg_one':posix-implement.adb :(。 enasemation.o:in函数`posix__implementation__restore_signals_and_raise_posix_error':posix-implementation.adb :(。text+0xc88):undefined Ref eRence to`fetch_errno'./posix.o:在函数`posix__system_name':posix.adb :(。text+0x2f98):undefined引用对___gnat_florist_uname'./ posix.o'./posix.o:in Function``posix__node_node_name':posix.adb:adb:adb:adb:posix.name': (text+0x2fef):未定义的引用`__gnat_florist_uname'./posix.o:在函数`posix__release':posix.adb:atb :(。 “ posix__version':posix.adb :(。text+0x30a6):未定义的引用“ __gnat_florist_uname'./posix.o:in Function posix__machine':posix_machine':posix.adb:取<text+0x3103):未经确定的参考,请参考。 。 ):未定义的引用`c_htons'./posix.o:在函数`posix__network_to_to_host_byte_order':posix.adb :(。text+0x4655):未定义的引用` t_byte_order__2':posix.adb :(。text+0x4670):未定义的引用对`c_ntohs'./posix-io.o:在函数`posix__io__open':posix-io.adb':posix-io.adb:stbork:(。 `___gnat_florist_open'./posix-io.o:在函数`posix__io__open_or_create':posix-io.adb :(。text+0xfca):不确定的引用`__gnat_gnat_gnat_florist_open'collect2:collect2:ld返回1 exit状态时, /BIN/GCC-4.4 GNATMAKE:***链接失败。 josh@mini10:〜/demo $ gnatbind -i/usr/share/ada/ada/adainclude/florist -i/usr/include demo josh@mini10:〜/demo $ gnatlink demo ./ posix-implement.o:in函数中':posix-implementation.adb :(。text+0x19e):未定义的引用“ store_errno'./posix-implementation.o:in Function”到`fetch_errno'./posix-implement.o:in函数`posix__implementation__raise_posix_error':posix-implementation.adb :(。 :posix-implement.adb :(。text+0x2e5):对“ fetch_errno'./posix-implementation.o:in Function” posix__implementation__check__3':posix-implementation.adb:atb :(。doct+0x313): `fetch_errno'./posix-implement.o:在函数`posix__implementation__check_nneg':posix-implementation.adb :(。文本+0x332):未定义的引用`fetch_errno'./posix-implement.o:posix-implement.adb :( .. text +0x34e):更多不确定的对`fetch_errno'的参考。 `nosys_neg_one':posix-implement.adb :(。text+0xaef):对“ store_errno'./ posix-implementation.o的未定义引用:在函数`notsup_neg_one':posix-implementation':posix-implementation.adb :(。text+0xb15):未定义的引用“ store_errno” ./posix-implement.o:在功能`posix_implementation__restore_signals_and_and_raise_posix_error':posix-implementation.adb:atb:(。text+0xc88) :posix.adb :(。text+0x2f98):未定义的引用`__gnat_florist_uname'./posix.o:在函数`posix__node_name':posix.adb:atix.adb :(。text+0x2fef):Unddewos of to'____gnat_glorist_florist_florist_uname'./pposix 。 。 :在函数中`posix__host_to_network_byte_order':posix.adb :(。text+0x4627):undefined引用`c_htonl'./posix.o:in Function` posix__host_to_to_to_network_network_network_network_byte_byte_order_oder_2':posix.2':posix.adb:.adbirection..dext+0x4662 `c_htons'./posix.o:在函数`posix__network_to_to_host_byte_order':posix.adb :(。文本+0x4670):未定义的引用`c_ntohs'./posix-io.o:在函数`posix__io__open':posix-io.adb :(。text+0x4d1):未定义的引用`______gnat_florist_open'./posix-oio。 o:在函数`posix__io__open_or_create':posix-io.adb :(。text+0xfca):未定义的引用`__gnat_florist_open'collect2:ld返回1 exit状态gnatlink:nate gnatlink:nated/user n nater/usr/usr/usr/bin/bin/gcc-4.4444.444.444.444.444.444.44.44.44.444.444.444.444.444.444.444.44 eform

如果正确包含errno.h存在问题,则似乎很常见。但是据我所知,从Posix-CC文件中,它看起来都正确。有人对如何解决这个问题有任何建议吗?花店的制作文件正确构建,所以我不知道它来自哪里。

有帮助吗?

解决方案

好的,这很痛苦,但我发现了。

花店绑定既可以作为共享库和静态库(都安装)。您需要针对库链接以解决所有参考(我永远无法将库源编译到我的应用程序中)。一旦通过论点告诉库库有关库的编译阶段,您必须提供.ADS(至少)文件才能解决。

最终解决方案最终是:

gnatmake -aI/usr/share/ada/adainclude/florist -aO/usr/lib/ada/adalib/florist demo.adb -largs -lflorist

-aI 提供了图书馆的ADS文件的路径。 -aO 提供了(在这种情况下)libflorist.so库文件的路径,最后(这是棘手的)您必须通过 -lflorist 告诉它,这一切共享的库是什么……但是通过它行不通。你必须放置一个 -largs 为了通过参数,在其前面(用于编译和链接器)以使编译阶段通过!没有它,这些阶段将永远看不到论点!

所以你们就是所有人!为了根据Linux(GCC)的共享ADA库进行编译和链接代码,您需要提供库的标题/规格,库位置和-llibname参数以及-largs以及-largs,以将其传递到正确的位置!

我现在很高兴。希望这对别人有帮助。

其他提示

这是使用GNAT项目与花店一起构建的一个简单示例。我认为 $ADA_PROJECT_PATH 包括目录 florist.gpr 已安装(就我而言, $HOME/local/lib/gnat).

示例程序(我在网上找不到任何简单的花店演示,有吗?) id.adb:

with POSIX.Process_Identification;
with Ada.Text_IO; use Ada.Text_IO;
procedure Id is
begin
   Put_Line (POSIX.To_String (POSIX.Process_Identification.Get_Login_Name));
end Id;

项目文件(id.gpr),在同一目录中 id.adb:

with "florist";
project Id is
   for Main use ("id.adb");
   for Object_Dir use ".build_id";
   for Exec_Dir use ".";
end Id;

$ gnatmake -p -P id.gpr
object directory "/Users/simon/florist-gpl-2010-src/demo/.build_id" created for project id
gcc -c -I- -gnatA /Users/simon/florist-gpl-2010-src/demo/id.adb
gnatbind -I- -x /Users/simon/florist-gpl-2010-src/demo/.build_id/id.ali
gnatlink /Users/simon/florist-gpl-2010-src/demo/.build_id/id.ali -lflorist -o /Users/simon/florist-gpl-2010-src/demo/id

并运行:

$ ./id
simon

它看起来像漂亮的花园式链接错误。 .h文件,ADA对象文件和C链接库之间的某些内容并没有完全搭配。很难说什么。

最好的选择是寻找可能遇到同一问题的其他花店用户。他们的项目页面是 在SourceForge上, ,但在过去的六年中,它看起来并不活跃。由于最新版本是旧版本,因此您可能需要一个旧的编译器(和OS?)才能使用它。 iCk。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top