From Fedora Project Wiki
(Scope)
Line 21: Line 21:
 
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
 
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
  
= Use update-alternatives for /usr/bin/cc <!-- The name of your change proposal --> =
+
= Use update-alternatives for /usr/bin/cc and /usr/bin/c++ <!-- The name of your change proposal --> =
  
 
== Summary ==
 
== Summary ==
Line 27: Line 27:
 
Note that motivation for the change should be in the Motivation section below, and this part should answer the question "What?" rather than "Why?". -->
 
Note that motivation for the change should be in the Motivation section below, and this part should answer the question "What?" rather than "Why?". -->
  
Modify the gcc package so that the /usr/bin/cc and /usr/bin/c++ symlinks are managed by update-alternatives. This will allow users to
+
Modify the gcc package so that the /usr/bin/cc and /usr/bin/c++ symlinks are managed by update-alternatives.
 
 
 
== Owner ==
 
== Owner ==
 
<!--  
 
<!--  
Line 62: Line 61:
 
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
 
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
  
The gcc package currently installs symlinks to /usr/bin/cc and /usr/bin/c++ which point to /usr/bin/gcc and /usr/bin/g++ respectively.  For this change, the gcc package will be modified so that the update-alternatives creates these symlinks.
+
The gcc package currently installs symlinks to /usr/bin/cc and /usr/bin/c++ which point to /usr/bin/gcc and /usr/bin/g++ respectively.  For this change, the gcc package will be modified so that update-alternatives creates these symlinks.
  
 
In addition to modifying the gcc package, the clang package will also be modified so that /usr/bin/clang and /usr/bin/clang++ can be used as alternatives for /usr/bin/cc /usr/bin/c++.  The clang alternatives will have a lower priority than the gcc alternatives, so that by default, gcc will provide the /usr/bin/cc and /usr/bin/c++ implementations.
 
In addition to modifying the gcc package, the clang package will also be modified so that /usr/bin/clang and /usr/bin/clang++ can be used as alternatives for /usr/bin/cc /usr/bin/c++.  The clang alternatives will have a lower priority than the gcc alternatives, so that by default, gcc will provide the /usr/bin/cc and /usr/bin/c++ implementations.
Line 68: Line 67:
 
The clang package currently has a run-time dependency on gcc, so this ensures that gcc will always provide the default implementation, because it's impossible to install clang without gcc.
 
The clang package currently has a run-time dependency on gcc, so this ensures that gcc will always provide the default implementation, because it's impossible to install clang without gcc.
  
The only way users will be able to change the /usr/bin/cc or /usr/bin/c++ implementations will be by explicitly making this change using the update-alternatives tool.
+
The only way users will be able to change the /usr/bin/cc or /usr/bin/c++ implementations will be by explicitly using the update-alternatives tool.
  
  
Line 145: Line 144:
 
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
 
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
  
Gating tests will be added to the gcc package to ensure that /usr/bin/cc and /usr/bin/c++ still point to /usr/bin/gcc and /usr/bin/g++ when installed.  There will also be a gating test added to the clang package to ensure that /usr/bin/gcc and /usr/bin/g++ remain the default when clang is installed.
+
CI tests will be added to the gcc package to ensure that /usr/bin/cc and /usr/bin/c++ still point to /usr/bin/gcc and /usr/bin/g++ when installed.  There will also be a CI test added to the clang package to ensure that /usr/bin/gcc and /usr/bin/g++ remain the default when clang is installed.
  
 
== User Experience ==
 
== User Experience ==

Revision as of 00:19, 11 December 2019

Important.png
Comments and Explanations
The page source contains comments providing guidance to fill out each section. They are invisible when viewing this page. To read it, choose the "view source" link.
Copy the source to a new page before making changes! DO NOT EDIT THIS TEMPLATE FOR YOUR CHANGE PROPOSAL.


Use update-alternatives for /usr/bin/cc and /usr/bin/c++

Summary

Modify the gcc package so that the /usr/bin/cc and /usr/bin/c++ symlinks are managed by update-alternatives.

Owner

Current status

  • Targeted release: Fedora 32
  • Last updated: 2019-12-11
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

The gcc package currently installs symlinks to /usr/bin/cc and /usr/bin/c++ which point to /usr/bin/gcc and /usr/bin/g++ respectively. For this change, the gcc package will be modified so that update-alternatives creates these symlinks.

In addition to modifying the gcc package, the clang package will also be modified so that /usr/bin/clang and /usr/bin/clang++ can be used as alternatives for /usr/bin/cc /usr/bin/c++. The clang alternatives will have a lower priority than the gcc alternatives, so that by default, gcc will provide the /usr/bin/cc and /usr/bin/c++ implementations.

The clang package currently has a run-time dependency on gcc, so this ensures that gcc will always provide the default implementation, because it's impossible to install clang without gcc.

The only way users will be able to change the /usr/bin/cc or /usr/bin/c++ implementations will be by explicitly using the update-alternatives tool.


Benefit to Fedora

Many build systems default to using /usr/bin/cc and /usr/bin/c++ as the default C/C++ compilers. Being able to easily swap out these implementation will provide a lot of flexibility within Fedora for doing things like setting up alternative buildroots for testing or adding a wrapper script around gcc to aid in implementing some kinds of system wide changes like changes to the default compiler flags.


Scope

  • Proposal owners: The proposal owner will implement the necessary changes in the gcc and clang packages.
  • Other developers: The gcc maintainers will be responsible for reviewing and approving changes to the gcc package.
  • Policies and guidelines: No policies or guidelines will need to be updated as a result of this change.
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

This change should not impact upgradeability.

How To Test

CI tests will be added to the gcc package to ensure that /usr/bin/cc and /usr/bin/c++ still point to /usr/bin/gcc and /usr/bin/g++ when installed. There will also be a CI test added to the clang package to ensure that /usr/bin/gcc and /usr/bin/g++ remain the default when clang is installed.

User Experience

This change will give users a much better way to experiment using other compilers for their own development. They will be able to easily switch between different compilers without having to modify their projects build system or make non-standard changes to their Fedora system.

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) Proposal Owner will revert changes made to gcc and clang packages and rebuild.
  • Contingency deadline: If the changes are not complete by 2 weeks before the mass rebuild, then we will consider postponing to the next Fedora release and back out any changes that were made.
  • Blocks release? No
  • Blocks product? None

Documentation

N/A (not a System Wide Change)

Release Notes