Skip to content

Commit

Permalink
Update and refactor Dockerfiles to newer Ubuntu
Browse files Browse the repository at this point in the history
The docker images all have new, simpler names and use Ubuntu 20.04
(instead of 18.04) as their base.

A few new tools have been added, specifically what is needed for:

- Linux on RISC-V - see #980
- Winodows on ARM - see #969

Fixes #976
  • Loading branch information
jonahgraham committed Dec 28, 2024
1 parent 344d715 commit dfdc174
Show file tree
Hide file tree
Showing 60 changed files with 199 additions and 344 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Dockerfile text
*.yaml text
*.yml text
.dockerignore text
uid_entrypoint text

# Qt
*.pro text
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-cleanliness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Run Check Code Cleanliness with Docker
uses: addnab/docker-run-action@v3
with:
image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install-github@sha256:6949adee26f78e9968e16d52bc3accfd7b51d0f16c473ad4b6f1caee849ab519
image: quay.io/eclipse-cdt/cdt-infra-github@sha256:6949adee26f78e9968e16d52bc3accfd7b51d0f16c473ad4b6f1caee849ab519
options: -v ${{ github.workspace }}:/work
run: |
set -x
Expand Down
4 changes: 2 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To build CDT plug-ins you need a standard Maven & Java development environment.
The CI build automatically run code cleanliness checks. To run them on your computer it is recommended to use the Docker image, for example like this from the root of the checked out CDT repo:

```sh
docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install:latest releng/scripts/check_code_cleanliness.sh
docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined quay.io/eclipse-cdt/cdt-infra:latest releng/scripts/check_code_cleanliness.sh
```

### Profiles
Expand Down Expand Up @@ -160,7 +160,7 @@ An additional tip is to set the following in `.gitconfig` to allow you to diff `

When the host is Windows, getting docker to behave as encoded in the pom.xml may be challenging, instead a command like this will probably work (replace your path to git root). Note that running this in git bash causes problems because of the /work in the command line arguments. (TODO integrate this command line way of running into the pom.xml so the original instructions work.)

`docker 'run' '--rm' '-t' '-v' 'D:\cdt\git\org.eclipse.cdt:/work' '-w' '/work/core/org.eclipse.cdt.core.native' 'quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest' 'make' '-C' 'native_src' 'rebuild'`
`docker 'run' '--rm' '-t' '-v' 'D:\cdt\git\org.eclipse.cdt:/work' '-w' '/work/core/org.eclipse.cdt.core.native' 'quay.io/eclipse-cdt/cdt-infra:latest' 'make' '-C' 'native_src' 'rebuild'`

See also `jniheaders` profile above.

6 changes: 6 additions & 0 deletions NewAndNoteworthy/CDT-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ This is the New & Noteworthy page for CDT 12.0 which is part of Eclipse 2025-03

# Release Notes

## Minimum version of GLIBC required

The minimum version of GLIBC required is now 2.31.
This version can be found in Ubuntu 20.04 and later, RHEL 9.0 and later and other distros as well.
CDT's native components will likely work with older versions of glibc too, assuming they provide the required APIs for Eclipse CDT.

# Managed Build

## Other objects for GNU archive files
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libpty.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified core/org.eclipse.cdt.core.macosx/os/macosx/aarch64/libpty.jnilib
Binary file not shown.
Binary file not shown.
Binary file modified core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libpty.jnilib
Binary file not shown.
Binary file not shown.
8 changes: 5 additions & 3 deletions core/org.eclipse.cdt.core.native/native_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ OS_DIR_LINUX_PPC64LE := ../../org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64l
OS_DIR_MACOS_X86_64 := ../../org.eclipse.cdt.core.macosx/os/macosx/x86_64
OS_DIR_MACOS_AARCH64 := ../../org.eclipse.cdt.core.macosx/os/macosx/aarch64

COMMON_CFLAGS := -Wall -pedantic -Werror
COMMON_CFLAGS := -Wall -pedantic -Werror -std=gnu11
COMMON_CCFLAGS := -Wall -pedantic -Werror -std=gnu++14

UNAME = $(shell uname)
ifeq ($(UNAME),Linux)
Expand All @@ -55,7 +56,8 @@ LIBS = \
$(OS_DIR_MACOS_AARCH64)/libpty.jnilib
else
ifeq ($(findstring ARM64,$(UNAME)),ARM64)
COMMON_CFLAGS := -Wall -pedantic
COMMON_CFLAGS := -Wall -pedantic -std=gnu11
COMMON_CCFLAGS := -Wall -pedantic -std=gnu++14
LIBS = \
$(OS_DIR_WIN32_AARCH64)/starter.exe \
$(OS_DIR_WIN32_AARCH64)/spawner.dll
Expand Down Expand Up @@ -127,7 +129,7 @@ $(OS_DIR_WIN32_X86_64)/spawner.dll: win/iostream.c win/raise.c win/spawner.c win
$(OS_DIR_WIN32_X86_64)/pty.dll: win/pty.cpp win/pty_dllmain.cpp win/util.c
mkdir -p $(dir $@) && \
$(REPRODUCIBLE_BUILD_WRAPPER) \
x86_64-w64-mingw32-g++ $(COMMON_CFLAGS) -o $@ -Iinclude -Iwin/include -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
x86_64-w64-mingw32-g++ $(COMMON_CCFLAGS) -o $@ -Iinclude -Iwin/include -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
-DUNICODE \
$^ \
-Wl,--kill-at --shared -L$(OS_DIR_WIN32_X86_64) -lwinpty -static-libstdc++ -static-libgcc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
}
}

static void close_all_fds() {
static void close_all_fds(void) {
unsigned int from_fd = STDERR_FILENO + 1;
if (sys_close_range_wrapper(from_fd) == 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
}
}

static void close_all_fds() {
static void close_all_fds(void) {
unsigned int from_fd = STDERR_FILENO + 1;
if (sys_close_range_wrapper(from_fd) == 0) {
return;
Expand Down
4 changes: 2 additions & 2 deletions core/org.eclipse.cdt.core.native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
<configuration>
<target>
<exec executable="docker" newenvironment="false" failOnError="true">
<!-- docker run -\-rm -t -v $(git rev-parse -\-show-toplevel):/work -w /work/$(git rev-parse -\-show-prefix) quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest make -C native_src rebuild -->
<!-- docker run -\-rm -t -v $(git rev-parse -\-show-toplevel):/work -w /work/$(git rev-parse -\-show-prefix) quay.io/eclipse-cdt/cdt-infra:latest make -C native_src rebuild -->
<arg value="run" />
<arg value="--rm" />
<arg value="-t" />
<arg value="-v" />
<arg value="${project.basedir}/../..:/work" />
<arg value="-w" />
<arg value="/work/core/org.eclipse.cdt.core.native" />
<arg value="quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest" />
<arg value="quay.io/eclipse-cdt/cdt-infra:latest" />
<arg value="make" />
<arg value="-C" />
<arg value="native_src" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 6 additions & 8 deletions docker/Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
Dockerfiles
============

The docker images for Eclipse CDT's [Jenkins instance](https://ci.eclipse.org/cdt/) are stored at [quay.io](https://quay.io/organization/eclipse-cdt)
and built using the following scripts. The individual directories below this one contain Dockerfiles which contain a little more information. Note that
the split between the Dockerfiles is somewhat arbitrary and historical. Only the cdt-infra-eclipse-full image is known to be referenced outside
of the cdt repo.
The docker images for Eclipse CDT's [Jenkins instance](https://ci.eclipse.org/cdt/) and [GitHub Action check code cleanliness](https://github.com/eclipse-cdt/cdt/blob/main/.github/workflows/code-cleanliness.yml) are stored at [quay.io](https://quay.io/organization/eclipse-cdt) and built using the following scripts.
The individual directories below this one contain Dockerfiles which contain a little more information.

build-images.sh
===============

Builds the images locally. A download of [Xcode_9.4.1.xip](https://download.developer.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip) (visit [here](https://developer.apple.com/download/more/) first to logon to Apple if needed) is needed to do a complete build. To save on rebuild times, the xip can be removed from the directory to use the cached cdt-infra-build-macos-sdk image.
Builds the images locally. A download of [Xcode_13.1.xip](https://download.developer.apple.com/Developer_Tools/Xcode_13.1.xip/Xcode_13.1.xip.xip) (visit [here](https://developer.apple.com/download/more/) first to logon to Apple if needed) is needed to do a complete build. To save on rebuild times, the xip can be removed from the directory to use the cached cdt-infra-build-macos-sdk image.

deploy-images.sh
================
Expand All @@ -20,14 +18,14 @@ updates all the Jenkinsfile and yaml files to refer to these new images.
Using the docker images
=======================

The docker images exist mostly for use in Jenkins, see the [pod templates](https://github.com/eclipse-cdt/cdt/blob/main/jenkins/pod-templates).
The docker images exist mostly for use in Jenkins and GitHub Actions, see the [pod templates](https://github.com/eclipse-cdt/cdt/blob/main/jenkins/pod-templates) and [workflows](https://github.com/eclipse-cdt/cdt/blob/main/.github/workflows/)

They can be used to recreate a consistent environment in other cases too. For example, you can run a full build on a machine that does not already have the tools by using docker:

```
docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest COMMAND HERE
docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined quay.io/eclipse-cdt/cdt-infra:latest COMMAND HERE
```

For examples of the above in practice, see [cdt-gdb-adapter's integration tests readme](https://github.com/eclipse-cdt/cdt-gdb-adapter/blob/master/src/integration-tests/README.md) and the native section of [CDT's readme](https://github.com/eclipse-cdt/cdt/blob/main/BUILDING.md#native)
For examples of the above in practice, see the native section of [CDT's building readme](https://github.com/eclipse-cdt/cdt/blob/main/BUILDING.md#native)


11 changes: 4 additions & 7 deletions docker/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ set -eux
# Xcode_13.1.xip is needed to build the OSx cross compiler image from https://developer.apple.com/download/all/?q=xcode
# As an optimization for the rebuild times, the image is only built if the xip is present.
if [ -f Xcode_13.1.xip ]; then
docker build --rm --build-arg Xcodexip=Xcode_13.1.xip -f cdt-infra-build-macos-sdk/ubuntu-18.04/Dockerfile -t cdt-infra-build-macos-sdk:ubuntu-18.04 .
docker build --rm --build-arg Xcodexip=Xcode_13.1.xip -f cdt-infra-build-macos-sdk/Dockerfile -t cdt-infra-build-macos-sdk:latest .
else
echo "MacOSX SDK & Toolchain build is being skipped"
fi

docker build --rm -f cdt-infra-base/ubuntu-18.04/Dockerfile -t cdt-infra-base:ubuntu-18.04 .
docker build --rm -f cdt-infra-all-gdbs/ubuntu-18.04/Dockerfile -t cdt-infra-all-gdbs:ubuntu-18.04 .
docker build --rm -f cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile -t cdt-infra-eclipse-full:ubuntu-18.04 .
docker build --rm -f cdt-infra-plus-eclipse-install/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install:ubuntu-18.04 .
docker build --rm -f cdt-infra-plus-eclipse-install-github/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install-github:ubuntu-18.04 .
docker build --rm -f cdt-infra-plus-node/ubuntu-18.04/Dockerfile -t cdt-infra-plus-node:ubuntu-18.04 .
docker build --rm -f cdt-infra/Dockerfile -t cdt-infra:latest .
docker build --rm -f cdt-infra-github/Dockerfile -t cdt-infra-github:latest .
docker build --rm -f cdt-infra-jipp/Dockerfile -t cdt-infra-jipp:latest .
26 changes: 0 additions & 26 deletions docker/cdt-infra-all-gdbs/Readme.md

This file was deleted.

42 changes: 0 additions & 42 deletions docker/cdt-infra-all-gdbs/ubuntu-18.04/Dockerfile

This file was deleted.

2 changes: 0 additions & 2 deletions docker/cdt-infra-base/Readme.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# This dockerfile is used to build the MacOSX SDK
FROM ubuntu:18.04
FROM ubuntu:20.04

RUN apt-get update
RUN apt-get install -y clang make build-essential
RUN apt-get install -y libssl-dev lzma-dev liblzma-dev libxml2-dev git patch python cpio bzip2 xz-utils libbz2-dev
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y clang make build-essential libssl-dev lzma-dev liblzma-dev libxml2-dev git patch python3 cpio bzip2 xz-utils libbz2-dev curl

# cmake in Ubuntu is too old to build osxcross, therefore
# use this version
RUN apt-get install -y curl
RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-x86_64.tar.gz | tar xzf - -C /usr/share
ENV PATH="/usr/share/cmake-3.29.2-linux-x86_64/bin:${PATH}"


# Xcode_13.1.xip needs to be downloaded from
# https://developer.apple.com/download/all/?q=xcode - specically:
ARG Xcodexip=Xcode_13.1.xip
Expand All @@ -29,7 +25,7 @@ ENV UNATTENDED=1
RUN cd /opt/osxcross && ./build.sh

# Start next stage build
FROM ubuntu:18.04
FROM ubuntu:20.04
COPY --from=0 /opt/osxcross/target /opt/osxcross/target
ENV PATH="/opt/osxcross/target/bin:${PATH}"
# At this point the osxcross toolchain is not usable,
Expand Down
61 changes: 0 additions & 61 deletions docker/cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile

This file was deleted.

9 changes: 9 additions & 0 deletions docker/cdt-infra-github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM cdt-infra:latest
USER root

RUN chown -R 1001:0 ${HOME} \
&& chmod -R g+rwX ${HOME}

USER 1001

CMD ["/home/vnc/.vnc/xstartup.sh"]
File renamed without changes.
9 changes: 9 additions & 0 deletions docker/cdt-infra-jipp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM cdt-infra:latest
USER root

RUN chown -R 1000:0 ${HOME} \
&& chmod -R g+rwX ${HOME}

USER 1000

CMD ["/home/vnc/.vnc/xstartup.sh"]
File renamed without changes.

This file was deleted.

Loading

0 comments on commit dfdc174

Please sign in to comment.