Skip to content

Conversation

gowthamsk-arm
Copy link
Contributor

@gowthamsk-arm gowthamsk-arm commented Jul 20, 2023

This commit updates the Ubuntu 16.04 docker file to include the earliest versions of GCC (4.7) and Clang (3.5) available in 16.04. For Ubuntu 22.04 the latest compiler versions of GCC (12) and Clang (16) are installed.

Also creates couple of symlinks of those compilers for simplified usage in the all.sh script.

all.sh will start using the new compiler versions in Mbed-TLS/mbedtls#7968 and Mbed-TLS/mbedtls#7969.

Resolves #110

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Jul 21, 2023

Test jobs on OpenCI:

Test jobs on internal CI:

@gowthamsk-arm gowthamsk-arm marked this pull request as ready for review July 25, 2023 13:36
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

A few minor change requests.

The test results look good, but we'll have to re-run at least some after updating the docker files.

rm -rf /var/lib/apt/lists/
rm -rf /var/lib/apt/lists/ && \
# create symbolic links for earliest gcc and clang versions
ln -s /usr/bin/gcc-4.7 /usr/bin/gcc-earliest && \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create the symlinks in /usr/local/bin. /usr is for what comes with the distribution. Also applies in the 22.04 dockerfile.


RUN apt-get update -q && apt-get install -yq \
# provides some useful scripts for adding and removing repositories
software-properties-common && \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please group all the installations from the standard repository in the same batch. It makes the file easier to read and the caching of intermediate steps more efficient.

apt-get install -yq \
# to build Mbed TLS using latest clang version
clang-16 \
# to build Mbed TLS using latest gcc version
Copy link
Contributor

Choose a reason for hiding this comment

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

More precisely, latest gcc version available from Ubuntu.

# add an apt package source from https://apt.llvm.org/ to install clang-16
add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' -y && \
apt-get install -yq \
# to build Mbed TLS using latest clang version
Copy link
Contributor

Choose a reason for hiding this comment

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

More precisely, the latest clang version at the time of writing. (As opposed to: at the time the docker image is built, or at the time the tests run.)

This commit updates the Ubuntu 16.04 dockerfile to include the
earliest versions of GCC (4.7) and Clang (3.5) available in
16.04. For Ubuntu 22.04 the latest compiler versions of GCC (12)
and Clang (16) are installed.

Also creates couple of symlinks of those compilers for
simplified usage in the all.sh.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
Signed-off-by: Gowtham Suresh Kumar <[email protected]>
@gowthamsk-arm gowthamsk-arm force-pushed the dev/gowsur01/add-latest-compilers branch from bd7c707 to 2c78a19 Compare July 26, 2023 14:28
@gowthamsk-arm
Copy link
Contributor Author

Test jobs on OpenCI:

development → PASS
mbedtls-2.28 → PASS
use_earliest_latest_compilers → PASS
use_earliest_latest_compilers_2.28 → PASS

Test jobs on internal CI:

use_earliest_latest_compilers → PASS
use_earliest_latest_compilers-2.28 → PASS

Copy link

@tgonzalezorlandoarm tgonzalezorlandoarm left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

Just a few readability issues

# to build Mbed TLS with MBEDTLS_ZILIB_SUPPORT (removed in 3.0)
zlib1g-dev \
# to build Mbed TLS using latest gcc version available from Ubuntu
gcc-12 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep the list in alphabetical order, it makes it easier to eyeball what's in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix it.

# For installing clang-16, we add the llvm package source and add corresponding key
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 15CF4D18AF4F7421 \
# add an apt package source from https://apt.llvm.org/
&& add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' -y \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please be consistent about putting && at the end or beginning of the line. In this file the convention is end of line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will change it.


# For installing clang-16, we add the llvm package source and add corresponding key
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 15CF4D18AF4F7421 \
# add an apt package source from https://apt.llvm.org/
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use more indentation when continuing arguments of a command than when starting a new command after &&. Following the established pattern, this line should be intended to 4 spaces, and the list of arguments to apt-get install should be intented to 8 spaces.

@gilles-peskine-arm
Copy link
Contributor

Note: in the future, please address review comments in new commits, rather than by pushing a new history, unless there's a good reason to overwrite the existing history.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

Looks good to me on code review. I'll check the CI logs when it's run on the latest release (no need to re-run all jobs, but at least build the image on both jenkins instances).

@gowthamsk-arm
Copy link
Contributor Author

Thanks for the review :)
I will trigger a job on both internal and external CIs.

@gowthamsk-arm
Copy link
Contributor Author

@gowthamsk-arm
Copy link
Contributor Author

Both internal and external CI runs are green :)

@gilles-peskine-arm gilles-peskine-arm added the approved Approved in review. May need additional CI. label Jul 28, 2023
@gilles-peskine-arm gilles-peskine-arm merged commit c91b434 into master Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved in review. May need additional CI. enhancement New feature or request priority-medium size-s Estimated task size: small (~2d)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add earliest/latest gcc and clang to Docker images

3 participants