Ada program on Linux: SIGSEGV due to missing file?

I built the Ada program for Linux on Ubuntu 5.4 (GNAT 3.4) using the following command:

gnatmake -O3 myprogram -bargs -static

When I run the program on an Ubuntu machine, it works fine. But on another machine (Linux web server) I get the following error message when I try strace:

execve("./myprogram", ["./myprogram"], [/* 15 vars */]) = 0
brk(0)                                  = 0x811e000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76f8000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76f7000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb76f7680, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

What does it mean? Do I understand correctly that the program cannot work because two files are missing (ld.so.nohwcap and ld.so.preload)? How can I avoid this error? Is it possible to include these files in the program at compile time?

+3
source share
3 answers

What does it mean?

This means that your program tried to dereference a pointer NULLand died usingSIGSEGV

, , (ld.so.nohwcap ld.so.preload)?

: , , .

  • gdb. strace .
  • , ( , ) Linux, . , , , , :

    Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

    , glibc, -, , . ( -static).

Update:

libgnat?

, , :

gcc ... -Wl,-Bstatic -lgnat -Wl,-Bdynamic ...

, gnatmake.

, , : libgnat-3.4.so.1 ?

+4

, strace, - ,

  • ldd,
  • , .
  • , -g
  • , gdb , SIGSEV,

: , CPU "" ,

,

+2

, , Linux (Ubuntu 5.4), (-) . , . ld.so. *: .

jimw -. GNAT 3.4 , -. , - -static. Ubuntu -static -, .

If recompiling and / or compiling on the web server does not work, you will have to use gdb to debug your program. Or you can post some of the code here and see if anyone can help you.

+1
source

All Articles