Re: Cross compiler riscv64 building

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I already sent you a link in a previous answer:
<https://xpack.github.io/dev-tools/riscv-none-elf-gcc/>.

(Or you can do as I did when I found that site - Google a bit. xpack is not the only project that has cross-development toolchains, it's just the first I found targeting RISC-V. crosstools-ng would be another place to look.)

The gcc developers themselves do not make or maintain binary packages. They try to help people who build cross-compilers, but it is a lot more efficient if end-users go via projects like xpack. And it is better for the users too, because you need a lot more than just gcc to put together a cross-development toolchain.

mvh.,

David



On 13/02/2023 13:02, Sagar Acharya wrote:
Where can I get pre-built binaries for RPI3(aarch64) to compile for target riscv64?
Thanking you
Sagar Acharya
https://designman.org



9 Feb 2023, 18:58 by david@xxxxxxxxxxxxxxx:

On 09/02/2023 12:20, Sagar Acharya via Gcc-help wrote:

I built binutils. Installed it at /usr/local/riscv64-unknown-elf directory

Now, I tried building gcc with
./configure --host=riscv64-unknown-elf
make

However, the gcc directory within gcc-12.2.0 has no Makefile made during configure command. So it enters gcc-12.2.0/gcc dir, sees no Makefile prepared, exits with error.

How do I solve this?


You are mixing up "host" and "target".  "Host" is the computer that runs the compiler, "target" is the computer that runs the compiled code.  So "host" for you will be an ARM system since you are doing your builds on an ARM computer, while "target" will be RISCV.

If you really want to make your own cross-toolchain, you are going to have to spend a good amount of time reading about it and trying things out.  It is an educational process, but it takes work.  You can't expect to do it based on asking a few questions on a mailing list, any more than you can expect to learn C programming by asking questions in a C newsgroup.

Again - I strongly suggest you use pre-built packages.  Even if you later decide that a DIY toolchain will be fun, having the pre-built packages for comparison will make things much easier.

mvh.,

David



Thanking you
Sagar Acharya
https://designman.org



8 Feb 2023, 16:48 by jwakely.gcc@xxxxxxxxx:

On Wed, 8 Feb 2023 at 11:12, Sagar Acharya via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:


How do I configure and build a cross compiler for target riscv64 of latest gcc on aarch64 musl based void linux.

I have it's default gcc installed which I want to use for compiling.


See https://wiki.osdev.org/GCC_Cross-Compiler

In summary:
Download the gcc and binutils source.
Configure binutils with --prefix=$DIR --target=riscv64-unknown-elf for
some $DIR.
Run make && make install.
Configure gcc with the same --prefix and --target options.
Run make && make install.

If you want a hosted target like riscv64-unknown-linux-gnu for
compiling user-space programs, then you'll need to have a copy of the
target headers and libraries available, and point GCC to them with the
--sysroot option.
See https://wiki.osdev.org/Hosted_GCC_Cross-Compiler




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux