Bug 163078 - ADA compile error, /usr/bin/ld: cannot find -lgnat-3.4 for x86_64 (RHEL4-U1)
ADA compile error, /usr/bin/ld: cannot find -lgnat-3.4 for x86_64 (RHEL4-U1)
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: comps (Show other bugs)
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Radovan Musil
Depends On:
  Show dependency treegraph
Reported: 2005-07-12 15:20 EDT by Jack Pogue
Modified: 2011-12-13 15:24 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-12-13 15:24:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jack Pogue 2005-07-12 15:20:56 EDT
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.

>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)

How reproducible:

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 17:33:57 EDT
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 18:20:20 EDT
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 16:29:41 EDT
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 17:05:00 EDT
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

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 13:02:49 EDT
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 13:13:20 EDT
Yes, the i386 libgnat is there to support running i386 Ada programs on x86-64.
Comment 10 Bill Nottingham 2011-12-13 15:24:27 EST
This is not going to be changed in RHEL 4 at this time, sorry.

Note You need to log in before you can comment on or make changes to this bug.