How to compile and link using gnatmake with the Ada shared library?

I have a problem re-submitting an application to the Florist library. It turns out that I have a big problem with the florist (the same error occurs both in the latest version of the 2010 Adacore GPL and in the 2009 version in the Debian archive). The florist has some low-level problems, but when I look at the generated files, he seems to include errno.h correctly.

Here's what happens when I create a florist:

gcc-4.4 -c -I / usr / share / ada / adainclude / florist demo.adb gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada /adainclude/florist/posix.adb gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada / adainclude / florist / posix-io.adb gcc- 4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada / adainclude / florist / posix-terminal_functions.adb gcc-4.4 -c -I./-I/ usr / share / ada / adainclude / florist -I- / usr / share / ada / adainclude / florist / posix-c.adb gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist - I- / usr / share / ada / adainclude / florist / posix-implementation.adb posix-implementation.gpb: 45: 06: warning: "SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS" is the GNAT posix-implementation.gpb: 45 internal block: 06: warning: the use of this device is not portable and depends on the version of posix-implementation.gpb: 47:06: warning: "SYSTEM.SOFT_LINKS" is the GNAT internal unit posix-implementation.gpb: 47: 06: warning: use of this device is not portable and depends on version gcc-4.4 -c -I./-I/usr/share / ada / adainclude / florist -I- / usr / share / ada / adainclude / florist / ada_streams.ads gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada / adainclude / florist / posix-permissions.adb gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada / adainclude / florist / posix- permissions-implementation.adb gcc-4.4 -c -I./-I/usr/share/ada/adainclude/florist -I- / usr / share / ada / adainclude / florist / posix-process_identification.adb gnatbind -I / usr / share / ada / adainclude / florist -x demo.ali gnatlink demo.ali -o demoapp. / posix -implementation.o: In the function `posix__implementation__set_ada_error_code ': posix-implementation.adb :(.text + 0x19e): undefined reference to `store_errno '. / posix -implementation.o: In the function `posix__implementation__get_ada_error_code ': posix-implementation.adb :(. text + 0x1ab): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__raise_posix_error ': posix-implementation.adb :(. text + 0x234): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check__2 ': posix-implementation.adb :(. text + 0x2e5): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check__3 ': posix-implementation.adb :(. text + 0x313): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check_nneg ': posix-implementation.adb :(. text + 0x332):undefined reference to `fetch_errno '. / posix -implementation.o: posix-implementation.adb :(. text + 0x34e): more undefined references to `fetch_errno 'follow. / posix -implementation.o: In the function `nosys_neg_one ': posix-implementation.adb :(. text + 0xaef): undefined reference to` store_errno'. / posix -implementation.o: In the function `notsup_neg_one ': posix-implementation.adb :(. text + 0xb15): undefined reference to` store_errno'. / posix -implementation.o: In the function `posix__implementation__restore_signals_and_raise_posix_error ': posix-implementation.adb :(. text + 0xc88): undefined reference to` fetch_errno'. /posix.o: In the function `posix__system_name ': posix.adb :(. text + 0x2f98): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__node_name ': posix.adb :(. text + 0x2fef):undefined reference to __gnat_florist_uname. /posix.o: In the function `posix__release ': posix.adb :(. text + 0x3049): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__version ': posix.adb :(. text + 0x30a6): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__machine ': posix.adb :(. text + 0x3103): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__host_to_network_byte_order ': posix.adb :(. text + 0x4627): undefined reference to` c_htonl'. /posix.o: In the function `posix__host_to_network_byte_order__2 ': posix.adb :(. text + 0x4642): undefined reference to` c_htons'. /posix.o: In the function `posix__network_to_host_byte_order ': posix.adb :( text + 0x4655): undefined reference to` c_ntohl'. /posix.o:In the function `posix__network_to_host_byte_order__2 ': posix.adb :(. Text + 0x4670): undefined reference to` c_ntohs'. / posix -io.o: In the function `posix__io__open ': posix-io.adb :(. text + 0x4d1): undefined reference to` __gnat_florist_open'. / posix -io.o: In the function `posix__io__open_or_create ': posix-io.adb :(. text + 0xfca): undefined reference to` __gnat_florist_open' collect2: ld returned 1 exit status gnatlink: error when calling / usr / bin / gcc -4.4 gnatmake: *** link failed. josh @ Mini10: ~ / Demo $ gnatbind -I / usr / share / ada / adainclude / florist -I / usr / include demo josh @ Mini10: ~ / Demo version of $ gnatlink. / posix -implementation.o: In the function `posix__implementation__set_ada_error_code ': posix-implementation.adb :(. text + 0x19e): undefined reference to` store_errno'. / posix -implementation.o:In the function `posix__implementation__get_ada_error_code ': posix-implementation.adb :(. Text + 0x1ab): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__raise_posix_error ': posix-implementation.adb :(. text + 0x234): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check__2 ': posix-implementation.adb :(. text + 0x2e5): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check__3 ': posix-implementation.adb :(. text + 0x313): undefined reference to` fetch_errno'. / posix -implementation.o: In the function `posix__implementation__check_nneg ': posix-implementation.adb :(. text + 0x332): undefined reference to` fetch_errno'. / posix -implementation.o: posix-implementation.adb :(. text + 0x34e):more undefined links to `fetch_errno 'follow. / posix -implementation.o: In the function `nosys_neg_one ': posix-implementation.adb :(. text + 0xaef): undefined reference to` store_errno'. / posix -implementation.o: In the function `notsup_neg_one ': posix-implementation.adb :(. text + 0xb15): undefined reference to` store_errno'. / posix -implementation.o: In the function `posix__implementation__restore_signals_and_raise_posix_error ': posix-implementation.adb :(. text + 0xc88): undefined reference to` fetch_errno'. /posix.o: In the function `posix__system_name ': posix.adb :(. text + 0x2f98): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__node_name ': posix.adb :(. text + 0x2fef): undefined reference to` __gnat_florist_uname'. /posix.o: In the `posix__release 'function: posix.adb :(. text + 0x3049):undefined reference to __gnat_florist_uname. /posix.o: In the function `posix__version ': posix.adb :(. text + 0x30a6): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__machine ': posix.adb :(. text + 0x3103): undefined reference to` __gnat_florist_uname'. /posix.o: In the function `posix__host_to_network_byte_order ': posix.adb :(. text + 0x4627): undefined reference to` c_htonl'. /posix.o: In the function `posix__host_to_network_byte_order__2 ': posix.adb :(. text + 0x4642): undefined reference to` c_htons'. /posix.o: In the function `posix__network_to_host_byte_order ': posix.adb :( text + 0x4655): undefined reference to` c_ntohl'. /posix.o: In the function `posix__network_to_host_byte_order__2 ': posix.adb :(. text + 0x4670): undefined reference to` c_ntohs'. / posix -io.o:In the function `posix__io__open ': posix-io.adb :(. Text + 0x4d1): undefined reference to` __gnat_florist_open'. / posix -io.o: In the function `posix__io__open_or_create ': posix-io.adb :(. text + 0xfca): undefined reference to` __gnat_florist_open' collect2: ld returned 1 exit status gnatlink: error when calling / usr / bin / gcc -4.4

, , errno.h. , posix-c.c, . - ? , , .

+3
3

, , .

Florist , ( ). , ( ). , , , .ads( ) .

:

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

-aI . -aO libflorist.so( ) , , ( ), -lflorist, , ... . -largs ( ), ! !

, ! Ada Linux (GCC), / , -llibname -largs, !

. , - .

+6

GNAT Florist. , $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
+2

, . - .h, Ada C- . , .

Florist, , , . SourceForge , , 6 . , , ( ?), . .

+1
source

Source: https://habr.com/ru/post/1768910/


All Articles