Skip to content
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

Updated dependencies and workflow for riscv64. #449

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/actions/linux-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ runs:
run: |
sudo apt-get update
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install gcc-13 g++-13 -y
Copy link
Contributor Author

@fire fire Jun 28, 2024

Choose a reason for hiding this comment

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

I wasn't able to find a gcc-13 with riscv.

I think the riscv compiler on ubuntu-20.04 is gcc-9.

Copy link
Member

Choose a reason for hiding this comment

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

Hi @fire, is it necessary to downgrade this to gcc-9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I was trying to upgrade to 24.04 which has gcc 13, but I messed up.

Copy link
Member

@Naros Naros Jul 10, 2024

Choose a reason for hiding this comment

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

The main issue with using Ubuntu 24.04 is the GLIBC versions are different and many folks on certain distributions like Kubuntu for example are unable to run the compiled shared library because the OS has an older GLIBC version installed IIRC.

Originally I think we were compiling on Ubuntu 22 and decided to fallback to 20 because of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is trying to get a gcc-13 riscv cross compiler, not sure how to find one that isn't like 24.04.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, could we go the other way. Would it be possible to use gcc-9 on Ubuntu 20 for the risc-v artifacts and gcc-13 for others? We could use the arch matrix bit to toggle the GCC version perhaps?

The only limitation I think that would impose for us is that we'd be bound by whatever GCC feature set is available in gcc-9 -- and we'd at least see if I've added some constructs that don't compile on gcc-9, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can try it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel free to edit my branch.

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
sudo apt-get install gcc g++ gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y

- name: Install Ninja (Linux)
shell: sh
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ jobs:
# target: template_debug
# platform: linux
# arch: x86_64
- identifier: linux-release
name: 🐧 Linux (Release)
- identifier: linux-x86_64-release
name: 🐧 Linux x86_64 (Release)
build_type: Release
runner: ubuntu-20.04
target: template_release
platform: linux
arch: x86_64
- identifier: linux-riscv64-release
name: 🐧 Linux riscv64 (Release)
build_type: Release
runner: ubuntu-20.04
target: template_release
platform: linux
arch: riscv64
# - identifier: windows-debug
# name: 🪟 Windows (Debug)
# build_type: Debug
Expand All @@ -55,6 +62,7 @@ jobs:
runner: macos-latest
target: template_release
platform: macos
precision: double
- identifier: android-arm64
name: 🤖 Android Arm64
build_type: Release
Expand Down Expand Up @@ -104,9 +112,13 @@ jobs:

- name: Build Orchestrator (Linux/MacOS)
if: startsWith(matrix.identifier, 'linux-') || startsWith(matrix.identifier, 'macos-')
shell: sh
shell: bash
run: |
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -G Ninja
if [[ "${{ matrix.arch }}" == "riscv64" ]]; then
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -G Ninja -DCMAKE_TOOLCHAIN_FILE=riscv64-toolchain.cmake
else
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -G Ninja
fi
cmake --build ${{ github.workspace }}/.out-${{ matrix.identifier }} --target orchestrator -j 18

- name: Build Orchestrator (Windows)
Expand Down
18 changes: 18 additions & 0 deletions riscv64-toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# riscv64-toolchain.cmake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR riscv64)

# specify the cross compiler
set(CMAKE_C_COMPILER riscv64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER riscv64-linux-gnu-g++)

# where is the target environment
set(CMAKE_FIND_ROOT_PATH /usr/lib/gcc/riscv64-unknown-elf/9.3.0)

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Loading