Skip to content

Conversation

@hegza
Copy link
Contributor

@hegza hegza commented May 16, 2024

There's currently an issue with the RISC-V GCC compiler on the CI runner.

@hegza hegza force-pushed the ci/c-tests branch 2 times, most recently from 3aec690 to 2dfdde9 Compare May 21, 2024 12:47
@vilukissa68
Copy link
Collaborator

Got this working in #46. There were couple issues:

  1. URL for the toolchain was wrong with ubuntu- being duplicated.
  2. ubuntu-latest seems to have an issue with permission in /root dir. This was solved by unpacking the toolchain in /tmp
  3. Adding to $PATH doesn't work with GitHub actions, since environment variables get cleaned between steps. This is solved by appending the toolchain to $GITHUB_PATH

In the end steps for adding the toolchain look something like this.

    - name: Create RISC-V GCC build directory
      run: mkdir /tmp/riscv-gnu-toolchain
    - name: Download GCC
      working-directory: /tmp/riscv-gnu-toolchain/
      run: |
        wget -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/$GCC_VER/$RISCV_XLEN-elf-$UBUNTU_VER-gcc-nightly-$GCC_VER-nightly.tar.gz
        mkdir ${RISCV} && \
          tar -xf $RISCV_XLEN-elf-$UBUNTU_VER-gcc-nightly-$GCC_VER-nightly.tar.gz --strip-components 1 -C $RISCV
        export PATH="${RISCV}/bin:${PATH}"
        echo "${RISCV}/bin" >> $GITHUB_PATH
        $RISCV_XLEN-unknown-elf-gcc --version
        $RISCV_XLEN-unknown-elf-ld --version

Disclaimer this uses GCC instead of LLVM

@hegza
Copy link
Contributor Author

hegza commented Jul 30, 2024

Based on latest runs it seems like the downloaded version of RISC-V is configured to use a different float setup than what's used by our build. Builds fine locally, since we use the multilib compiler.

It's not feasible to rebuild the compiler for each CI. Perhaps we could try build-minimal-c with newlib..? (@andstepan) Any other ideas? (@vilukissa68)

The end goal is to try to have C builds in CI.

@vilukissa68
Copy link
Collaborator

Based on latest runs it seems like the downloaded version of RISC-V is configured to use a different float setup than what's used by our build. Builds fine locally, since we use the multilib compiler.

It's not feasible to rebuild the compiler for each CI. Perhaps we could try build-minimal-c with newlib..? (@andstepan) Any other ideas? (@vilukissa68)

The end goal is to try to have C builds in CI.

I fail understand why this issue happens. It looks like the ld from the same toolchain as the libc conflict? Doesn't riscv-collab provide gcc with multilib?

We could build Headsail-newlib in the gitlab CI and pull that for C builds, since there is really only one way we want to configure it for headsail, but there's nothing saying that it will fix this issue if the compiler is not good.

If we can't find a suitable gcc, we could have an additional workflow which compiles gcc the way we want. And store that as artifact, so that main flow can just pull it. I would guess that it's possible to have flows in Github/Gitlab that are run only when manually evoked.

@hegza
Copy link
Contributor Author

hegza commented Jul 31, 2024

We could build Headsail-newlib in the gitlab CI and pull that for C builds, since there is really only one way we want to configure it for headsail, but there's nothing saying that it will fix this issue if the compiler is not good.

I like this. We'll need to coordinate some keys between the CIs to enable cross-downloads but that should be fine. I think it should fix this.

If we can't find a suitable gcc, we could have an additional workflow which compiles gcc the way we want. And store that as artifact, so that main flow can just pull it. I would guess that it's possible to have flows in Github/Gitlab that are run only when manually evoked.

This would work but building GCC takes literally hours. There's not too many minutes available to our org on the GitHub Free license :)

@hegza hegza added the blocked label Jul 31, 2024
@hegza
Copy link
Contributor Author

hegza commented Sep 23, 2024

Newlib artifacts now available at https://gitlab.tuni.fi/soc-hub/headsail/sw/newlib-artifacts. I will upload the necessary lib & headers in-tree and re-try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants