From Fedora Project Wiki
(Created page with "<!-- Self Contained or System Wide Change Proposal? Use this guide to determine to which category your proposed change belongs to. Self Contained Changes are: * changes to is...")
 
(Change dropped due to upstream not merging patch)
 
(27 intermediate revisions by 2 users not shown)
Line 19: Line 19:
<!-- 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 -->


= Add LDD as update alternatives option for LD =
= Use update-alternatives for /usr/bin/cc and /usr/bin/c++ <!-- The name of your change proposal --> =


== Summary ==
== Summary ==
Line 25: Line 25:
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?". -->


Allow users to optionally use update-alternatives to make /usr/bin/ld point to /usr/bin/lld.
Modify the gcc package so that the /usr/bin/cc and /usr/bin/c++ symlinks are managed by update-alternatives.
 
== Owner ==
== Owner ==
<!--  
<!--  
Line 44: Line 43:


== Current status ==
== Current status ==
* Targeted release: [[Releases/31 | Fedora 31 ]]  
* Targeted release: [[Releases/34| Fedora 34 ]]  
* Last updated: <!-- this is an automatic macro — you don't need to change this line -->  {{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}}  
* Last updated: <!-- this is an automatic macro — you don't need to change this line -->  {{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}}  
<!-- After the change proposal is accepted by FESCo, tracking bug is created in Bugzilla and linked to this page  
<!-- After the change proposal is accepted by FESCo, tracking bug is created in Bugzilla and linked to this page  
Line 53: Line 52:
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
-->
-->
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=1739973 #1739973]
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=1790581 #1790581]
* Release notes tracker: [https://pagure.io/fedora-docs/release-notes/issue/371 #371]
* Release notes tracker: [https://pagure.io/fedora-docs/release-notes/issue/431 #431]


== Detailed Description ==
== Detailed Description ==
Line 60: Line 59:
<!-- 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. -->


Update the lld package %post and %postun steps to configure the system so that a user can use the update-alternatives tool to create a symlink from /usr/bin/ld to /usr/bin/lldThis will effectively allow lld to act as the system linker and make it easier for users to integrate lld into their projects.  This same functionality is currently available with one other non-system linker: gold.
The gcc package currently installs symlinks to /usr/bin/cc and /usr/bin/c++ which point to /usr/bin/gcc and /usr/bin/g++ respectivelyFor this change, the gcc package will be modified so that update-alternatives creates and manages these symlinks.


I want to be clear that this proposal is not about making lld the system linker or using lld during brew builds.  This is simply about making it easier for end-users to use lld with their own projects.
In addition to modifying the gcc package, the clang package will be modified so that /usr/bin/clang and /usr/bin/clang++ can be used as alternatives for /usr/bin/cc and /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 ==
== Benefit to Fedora ==
Line 94: Line 97:
-->
-->


This change will make it much easier for users to try out lld in their projects.  Many build systems and compilers assume that the linker is /usr/bin/ld, and it is very difficult to seamlessly integrate lld into existing build systems. With this proposal a user will be able to easily switch between ld.bfd and lld without having to make any modifications to their build systems.
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.
* Installing a gcc wrapper script to /usr/bin/cc to help migrate packages to new compiler flags or to capture statistics about compiler usage.
* Letting users experiment easily with alternate compilers.
* Easily switch between system gcc and a development version of gcc.


== Scope ==
== Scope ==
* Proposal owners: tstellar
* Proposal owners: The proposal owner will implement the necessary changes in the gcc and clang packages.
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


* Other developers: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Other developers: The gcc maintainers will be responsible for reviewing and approving changes to the gcc package. <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- What work do other developers have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do other developers have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


* Release engineering: [https://pagure.io/releng/issues #Releng issue number] (a check of an impact with Release Engineering is needed) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Release engineering: [https://pagure.io/releng/issues/9120] (a check of an impact with Release Engineering is needed) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing, and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing, and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->


* Policies and guidelines: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Policies and guidelines: No policies or guidelines will need to be updated as a result of this change. <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. -->
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. -->


Line 117: Line 125:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
 
This change should not impact upgradeability.


== How To Test ==
== How To Test ==
Line 136: Line 145:
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->


Tests for this change will be added to the lld package's CI tests.  One test will install lld and verify that /usr/bin/ld.bfd is still the system linker.  Another test will use update-alternatives to update /usr/bin/ld to point to /usr/bin/lld and then it will run /usr/bin/ld --version to verify that this correctly points to lld and then link a simple program with it.
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 ==
Line 150: Line 159:
-->
-->


This will greatly enhance the experience for users who want to use lld.  They will be able to try lld with their projects by simply running `update-alternatives --set ld /usr/bin/lld` instead of having to make modifications to existing build systems.
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 ==
== Dependencies ==
Line 156: Line 165:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
 
This change has no other dependencies besides the changes to the gcc and clang packages.


== Contingency Plan ==
== Contingency Plan ==


<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
* Contingency mechanism: (What to do?  Who will do it?) N/A (not a System Wide Change)  <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency mechanism: (What to do?  Who will do it?) Proposal Owner will revert changes made to gcc and clang packages and rebuild.
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
* Contingency deadline: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* 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. <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
* Blocks release? N/A (not a System Wide Change), Yes/No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks release? No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks product? N/A <!-- Applicable for Changes that blocks specific product release/Fedora.next -->
* Blocks product? None <!-- Applicable for Changes that blocks specific product release/Fedora.next -->


== Documentation ==
== Documentation ==
Line 172: Line 182:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)
Release notes will be added for this change.


== Release Notes ==
== Release Notes ==
Line 181: Line 191:
-->
-->


[[Category:ChangeAcceptedF31]]
The user /usr/bin/cc and /usr/bin/c++ symlinks are now managed by update-alternatives.  If you would like to change these symlinks to point to another compiler, like clang, for example, you can use these commands:
 
`update-alternatives --set cc /usr/bin/clang`
 
`update-alternatives --set c++ /usr/bin/clang++`
 
[[Category:ChangePageIncomplete]]
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
Line 188: Line 204:


<!-- Select proper category, default is Self Contained Change -->
<!-- Select proper category, default is Self Contained Change -->
[[Category:SelfContainedChange]]
<!--[[Category:SelfContainedChange]]-->
<!-- [[Category:SystemWideChange]] -->
[[Category:SystemWideChange]]

Latest revision as of 15:20, 11 February 2021


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

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 and manages these symlinks.

In addition to modifying the gcc package, the clang package will be modified so that /usr/bin/clang and /usr/bin/clang++ can be used as alternatives for /usr/bin/cc and /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.
  • Installing a gcc wrapper script to /usr/bin/cc to help migrate packages to new compiler flags or to capture statistics about compiler usage.
  • Letting users experiment easily with alternate compilers.
  • Easily switch between system gcc and a development version of gcc.

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.
  • Release engineering: [1] (a check of an impact with Release Engineering is needed)
  • 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

This change has no other dependencies besides the changes to the gcc and clang packages.

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

Release notes will be added for this change.

Release Notes

The user /usr/bin/cc and /usr/bin/c++ symlinks are now managed by update-alternatives. If you would like to change these symlinks to point to another compiler, like clang, for example, you can use these commands:

update-alternatives --set cc /usr/bin/clang

update-alternatives --set c++ /usr/bin/clang++