RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2162498 - g++ doesn't call the as inside /opt/rh/gcc-toolset-11/, but calls the system as when executed outside of scl enable
Summary: g++ doesn't call the as inside /opt/rh/gcc-toolset-11/, but calls the system ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gcc
Version: 8.7
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Cermak
QA Contact: Václav Kadlčík
URL:
Whiteboard:
Depends On:
Blocks: 2164262
TreeView+ depends on / blocked
 
Reported: 2023-01-19 17:59 UTC by Teodor Petrov
Modified: 2023-05-16 09:20 UTC (History)
5 users (show)

Fixed In Version: gcc-toolset-12-gcc-12.2.1-7.3.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2164262 (view as bug list)
Environment:
Last Closed: 2023-05-16 08:25:42 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-145844 0 None None None 2023-01-19 18:01:49 UTC
Red Hat Product Errata RHBA-2023:2766 0 None None None 2023-05-16 08:26:07 UTC

Description Teodor Petrov 2023-01-19 17:59:09 UTC
Description of problem:
In RHEL/CentOS 7 calling /opt/rh/devtoolset-x/root/usr/bin/g++ worked just fine.
It seems this is not the case with g++ from gcc-toolset-11 on RHEL8 (Rocky Linux 8.7 in particular).
It seems that the correct version of `as` is expected to be in path and g++ is not using an absolute path as before.

Version-Release number of selected component (if applicable):

$ rpm -qa | grep gcc-tool
gcc-toolset-11-libstdc++-devel-11.2.1-9.1.el8.x86_64
gcc-toolset-11-binutils-2.36.1-2.el8.x86_64
gcc-toolset-11-gcc-11.2.1-9.1.el8.x86_64
gcc-toolset-11-runtime-11.1-1.el8.x86_64
gcc-toolset-11-gcc-c++-11.2.1-9.1.el8.x86_64
$ cat /etc/redhat-release 
Rocky Linux release 8.7 (Green Obsidian)

How reproducible:

Steps to Reproduce:
1. create /tmp/main.cpp, hello world is fine
2. /opt/rh/gcc-toolset-11/root/usr/bin/g++ -g -o /tmp/main /tmp/main.cpp

Actual results:
$ /opt/rh/gcc-toolset-11/root/usr/bin/g++ -o /tmp/main /tmp/main.cpp  -g
as: unrecognized option '--gdwarf-4'

Expected results:
Just working and producing executable.
If you repeat the steps but add 'scl enable gcc-toolset-11 bash' before calling the compiler it works as expected.

Comment 1 Marek Polacek 2023-01-19 18:07:35 UTC
You're not supposed to invoke /opt/rh/gcc-toolset-11/root/usr/bin/g++ directly; please use the scl wrapper which sets the correct paths.

Comment 2 Teodor Petrov 2023-01-19 18:22:41 UTC
Then why it works for almost everything else? And it worked fine in RHEL7?
For example just remove -g and it would work fine.

I'm trying to use this compiler from really complicated cmake based build system, so if the compiler just works without wrappers it would make things a lot easier.
And I know that it is possible thing to do, gcc-toolset-11's behaviour is a regression. If you're interested I can tell you which version broke it. :)
I think devtoolset-11 works just fine on RHEL7 (not at the machine at the moment to test it), so it is not a change in the compiler that breaks it, its the gcc-toolset magic that has changed somehow.

Comment 3 Marek Polacek 2023-01-19 23:16:09 UTC
This is weird.  On RHEL7 we invoke as using an absolute path:
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/as -v --gdwarf-4 --64 -o /tmp/ccNc0s3g.o /tmp/cczag1QK.s
but on RHEL8:
as -v --gdwarf-4 --64 -o /tmp/ccVk1z9s.o /tmp/cczlheMY.s

I don't see anything in the gcc spec file that would explain the difference.  This happens with gcc-toolset-9 as well.

Running
/opt/rh/gcc-toolset-12/root/usr/bin/gcc -g x.c
works even though the system as is used because --gdwarf-4 isn't passed to as.

Comment 4 Teodor Petrov 2023-01-20 09:25:29 UTC
I can make several guesses about the root cause:
1. There is a difference in some patch that you apply.
2. There is a configure test which has different result on RHEL7 and RHEL8.
3. There is a difference in the common environment setup between the two OSes.

Given this new information would you reclassify this as an actual bug, so it can be resolved?

Comment 5 Marek Polacek 2023-01-24 23:45:10 UTC
Gah.  The problem is trivial -- we're not shipping certain symlinks on RHEL8+:

%if 0%{?scl:1}
%if 0%{?rhel} <= 7 
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/ar
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/as
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/ld
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/ld.bfd
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/ld.gold
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/nm
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/objcopy
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/ranlib
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/strip
%endif
%endif

I'm going to fix this in GTS 12.1; I don't think it's intentional that the symlinks are missing on RHEL8.

Sorry for closing the BZ prematurely.

Comment 7 Teodor Petrov 2023-01-26 16:08:15 UTC
Is there any chance to fix this in gcc-toolset-11?
I actually need to use this particular compiler, because I need to build software that conforms to vfxplatform CY2023 (https://vfxplatform.com/).

Thanks.

Comment 8 Marek Polacek 2023-01-26 16:35:01 UTC
(In reply to Teodor Petrov from comment #7)
> Is there any chance to fix this in gcc-toolset-11?
> I actually need to use this particular compiler, because I need to build
> software that conforms to vfxplatform CY2023 (https://vfxplatform.com/).
> 
> Thanks.

Sorry, I couldn't justify making an update for GTS 11 at this point.  Especially since this usage is technically unsupported.
As a workaround, you could probably create the symlinks by yourself, or adjust PATH.  Sorry.

Comment 9 Teodor Petrov 2023-01-26 16:43:38 UTC
OK. I'll handle this locally somehow.
Do you have a public git/svn/cvs repo where you maintain the SPEC files for these packages?

Comment 10 Marek Polacek 2023-01-26 16:48:52 UTC
(In reply to Teodor Petrov from comment #9)
> OK. I'll handle this locally somehow.

Thanks.

> Do you have a public git/svn/cvs repo where you maintain the SPEC files for
> these packages?

Yeah, I think you can take a look at it in gitlab:
https://gitlab.com/redhat/centos-stream/rpms/gcc/-/tree/scl-gcc-toolset-12-rhel-9.2.0

Comment 17 errata-xmlrpc 2023-05-16 08:25:42 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 (gcc-toolset-12-gcc bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2023:2766


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