Skip to content

Commit f487836

Browse files
authored
Add MIPS32 cross compilation, refactor existing cross-compilation jobs (#2091)
* MIPS32 cross compilation, threadpool, and use DRY * Add the ZLIB changes too * Address comment
1 parent 339f24f commit f487836

File tree

3 files changed

+106
-56
lines changed

3 files changed

+106
-56
lines changed

.github/workflows/ci.yml

+1-55
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
export CC="clang"
7575
export CXX="clang++"
7676
fi
77-
echo "Using $CC and $CXX"
77+
echo "Using CC: $CC and CXX: $CXX"
7878
7979
mkdir -p build
8080
cd build
@@ -612,60 +612,6 @@ jobs:
612612
# cd D:\a\webrtc
613613
# git config --system core.longpaths true
614614
# .github\build_windows_mbedtls.bat
615-
arm64-cross-compilation:
616-
runs-on: ubuntu-20.04
617-
env:
618-
CC: aarch64-linux-gnu-gcc
619-
CXX: aarch64-linux-gnu-g++
620-
steps:
621-
- name: Install dependencies
622-
run: |
623-
sudo apt clean && sudo apt update
624-
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
625-
- name: Clone repository
626-
uses: actions/checkout@v4
627-
- name: Build Repository
628-
run: |
629-
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
630-
mkdir build && cd build
631-
cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
632-
make
633-
linux-aarch64-cross-compilation:
634-
runs-on: ubuntu-20.04
635-
env:
636-
CC: aarch64-linux-gnu-gcc
637-
CXX: aarch64-linux-gnu-g++
638-
steps:
639-
- name: Install dependencies
640-
run: |
641-
sudo apt clean && sudo apt update
642-
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
643-
- name: Clone repository
644-
uses: actions/checkout@v4
645-
- name: Build Repository
646-
run: |
647-
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
648-
mkdir build && cd build
649-
cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-aarch64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
650-
make
651-
arm32-cross-compilation:
652-
runs-on: ubuntu-20.04
653-
env:
654-
CC: arm-linux-gnueabi-gcc
655-
CXX: arm-linux-gnueabi-g++
656-
steps:
657-
- name: Install dependencies
658-
run: |
659-
sudo apt clean && sudo apt update
660-
sudo apt-get -y install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi binutils-arm-linux-gnueabi
661-
- name: Clone repository
662-
uses: actions/checkout@v4
663-
- name: Build Repository
664-
run: |
665-
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
666-
mkdir build && cd build
667-
cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
668-
make
669615

670616
stack-size-check:
671617
runs-on: ubuntu-latest
+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: WebRTC C SDK Cross Compilation
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- main
7+
pull_request:
8+
branches:
9+
- develop
10+
- main
11+
jobs:
12+
linux-cross-compilation:
13+
strategy:
14+
matrix:
15+
compiler:
16+
- name: mips-32
17+
runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable
18+
install: gcc-mips-linux-gnu g++-mips-linux-gnu
19+
cc: mips-linux-gnu-gcc
20+
cxx: mips-linux-gnu-g++
21+
cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-mips32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=mips-unknown-linux-gnu
22+
file-expected-output: "ELF 32-bit MSB executable, MIPS, MIPS32"
23+
- name: arm-32
24+
runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable
25+
install: gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
26+
cc: arm-linux-gnueabihf-gcc
27+
cxx: arm-linux-gnueabihf-g++
28+
cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
29+
file-expected-output: "ELF 32-bit LSB pie executable, ARM"
30+
- name: arm-64
31+
runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable
32+
install: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
33+
cc: aarch64-linux-gnu-gcc
34+
cxx: aarch64-linux-gnu-g++
35+
cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-generic64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
36+
file-expected-output: "ELF 64-bit LSB pie executable, ARM"
37+
- name: aarch-64
38+
runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable
39+
install: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
40+
cc: aarch64-linux-gnu-gcc
41+
cxx: aarch64-linux-gnu-g++
42+
cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-aarch64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
43+
file-expected-output: "ELF 64-bit LSB pie executable, ARM"
44+
45+
build-type:
46+
- name: Shared
47+
cmake_flags: -DBUILD_STATIC_LIBS=OFF
48+
- name: Static
49+
cmake_flags: -DBUILD_STATIC_LIBS=ON
50+
51+
crypto:
52+
- name: OpenSSL
53+
cmake_flags: -DUSE_OPENSSL=ON -DUSE_MBEDTLS=OFF
54+
- name: MbedTLS
55+
cmake_flags: -DUSE_OPENSSL=OFF -DUSE_MBEDTLS=ON
56+
57+
threadpool:
58+
- name: Threadpool On
59+
cmake_flags: -DENABLE_KVS_THREADPOOL=ON
60+
- name: Threadpool Off
61+
cmake_flags: -DENABLE_KVS_THREADPOOL=OFF
62+
63+
fail-fast: false
64+
runs-on: ubuntu-latest
65+
container:
66+
image: ${{ matrix.compiler.runner }}
67+
name: ${{ matrix.compiler.name }}, ${{ matrix.build-type.name }}, ${{ matrix.crypto.name }}, ${{ matrix.threadpool.name }}
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
- name: Install dependencies
72+
run: |
73+
apt-get update
74+
apt-get install -y build-essential cmake git pkg-config file ${{ matrix.compiler.install }}
75+
- name: Configure and build ${{ matrix.compiler.name }}, ${{ matrix.build-type.name }}, ${{ matrix.crypto.name }}, ${{ matrix.threadpool.name }}
76+
run: |
77+
export CC=${{ matrix.compiler.cc }}
78+
export CXX=${{ matrix.compiler.cxx }}
79+
echo "Using $CC and $CXX"
80+
81+
mkdir -p build
82+
cd build
83+
84+
cmake .. -DBUILD_TEST=ON \
85+
-DENABLE_AWS_SDK_IN_TESTS=OFF \
86+
${{ matrix.build-type.cmake_flags }} \
87+
${{ matrix.crypto.cmake_flags }} \
88+
${{ matrix.compiler.cmake_flags }} \
89+
${{ matrix.threadpool.cmake_flags }}
90+
make -j$(sysctl -n hw.ncpu)
91+
shell: bash
92+
- name: Check test file is compiled correctly
93+
run: |
94+
cd build
95+
96+
file ./tst/webrtc_client_test
97+
file ./samples/kvsWebrtcClientMaster
98+
99+
readelf -a ./tst/webrtc_client_test
100+
readelf -a ./samples/kvsWebrtcClientMaster
101+
102+
file ./tst/webrtc_client_test | grep "${{ matrix.compiler.file-expected-output }}"
103+
file ./samples/kvsWebrtcClientMaster | grep "${{ matrix.compiler.file-expected-output }}"
104+
shell: bash

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ endif()
493493

494494
if(BUILD_TEST)
495495
# adding ZLIB because aws sdk static link seems to be broken when zlib is needed
496-
if(NOT WIN32)
496+
if(NOT WIN32 AND ENABLE_AWS_SDK_IN_TESTS)
497497
find_package(ZLIB REQUIRED)
498498
endif()
499499
add_subdirectory(tst)

0 commit comments

Comments
 (0)