Skip to content

Conversation

@hnpl
Copy link
Member

@hnpl hnpl commented Jul 14, 2019

The X86 and ARM gcc compilers are Ubuntu packages. The script clones RISCV-gnu-toolchain repo, checkouts a commit hash and compiles the tools.
Compiling RISCV-gcc takes lots of memory, so -m should be set for building the image.
A few concerns:

  • Do we need to point to a specific gcc versions for the Ubuntu packages?
  • Do we need to checkout a specific commit hash for the RISCV repo?
  • I usually use the -v option to mount from host to docker. This causes a problem as the binaries would be owned by root on host. Is there a better way of doing this? I think we can add a new non-root user to the guest, and use chown to change the owner of the binaries.

@hnpl hnpl requested a review from powerjg July 14, 2019 08:38
@hnpl hnpl mentioned this pull request Jul 14, 2019
@powerjg
Copy link
Member

powerjg commented Jul 15, 2019

The way to fix the files being owned by root is to use the -u option with docker. For instance, below is the docker command I always use.

docker run --rm -v $PWD:$PWD -w $PWD -u $UID:$GID -it <image>

Copy link
Member

@powerjg powerjg left a comment

Choose a reason for hiding this comment

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

This is a great start!

Can you create three separate dockerfiles for each one of them?

@powerjg powerjg requested a review from hildebrandmw July 15, 2019 00:35
@powerjg
Copy link
Member

powerjg commented Jul 15, 2019

It would be good to get @hildebrandmw 's feedback once this is updated with separate files.

Copy link
Member

@powerjg powerjg left a comment

Choose a reason for hiding this comment

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

This is much better! Yeah, it sounds like there's tradeoffs between separate commands per RUN and everything in one RUN command. For our use case, I feel like the improved speed for debugging is more important than improved speed for building. Neither of which matters much ;)

RUN git clone --recursive https://github.com/riscv/riscv-gnu-toolchain -j $(nproc)
WORKDIR $RISCV_SRC_DIR
# Checkout a specific hash to keep the output binaries consistent
RUN git checkout 23a038856764808d75b6afe96f649980609ae4c6
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late comment... can you checkout a tag instead of a hash? Are there tags for specific versions of gcc?

Copy link
Member Author

Choose a reason for hiding this comment

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

They have tags, each has a specific version of gcc.

@powerjg
Copy link
Member

powerjg commented Jul 15, 2019 via email

@hnpl
Copy link
Member Author

hnpl commented Jul 18, 2019

The riscv-gnu-toolchain repo newest release was in December 2017, and it uses gcc 7.2.0. There are 2 newer tags since then. Do you think it is better to use the newer tags or the latest release?

@powerjg
Copy link
Member

powerjg commented Jul 18, 2019

IIRC, RISC-V support is now mainlined in GCC. You might be able to use the main GCC repo instead of using the fork. Although, with 5 minutes of googling I couldn't figure out how to do it. So, it may not be possible.

@nganjehloo, do you have any ideas on the best version of the RISC-V toolchain to use?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants