GNAT

3 posts / 0 new
Last post
#1 Sat, 2013-08-17 20:17
shafire
  • shafire's picture
  • Offline
  • Last seen: 2 years 7 months ago
  • Joined: 2013-08-06

Hello,

I am trying to get GNAT running since 3 days! :-( Here is my actual problem:

alpine:~/HelloAda$ gnatmake hello.adb 
gcc-4.6 -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
/opt/gnat-debian/usr/bin/ld: warning: libc.so.6, needed by /opt/gnat-debian/usr/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libgnat-4.6.so, may conflict with libc.so.0.9.32
 
alpine:~/HelloAda$ ./hello
Segmentation fault
 
alpine:~/HelloAda$ gnatclean hello
"./hello.ali" has been deleted
"./hello.o" has been deleted
"hello" has been deleted

But there no libraries linked against libc.so.0.9.32 as you can see at the bottom.

I installed following packages in /opt/gnat-debian

wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/gnat-4.6_4.6.3-8_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/gnat-4.6_4.6.3-8_amd64.deb
ar</a> vx gnat-4.6_4.6.3-8_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnat-4.6_4.6.3-8_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnat-4.6_4.6.3-8_amd64.deb
ar</a> vx libgnat-4.6_4.6.3-8_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnatvsn4.6_4.6.3-8_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnatvsn4.6_4.6.3-8_amd64.deb
ar</a> vx libgnatvsn4.6_4.6.3-8_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnatprj4.6_4.6.3-8_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gnat-4.6/libgnatprj4.6_4.6.3-8_amd64.deb
ar</a> vx libgnatprj4.6_4.6.3-8_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/libgcc1_4.7.2-5_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/libgcc1_4.7.2-5_amd64.deb
ar</a> vx libgcc1_4.7.2-5_amd64.deb
tar -xzvf data.tar.gz
 
### maybe not needed
# wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/lib32gcc1_4.7.2-5_amd64.deb
#" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/lib32gcc1_4.7.2-5_amd64.deb
#</a> ar vx lib32gcc1_4.7.2-5_amd64.deb
# tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc6_2.13-38_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc6_2.13-38_amd64.deb
ar</a> vx libc6_2.13-38_amd64.deb
tar -xzvf data.tar.gz
 
### maybe not needed
# wget <a href="http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc6-i386_2.13-38_amd64.deb
#" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc6-i386_2.13-38_amd64.deb
#</a> ar vx libc6-i386_2.13-38_amd64.deb
# tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gcc-4.6/gcc-4.6_4.6.3-14_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gcc-4.6/gcc-4.6_4.6.3-14_amd64.deb
ar</a> vx gcc-4.6_4.6.3-14_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/m/mpclib/libmpc2_0.9-4_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/m/mpclib/libmpc2_0.9-4_amd64.deb
ar</a> vx libmpc2_0.9-4_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gcc-4.6/cpp-4.6_4.6.3-14_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gcc-4.6/cpp-4.6_4.6.3-14_amd64.deb
ar</a> vx cpp-4.6_4.6.3-14_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/b/binutils/binutils_2.22-8_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/b/binutils/binutils_2.22-8_amd64.deb
ar</a> vx binutils_2.22-8_amd64.deb
tar -xzvf data.tar.gz
 
### maybe not needed
# wget <a href="http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc-bin_2.13-38_amd64.deb
#" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/e/eglibc/libc-bin_2.13-38_amd64.deb
#</a> ar vx libc-bin_2.13-38_amd64.deb
# tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.7.dfsg-13_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.7.dfsg-13_amd64.deb
ar</a> vx zlib1g_1.2.7.dfsg-13_amd64.deb
tar -xzvf data.tar.gz
 
wget <a href="http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
ar" rel="nofollow">http://ftp.us.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
ar</a> vx libstdc++6_4.7.2-5_amd64.deb
tar -xzvf data.tar.gz
 
.profile:
export PATH=/opt/gnat-debian/sbin:/opt/gnat-debian/usr/bin:/opt/gnat/bin:$PATH
export LD_LIBRARY_PATH=/opt/gnat-debian/usr/lib/x86_64-linux-gnu:/opt/gnat-debian/lib/x86_64-linux-gnu:/opt/gnat-debian/lib64:/opt/gnat-debian/usr/lib
 
 
symlinks:
lrwxrwxrwx    1 root     root          22 Aug 17 14:42 /lib64 -> /opt/gnat-debian/lib64
lrwxrwxrwx    1 root     root          37 Aug 17 14:52 /lib/x86_64-linux-gnu -> /opt/gnat-debian/lib/x86_64-linux-gnu
maybe I forgot some symlinks

alpine:~$ LD_TRACE_LOADED_OBJECTS=1 /lib64/ld-linux-x86-64.so.2 /opt/gnat-debian/usr/bin/ld
	linux-vdso.so.1 =>  (0x000074566fc8a000)
	libbfd-2.22-system.so => /opt/gnat-debian/usr/lib/libbfd-2.22-system.so (0x000074566fb80000)
	libz.so.1 => /opt/gnat-debian/lib/x86_64-linux-gnu/libz.so.1 (0x000074566f968000)
	libdl.so.2 => /opt/gnat-debian/lib/x86_64-linux-gnu/libdl.so.2 (0x000074566f764000)
	libc.so.6 => /opt/gnat-debian/lib/x86_64-linux-gnu/libc.so.6 (0x000074566f3da000)
	/lib64/ld-linux-x86-64.so.2 (0x000074566fc8c000)

Could we get gnat work on alpine, please? :-)

Sun, 2013-08-18 19:08
shafire
  • shafire's picture
  • Offline
  • Last seen: 2 years 7 months ago
  • Joined: 2013-08-06

Hi,

my next try was to compile gnat with the flag static on Debian and copy the binaries to alpine:

gnat-static2.tar.gz (165.1 MB)
https://mega.co.nz/#!fJc22RKI!PulfohhdlzNqaPaVvHhzYiO16MYG_NaVRd4PZq-2ky0

alpine:~/HelloAda$ gnatmake hello.adb 
gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `fstat64':
/usr/include/x86_64-linux-gnu/sys/stat.h:520: undefined reference to `__fxstat64'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `stat64':
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `lstat64':
/usr/include/x86_64-linux-gnu/sys/stat.h:513: undefined reference to `__lxstat64'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `stat64':
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/usr/include/x86_64-linux-gnu/sys/stat.h:506: undefined reference to `__xstat64'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `__gnat_cpu_alloc':
/home/dennis/GNAT/obj/gcc/ada/rts/adaint.c:3862: undefined reference to `__sched_cpualloc'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(adaint.o): In function `__gnat_cpu_free':
/home/dennis/GNAT/obj/gcc/ada/rts/adaint.c:3872: undefined reference to `__sched_cpufree'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(cio.o): In function `getchar':
/usr/include/x86_64-linux-gnu/bits/stdio.h:47: undefined reference to `_IO_getc'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(cio.o): In function `putchar':
/usr/include/x86_64-linux-gnu/bits/stdio.h:82: undefined reference to `_IO_putc'
/opt/gnat-static/lib/gcc/x86_64-unknown-linux-gnu/4.7.4/adalib/libgnat.a(cstreams.o): In function `fstat64':
/usr/include/x86_64-linux-gnu/sys/stat.h:520: undefined reference to `__fxstat64'
collect2: error: ld returned 1 exit status
gnatlink: error when calling /opt/gnat-static/bin/gcc
gnatmake: *** link failed.
 
alpine:~/HelloAda$ gnatclean hello
"./hello.ali" has been deleted
"./hello.o" has been deleted
"/home/dennis/HelloAda/b~hello.ads" has been deleted
"/home/dennis/HelloAda/b~hello.adb" has been deleted
"/home/dennis/HelloAda/b~hello.ali" has been deleted
"/home/dennis/HelloAda/b~hello.o" has been deleted

This did not work out. :-( The binary gnatclean works, but not gnatmake for some (unknown) reason.

Tue, 2013-08-20 01:06
shafire
  • shafire's picture
  • Offline
  • Last seen: 2 years 7 months ago
  • Joined: 2013-08-06

Okay, I tried to compile a Cross-Compiler. It's working for C, but not for Ada.

dennis@debian:~/HelloAda$ x86_64-alpine-linux-uclibc-gnatmake hello.adb 
x86_64-alpine-linux-uclibc-gcc -c hello.adb
x86_64-alpine-linux-uclibc-gnatbind -x hello.ali
x86_64-alpine-linux-uclibc-gnatlink hello.ali
/home/dennis/opt/cross/lib/gcc/x86_64-alpine-linux-uclibc/4.8.1/adalib/libgnat.a(adaint.o): In function `__gnat_cpu_alloc':
/home/dennis/GCC/obj/gcc/ada/rts/adaint.c:3797: undefined reference to `__sched_cpualloc'
/home/dennis/opt/cross/lib/gcc/x86_64-alpine-linux-uclibc/4.8.1/adalib/libgnat.a(adaint.o): In function `__gnat_cpu_free':
/home/dennis/GCC/obj/gcc/ada/rts/adaint.c:3807: undefined reference to `__sched_cpufree'
collect2: error: ld returned 1 exit status
x86_64-alpine-linux-uclibc-gnatlink: error when calling /home/dennis/opt/cross/bin/x86_64-alpine-linux-uclibc-gcc
x86_64-alpine-linux-uclibc-gnatmake: *** link failed.

adaint.c => http://nopaste.info/ffcb612692.html

At line 3797 and 3807 in file adaint.c, I found following comment:

/* glibc versions earlier than 2.7 do not define the routines to handle
   dynamically allocated CPU sets. For these targets, we use the static
   versions. */

EDIT: I will check http://comments.gmane.org/gmane.comp.lib.uclibc.general/22736

Log in or register to post comments