Skip to content

Commit

Permalink
i#6900 RV64: Fix CI build (DynamoRIO#6901)
Browse files Browse the repository at this point in the history
Currently, we downloaded the cross-compile packages from unstable Debian
sid, this PR changed it to a stable source Ubuntu 24.04 to avoid errors.

Issue: DynamoRIO#6900

---------

Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR authored Jul 24, 2024
1 parent e9a8155 commit 2c68960
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci-riscv64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ defaults:

jobs:
# RISCV64 cross-compile with gcc
# We use ubuntu 22.04 because the compilition here need python (3.10.x)
# We use ubuntu 24.04 because the compilition here need libunwind-riscv64 and
# it's a stable source.
riscv64-cross-compile:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
Expand All @@ -70,14 +71,16 @@ jobs:
# Install cross-compiler for cross-compiling Linux build.
# Unfortunately there are no libunwind or compression cross-compile
# packages so we unpack the native versions and copy their files.
# Unfortunately, only kinetic (ubuntu 22.10) has libunwind-riscv64 packages.
# I prefer debian-ports here, it is closer to upstream.
- name: Create Build Environment
run: |
sudo apt-get update
sudo apt-get -y install doxygen vera++ cmake crossbuild-essential-riscv64 git \
qemu-user qemu-user-binfmt
sudo add-apt-repository 'deb [trusted=yes arch=riscv64] http://deb.debian.org/debian sid main'
# We cannot use the following command here, because it will download the
# x86_64 binaries due to some known issue of DEB822.
# sudo add-apt-repository 'deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports noble main'
echo 'deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports noble main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update
apt download libunwind8:riscv64 libunwind-dev:riscv64 liblzma5:riscv64 \
zlib1g:riscv64 zlib1g-dev:riscv64 libsnappy1v5:riscv64 libsnappy-dev:riscv64 \
liblz4-1:riscv64 liblz4-dev:riscv64
Expand Down
3 changes: 2 additions & 1 deletion api/docs/building.dox
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ $ sudo apt-get -y install doxygen vera++ cmake crossbuild-essential-riscv64 git
Some packages may need to be manually installed for cross-compiling environment. You can also refer to our [CI workflow file](https://github.com/DynamoRIO/dynamorio/blob/master/.github/workflows/ci-riscv64.yml) for creating a RISCV64 build environment.

```
$ sudo add-apt-repository 'deb [trusted=yes arch=riscv64] http://deb.debian.org/debian sid main'
$ echo 'deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports noble main' | sudo tee -a /etc/apt/sources.list
$ sudo apt-get update
$ apt download libunwind8:riscv64 libunwind-dev:riscv64 liblzma5:riscv64 zlib1g:riscv64 zlib1g-dev:riscv64 libsnappy1v5:riscv64 libsnappy-dev:riscv64 liblz4-1:riscv64 liblz4-dev:riscv64
$ mkdir ../extract
$ for i in *.deb; do dpkg-deb -x $i ../extract; done
Expand Down
4 changes: 2 additions & 2 deletions core/ir/riscv64/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def generate_instr_macros(self, template_file, out_file) -> bool:
for f in flds])
arg_comments += '\n'
arg_comments += '\n'.join(
[f' * \param {f.formatted_name():6} {f.arg_cmt}' for f in flds])
[f' * \\param {f.formatted_name():6} {f.arg_cmt}' for f in flds])
if len(all_flds) > 0:
body_args += ', '
body_args += ', '.join([f.formatted_name(True)
Expand All @@ -1197,7 +1197,7 @@ def generate_instr_macros(self, template_file, out_file) -> bool:
f'''/**
* Creates a(n) {i.name} instruction.
*
* \param dc The void * dcontext used to allocate memory for the instr_t.{arg_comments}
* \\param dc The void * dcontext used to allocate memory for the instr_t.{arg_comments}
*/
#define INSTR_CREATE_{i.formatted_name()}(dc{args}) \\
instr_create_{nd}dst_{ns}src(dc, OP_{i.formatted_name()}{body_args})\n''')
Expand Down
2 changes: 1 addition & 1 deletion suite/tests/api/ir_riscv64.expect
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ c.xor fp a5 -> fp
c.sub fp a5 -> fp
test_integer_arith complete
lui 0x2a -> a0
<Internal Error: Failed to encode instruction: 'auipc <rel> 0x0000004000019264 -> a0'>
<Internal Error: Failed to encode instruction: 'auipc <rel> 0x000055555556f014 -> a0'>
jalr a1 42 -> a0
c.jalr a0 0 -> ra
c.li zero 31 -> a1
Expand Down

0 comments on commit 2c68960

Please sign in to comment.