Bug 917777

Summary: gcc-ar: Cannot find binary 'ar'
Product: Red Hat Developer Toolset Reporter: Marek Polacek <mpolacek>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Martin Cermak <mcermak>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 2.0 RHEL 6CC: dprokopo, law, mcermak, mfranc, mnewsome, mpolacek
Target Milestone: alpha   
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: devtoolset-2-gcc-4.8.0-0.17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-10 06:34:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Polacek 2013-03-04 18:22:54 UTC
Under DTS-2:
# gcc-ar
gcc-ar: Cannot find binary 'ar'

stat64("/opt/rh/devtoolset-2/root/usr/lib/gcc/i386-redhat-linux/4.8.0/../../../../i386-redhat-linux/bin/ar", 0xbfe81a40) = -1 ENOENT (No such file or directory)
stat64("/opt/rh/devtoolset-2/root/usr/libexec/gcc/i386-redhat-linux/4.8.0/ar", 0xbfe81a40) = -1 ENOENT (No such file or directory)

The problem is that we're missing a symlink from
/opt/rh/devtoolset-2/root/usr/libexec/gcc/i386-redhat-linux/4.8.0
to
/opt/rh/devtoolset-2/root/usr/bin/ar

This patch could fix it:

--- a/gcc.spec
+++ b/gcc.spec
@@ -954,6 +954,7 @@ FULLPATH=%{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}
 FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}
 
 %if 0%{?scl:1}
+ln -sf ../../../../bin/ar $FULLEPATH/ar
 ln -sf ../../../../bin/as $FULLEPATH/as
 ln -sf ../../../../bin/ld $FULLEPATH/ld
 ln -sf ../../../../bin/nm $FULLEPATH/nm

Comment 2 Marek Polacek 2013-03-05 18:16:54 UTC
This is the correct version (slightly tested).

--- a/gcc.spec
+++ b/gcc.spec
@@ -6,7 +6,7 @@
 %global gcc_version 4.8.0
 # Note, gcc_release must be integer, if you want to add suffixes to
 # %{release}, append them after %{gcc_release} on Release: line.
-%global gcc_release 0.14
+%global gcc_release 0.15
 %global gmp_version 4.3.1
 %global mpfr_version 2.4.1
 %global mpc_version 0.8.1
@@ -954,6 +954,7 @@ FULLPATH=%{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}
 FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}
 
 %if 0%{?scl:1}
+ln -sf ../../../../bin/ar $FULLEPATH/ar
 ln -sf ../../../../bin/as $FULLEPATH/as
 ln -sf ../../../../bin/ld $FULLEPATH/ld
 ln -sf ../../../../bin/nm $FULLEPATH/nm
@@ -1699,6 +1700,7 @@ fi
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/liblto_plugin.so*
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/collect2
 %if 0%{?scl:1}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/ar
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/as
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/ld
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/nm
@@ -2057,6 +2059,9 @@ fi
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/plugin
 
 %changelog
+* Tue Mar 05 2013 Marek Polacek <polacek> 4.8.0-0.15
+- fix #917777
+
 * Wed Feb 20 2013 Jakub Jelinek <jakub> 4.8.0-0.14
 - sync from F19 gcc-4.8.0-0.14
 - don't Requires: libquadmath in *-libquadmath-devel on RHEL 5 and 6 (#912765)

Comment 3 Marek Polacek 2013-03-06 10:00:20 UTC
Should be fixed in git.

Comment 4 Miroslav Franc 2013-03-08 15:29:13 UTC
I can observe the very same issue is with gcc-ranlib.

Comment 5 Marek Polacek 2013-03-08 16:03:15 UTC
Thus,
--- gcc.spec.mp	2013-03-08 16:51:16.491971890 +0100
+++ gcc.spec	2013-03-08 17:02:37.396669300 +0100
@@ -958,6 +958,7 @@ ln -sf ../../../../bin/ar $FULLEPATH/ar
 ln -sf ../../../../bin/as $FULLEPATH/as
 ln -sf ../../../../bin/ld $FULLEPATH/ld
 ln -sf ../../../../bin/nm $FULLEPATH/nm
+ln -sf ../../../../bin/ranlib $FULLEPATH/ranlib
 ln -sf ../../../../bin/strip $FULLEPATH/strip
 %endif
 
@@ -1704,6 +1705,7 @@ fi
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/as
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/ld
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/nm
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/ranlib
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/strip
 %endif
 %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/crt*.o
@@ -2059,8 +2061,8 @@ fi
 %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/plugin
 
 %changelog
-* Wed Mar 06 2013 Marek Polacek <polacek>
-- add ar-symlink for gcc-ar (#917777)
+* Wed Mar 08 2013 Marek Polacek <polacek>
+- add ar and ranlib symlinks for gcc-ar and gcc-ranlib (#917777)
 
 * Wed Feb 20 2013 Jakub Jelinek <jakub> 4.8.0-0.14
 - sync from F19 gcc-4.8.0-0.14

Comment 6 Marek Polacek 2013-03-14 11:07:37 UTC
Applied as well.

Comment 11 Dagmar Prokopová 2013-04-08 14:13:39 UTC
Verified for devtoolset-2-gcc-4.8.0-1.

Comment 13 errata-xmlrpc 2013-09-10 06:34:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1226.html