Bug 163078

Summary: ADA compile error, /usr/bin/ld: cannot find -lgnat-3.4 for x86_64 (RHEL4-U1)
Product: Red Hat Enterprise Linux 4 Reporter: Jack Pogue <pogue.iii>
Component: compsAssignee: Radovan Musil <rmusil>
Status: CLOSED WONTFIX QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 4.0CC: jakub, notting
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-13 20:24:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jack Pogue 2005-07-12 19:20:56 UTC
Description of problem:
This appears to be an older problem that continues to exist in RHEL4 (U1) for 
x86_64 (I found similar problems from a google search on "lgnat-3.4").

When trying to compile ADA code, I get a /usr/bin/ld error when gnatlink runs.

The easiest way to recreate the error is by using gnatmake.
i.e.

>gnatmake hello.adb
gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
/usr/bin/ld: cannot find -lgnat-3.4
collect2: ld returned 1 exit status
gnatlink: cannot call /usr/bin/gcc
gnatmake *** link failed


I believe one problem might be that /usr/lib/gcc/x86_64_redhat-
linux/3.4.3/adalib/libgnat-3.4.so (and libgnarl-3.4.so) are symbolically 
linked to /usr/lib64/libgnat-3.4.so.1 (and libgnarl-3.4.so.1), but these files 
don't exist in /usr/lib64.  The files do exist in /usr/lib, but if I relink 
the files to the /usr/lib location, I receive an incompatibility error 
(saying "/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64_redhat-
linux/3.4.3/adalib/libgnat-3.4.so when searching for -lgnat-3.4")


Version-Release number of selected component (if applicable):
Standard for RHEL4 (U1)
gcc-3.4.3-22.1
gcc-gnat-3.4.3-22.1

How reproducible:
Everytime

Steps to Reproduce:
1.Load RHEL4 (U1) - x86_64
2.Set up gcc to run ADA (gcc-gnat, etc.)
3.Try to build an executable from ADA.  

Actual results:

>gnatmake hello.adb
gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
/usr/bin/ld: cannot find -lgnat-3.4
collect2: ld returned 1 exit status
gnatlink: cannot call /usr/bin/gcc
gnatmake *** link failed

Expected results:
Should have created an executable

Additional info:
Although this issue doesn't cause "crashes, loss of data, or severe memory 
leaks", I placed this bug in high severity because we are unable to use these 
servers until ADA is working properly.

Comment 1 Jakub Jelinek 2005-07-12 21:33:57 UTC
What the following commands prints on your box?
rpm -q --qf '%{name}-%{version}-%{release}.%{arch}\n' libgnat
Sounds like you don't have libgnat-3.4.*.x86_64.rpm installed.

Comment 2 Jack Pogue 2005-07-12 22:20:20 UTC
Apparently when the OS installs, libgnat-3.4.3-22.1.i386 is installed by 
default instead of libgnat-3.4.3-22.1.x86_64.  To fix the problem, I couldn't 
just upgrade libgnat with the x86_64 version, had to remove gcc-gnat and 
libgnat PRIOR to reinstalling them.

Everything seems to be working fine now.

My only suggestion is that the default OS installation procedure should be 
changed to install the x86_64 version instead of the i386 version.

Thanks again.

Comment 3 Jakub Jelinek 2005-07-13 20:29:41 UTC
Did you install RHEL4 GA and then upgraded to RHEL4 U1 or installed RHEL4 U1?
RHEL4 GA did not include x86-64 libgnat (nor gcc-gnat), only U1+ does.
In any case, the default selection of packages is a comps issue.
IMHO neither gcc-gnat, nor libgnat.x86_64, nor libgnat.i386 should be the
default in any category, only optional.


Comment 4 Mike McLean 2005-07-13 21:05:00 UTC
libgnat is in the "Compatibility Arch Support".  All the packages in there
currently are either marked default or mandatory.  It's easy enough to mark it
optional, but I've got to wonder though if anyone out there relies upon it's
presence.

Oddly enough, it looks like the only package that requires libgnat is gcc-gnat
(which is basearchonly).  I wonder why libgnat was ever added as to the compat
arch list.  CC'ing notting.


Comment 7 Jack Pogue 2005-07-14 17:02:49 UTC
To answer your previous questions, I installed RHEL4 U1 from scratch (no 
upgrades).  Perhaps the reason libgnat is installed is in case users need to 
run precompiled ADA programs that weren't built to run entirely stand-alone, 
thus needing the libs?


Comment 8 Bill Nottingham 2005-07-14 17:13:20 UTC
Yes, the i386 libgnat is there to support running i386 Ada programs on x86-64.

Comment 10 Bill Nottingham 2011-12-13 20:24:27 UTC
This is not going to be changed in RHEL 4 at this time, sorry.