Skip to content

Commit

Permalink
Merge pull request #290 from microsoft/hostedlinuxbuild
Browse files Browse the repository at this point in the history
Move build toolchain to LLVM 18
  • Loading branch information
abeltrano authored Jun 28, 2024
2 parents 8a5b648 + 401e748 commit 8067d9a
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 154 deletions.
96 changes: 49 additions & 47 deletions .docker/netremote-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

FROM ubuntu:mantic as netremote-build
FROM ubuntu:noble as netremote-build

# Set arguments used only in this Dockerfile.
ARG BUILD_DATE="2024-02-28T21:09:49+00:00"
ARG BUILD_DATE="2024-06-20T16:36:23Z"
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_ARGS_COMMON="-yqq --no-install-recommends"

Expand All @@ -22,13 +22,13 @@ LABEL org.label-schema.schema-version = "1.0"
# sudo apt -y update && sudo apt -y upgrade
#
# 2. Install core build tools and dependencies:
# sudo apt install -y --no-install-recommends autoconf automake autopoint build-essential ca-certificates cmake curl dotnet7 git gnupg libltdl-dev libmount-dev libtool linux-libc-dev ninja-build pkg-config python3-jinja2 tar unzip zip
# sudo apt install -y --no-install-recommends autoconf automake autopoint build-essential ca-certificates cmake curl dotnet7 git gnupg libltdl-dev libmount-dev libtool linux-libc-dev libstdc++-14-dev ninja-build pkg-config python3-jinja2 tar unzip zip
#
# 3. Install complete LLVM 17 + clang 17 toolchain:
# sudo apt install -y --no-install-recommends libllvm-17-ocaml-dev libllvm17 llvm-17 llvm-17-dev llvm-17-doc llvm-17-examples llvm-17-runtime clang-17 clang-tools-17 clang-17-doc libclang-common-17-dev libclang-17-dev libclang1-17 clang-format-17 python3-clang-17 clangd-17 clang-tidy-17 libclang-rt-17-dev libpolly-17-dev libfuzzer-17-dev lldb-17 lld-17 libc++-17-dev libc++abi-17-dev libomp-17-dev libclc-17-dev libunwind-17-dev libmlir-17-dev mlir-17-tools libbolt-17-dev bolt-17 flang-17 libclang-rt-17-dev-wasm32 libclang-rt-17-dev-wasm64 libc++-17-dev-wasm32 libc++abi-17-dev-wasm32 libclang-rt-17-dev-wasm32 libclang-rt-17-dev-wasm64
# 3. Install complete LLVM 18 + clang toolchain:
# sudo apt install -y --no-install-recommends libllvm-18-ocaml-dev libllvm18 llvm-18 llvm-18-dev llvm-18-doc llvm-18-examples llvm-18-runtime clang-18 clang-tools-18 clang-18-doc libclang-common-18-dev libclang-18-dev libclang1-18 clang-format-18 python3-clang-18 clangd-18 clang-tidy-18 libclang-rt-18-dev libpolly-18-dev libfuzzer-18-dev lldb-18 libc++-18-dev libc++abi-18-dev libomp-18-dev libclc-18-dev libunwind-18-dev libmlir-18-dev mlir-18-tools libbolt-18-dev bolt-18 flang-18 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libc++-18-dev-wasm32 libc++abi-18-dev-wasm32 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libllvmlibc-18-dev
#
# 4. Install other development dependencies and helpful tools:
# sudo apt install -y --no-install-recommends bc bison dwarves flex libelf-dev dos2unix file gnupg2 iproute2 mtools neofetch rsync ssh sudo emacs gdb kmod nano policycoreutils-python-utils python-is-python3 vim
# sudo apt install -y -qq --no-install-recommends bc bison dwarves flex libelf-dev dos2unix file gnupg2 iproute2 mtools neofetch rsync ssh sudo emacs gdb kmod nano policycoreutils-python-utils python-is-python3 vim
#
# 5. Install hostapd development dependencies and tools:
# sudo apt install -y libnl-3-dev libssl-dev libnl-genl-3-dev libnl-3-dev libdbus-c++-dev libnl-route-3-dev flex bison dwarves libelf-dev bc iw debconf-utils
Expand All @@ -47,59 +47,59 @@ RUN apt-get $APT_ARGS_COMMON update && \
ca-certificates \
cmake \
curl \
dotnet7 \
git \
gnupg \
libltdl-dev \
libmount-dev \
libtool \
linux-libc-dev \
libstdc++-14-dev \
ninja-build \
pkg-config \
python3-jinja2 \
tar \
unzip \
zip \
# LLVM + Clang toolchain.
# libllvm-17-ocaml-dev libllvm17 llvm-17 llvm-17-dev llvm-17-doc llvm-17-examples llvm-17-runtime clang-17 clang-tools-17 clang-17-doc libclang-common-17-dev libclang-17-dev libclang1-17 clang-format-17 python3-clang-17 clangd-17 clang-tidy-17 libclang-rt-17-dev libpolly-17-dev libfuzzer-17-dev lldb-17 lld-17 libc++-17-dev libc++abi-17-dev libomp-17-dev libclc-17-dev libunwind-17-dev libmlir-17-dev mlir-17-tools libbolt-17-dev bolt-17 flang-17 libclang-rt-17-dev-wasm32 libclang-rt-17-dev-wasm64 libc++-17-dev-wasm32 libc++abi-17-dev-wasm32 libclang-rt-17-dev-wasm32 libclang-rt-17-dev-wasm64
bolt-17 \
clang-17 \
clang-17-doc \
clang-format-17 \
clang-tidy-17 \
clang-tools-17 \
clangd-17 \
flang-17 \
libbolt-17-dev \
libc++-17-dev \
libc++-17-dev-wasm32 \
libc++abi-17-dev \
libc++abi-17-dev-wasm32 \
libclang-17-dev \
libclang-common-17-dev \
libclang-rt-17-dev \
libclang-rt-17-dev-wasm32 \
libclang-rt-17-dev-wasm32 \
libclang-rt-17-dev-wasm64 \
libclang-rt-17-dev-wasm64 \
libclang1-17 \
libclc-17-dev \
libfuzzer-17-dev \
libllvm-17-ocaml-dev \
libllvm17 \
libmlir-17-dev \
libomp-17-dev \
libpolly-17-dev \
libunwind-17-dev \
lld-17 \
lldb-17 \
llvm-17 \
llvm-17-dev \
llvm-17-doc \
llvm-17-examples \
llvm-17-runtime \
mlir-17-tools \
python3-clang-17 \
# LLVM + Clang 18 toolchain.
# libllvm-18-ocaml-dev libllvm18 llvm-18 llvm-18-dev llvm-18-doc llvm-18-examples llvm-18-runtime clang-18 clang-tools-18 clang-18-doc libclang-common-18-dev libclang-18-dev libclang1-18 clang-format-18 python3-clang-18 clangd-18 clang-tidy-18 libclang-rt-18-dev libpolly-18-dev libfuzzer-18-dev lldb-18 libc++-18-dev libc++abi-18-dev libomp-18-dev libclc-18-dev libunwind-18-dev libmlir-18-dev mlir-18-tools libbolt-18-dev bolt-18 flang-18 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libc++-18-dev-wasm32 libc++abi-18-dev-wasm32 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libllvmlibc-18-dev
libllvm-18-ocaml-dev \
libllvm18 \
llvm-18 \
llvm-18-dev \
llvm-18-doc \
llvm-18-examples \
llvm-18-runtime \
clang-18 \
clang-tools-18 \
clang-18-doc \
libclang-common-18-dev \
libclang-18-dev \
libclang1-18 \
clang-format-18 \
python3-clang-18 \
clangd-18 \
clang-tidy-18 \
libclang-rt-18-dev \
libpolly-18-dev \
libfuzzer-18-dev \
lldb-18 \
libc++-18-dev \
libc++abi-18-dev \
libomp-18-dev \
libclc-18-dev \
libunwind-18-dev \
libmlir-18-dev \
mlir-18-tools \
libbolt-18-dev \
bolt-18 \
flang-18 \
libclang-rt-18-dev-wasm32 \
libclang-rt-18-dev-wasm64 \
libc++-18-dev-wasm32 \
libc++abi-18-dev-wasm32 \
libclang-rt-18-dev-wasm32 \
libclang-rt-18-dev-wasm64 \
libllvmlibc-18-dev \
# hostapd build dependencies.
# libnl-3-200-dbg libnl-3-dev libssl-dev libnl-genl-3-dev
libnl-3-200-dbg \
Expand Down Expand Up @@ -174,8 +174,10 @@ RUN apt-get $APT_ARGS_COMMON update && \
python-is-python3 \
vim \
# Wireless tools.
# iw
iw \
# Packaging tools.
# debconf-utils
debconf-utils \
&& \
# Reduce image size by removing package cache.
Expand Down
39 changes: 24 additions & 15 deletions .github/actions/build-with-host/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name: 'build-on-host'
description: 'Build the repository on the runner host system'
inputs:
os:
required: true
description: 'The target operating system to build for'
build-type:
required: false
default: 'Debug'
Expand All @@ -24,7 +27,7 @@ inputs:
description: 'Publish build artifacts'
preset-name:
required: false
default: 'dev-windows'
default: 'dev'
description: 'The name of the preset to use for all CMake operations (configure, build, test, install, package)'

runs:
Expand All @@ -36,43 +39,49 @@ runs:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_DEFAULT_BINARY_CACHE', 'C:/vcpkg/archive');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite');
- name: Install vcpkg dependencies with Github Actions Cache
- name: Install Linux build dependencies
if: ${{ inputs.os == 'linux' }}
run: |
echo "VCPKG_DEFAULT_BINARY_CACHE=${VCPKG_DEFAULT_BINARY_CACHE}" >> "${GITHUB_ENV}"
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "${GITHUB_ENV}"
New-Item -Path ${env:VCPKG_DEFAULT_BINARY_CACHE} -ItemType Directory -Force
shell: pwsh
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get update
sudo -E apt-get upgrade
# Install core build dependencies
sudo -E apt-get install -qq --no-install-recommends autoconf automake autopoint build-essential ca-certificates cmake curl git gnupg libltdl-dev libmount-dev libtool linux-libc-dev libstdc++-14-dev ninja-build pkg-config python3-jinja2 tar unzip zip
# Install LLVM 18 toolchain
sudo -E apt-get install -qq --no-install-recommends libllvm-18-ocaml-dev libllvm18 llvm-18 llvm-18-dev llvm-18-doc llvm-18-examples llvm-18-runtime clang-18 clang-tools-18 clang-18-doc libclang-common-18-dev libclang-18-dev libclang1-18 clang-format-18 python3-clang-18 clangd-18 clang-tidy-18 libclang-rt-18-dev libpolly-18-dev libfuzzer-18-dev lldb-18 libc++-18-dev libc++abi-18-dev libomp-18-dev libclc-18-dev libunwind-18-dev libmlir-18-dev mlir-18-tools libbolt-18-dev bolt-18 flang-18 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libc++-18-dev-wasm32 libc++abi-18-dev-wasm32 libclang-rt-18-dev-wasm32 libclang-rt-18-dev-wasm64 libllvmlibc-18-dev
# Install hostapd dependencies
sudo -E apt-get install -qq --no-install-recommends libnl-3-200-dbg libnl-3-dev libssl-dev libnl-genl-3-dev libdbus-c++-dev libnl-route-3-dev
shell: bash

- name: CMake Configure
if: ${{ ! inputs.arch }}
run: cmake --preset ${{ inputs.preset-name }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }}
run: cmake --preset ${{ inputs.preset-name }}-${{ inputs.os }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }}
shell: pwsh

- name: CMake Configure Cross-Compile ${{ inputs.arch }}
if: ${{ inputs.arch }}
run: cmake --preset ${{ inputs.preset-name }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DNETREMOTE_EXCLUDE_TESTS=TRUE -A ${{ inputs.arch }}
run: cmake --preset ${{ inputs.preset-name }}-${{ inputs.os }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DNETREMOTE_EXCLUDE_TESTS=TRUE -A ${{ inputs.arch }}
shell: pwsh

- name: CMake Build
run: cmake --build --preset build-${{ inputs.preset-name }} --config ${{ inputs.build-type }}
run: cmake --build --preset build-${{ inputs.preset-name }}-${{ inputs.os }} --config ${{ inputs.build-type }}
shell: pwsh

- name: CMake Test (ctest)
if: ${{ inputs.test == 'true' && ! inputs.arch }}
run: ctest --preset ${{ inputs.preset-name }} -C ${{ inputs.build-type }}
run: ctest --preset test-${{ inputs.preset-name }}-${{ inputs.os }} -C ${{ inputs.build-type }}
shell: pwsh

- name: CMake Install
if: inputs.install == 'true'
run: cmake --build --preset build-${{ inputs.preset-name }} --target install --config ${{ inputs.build-type }}
run: cmake --build --preset build-${{ inputs.preset-name }}-${{ inputs.os }} --target install --config ${{ inputs.build-type }}
shell: pwsh

- name: CMake Package (cpack)
if: inputs.package == 'true'
run: cpack --preset package-${{ inputs.preset-name }} -C ${{ inputs.build-type }}
run: cpack --preset packaging-${{ inputs.preset-name }}-${{ inputs.os }} -C ${{ inputs.build-type }}
shell: pwsh

- name: Publish Artifacts
Expand All @@ -81,5 +90,5 @@ runs:
with:
name: release-package-${{ runner.os }}-${{ inputs.build-type }}-${{ inputs.arch != '' && inputs.arch || runner.arch }}
path: |
${{ github.workspace }}/out/package/${{ inputs.preset-name }}/*.tar.*
${{ github.workspace }}/out/package/${{ inputs.preset-name }}/*.zip
${{ github.workspace }}/out/package/${{ inputs.preset-name }}-${{ inputs.os }}/*.tar.*
${{ github.workspace }}/out/package/${{ inputs.preset-name }}-${{ inputs.os }}/*.zip
18 changes: 0 additions & 18 deletions .github/workflows/build-linux.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/build-windows.yml

This file was deleted.

Loading

0 comments on commit 8067d9a

Please sign in to comment.