Skip to content

[cpp] - Introducing new option for c++ template to install gcc from source. #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Kaniska244
Copy link
Contributor

Ref# devcontainers/images#1280

Description: New option to be introduced reinstallGccVersionFromSource to reinstall the gcc version from source overriding the default version provided by the OS.

Changelog: Following changes done for this PR.

  • /src/cpp/.devcontainer/Dockerfile - Changed to introduce new option reinstallGccVersionFromSource.
  • /src/cpp/.devcontainer/reinstall-gcc.sh - Added new script to reinstall gcc from source.
  • /src/cpp/README.md - Updated the README with the new option details.
  • /src/cpp/devcontainer-template.json - Updated the devcontainer template to define the new option.
  • /test/cpp/test-utils.sh - Added test utilities for the tests to execute.
  • /test/cpp/test.sh - Added test cases to validate the new option.

Checklist:

  • Checked that applied changes work as expected

@Mathiyarasy Mathiyarasy self-requested a review April 28, 2025 08:40
@Kaniska244 Kaniska244 marked this pull request as ready for review April 29, 2025 11:34
@Kaniska244 Kaniska244 requested a review from a team as a code owner April 29, 2025 11:34
if command -v gcc &>/dev/null; then
installed_version=$(gcc -dumpfullversion)
if [ "$(printf '%s\n' "$installed_version" "$GCC_VERSION" | sort -V | tail -n1)" = "$installed_version" ]; then
echo "Installed GCC version ($installed_version) is equal or newer than requested version ($GCC_VERSION). Skipping installation."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why the installation should be skipped in this scenario? I interpret the introduced reinstallGccVersionFromSource option as a request from the image user to install one specific GCC version. This condition here turns that option into a specifying a minimum GCC version instead of a specific version.

Copy link
Contributor Author

@Kaniska244 Kaniska244 May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale behind this is that if the default GCC version is higher than that of the one specified in the template, then its better to retain the default one as it would already contain better features compared to the given GCC version in the template. Besides the actual issue was created to be able to use GCC 14 & 15 versions which were not available by default with the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants