-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How to build on Windows? #1442
Comments
WSL and then use mingw cross compiler (by something like |
For what it's worth, two other options that I have found useful for building RISC-V toolchains - particularly cross compiling the toolchain to run on Windows:
|
Is that even possible at the moment? Presumably not in the upstream GCC and related projects where only support for ratified extensions is implemented? Edit: oh - maybe this helps? (I'd completely forgotten about it!)... |
I tried a few different tacks to get this working but failed.
I gave up and had better success with crosstool-NG. I followed the usual instructions for installing CT-NG:
As above I installed the Windows cross compilers and cloned the
I then ran I then ran Edit: see the link above for an explanation of these "errors". In summary they are false positives and can be ignored. They occur because CT-NG presents any output string containing "error" as an
To avoid problems with symbolic links I did the following:
In a Windows command shell:
|
Hello, ct-ng contributer here. I just wanted to say that MSYS2 is a great wsl alternative using native windows. ct-ng and gcc can but successfully compiled and used in this environment. |
Thanks @QBos07. Maybe things have changed in recent years but, in the past, I always found MSYS2 difficult to correctly configure and use in order to build a GCC toolchain or other stuff such as OpenOCD. I always found a CT-NG Canadian Cross compilation from Linux more effective. Or the old xPack Docker based approach. I'm only trying the latest xPack approach now to see if/how that can be used to build a custom toolchain such as the one mentioned here. Maybe I should give MSYS2 another go too? :-) |
Definitely, I wouldn't say it works flawlessly 101% of the time but for that is autoconf. I can recommend it. |
Edit: ignore that - at least one fundamental mistake that I seem to have made was to use I'll continue trying with the correct GCC installed and post back with updates when I have something useful. |
I was able to build a bare-metal toolchain (but not including GDB yet) using MSYS2 as follows:
TODO:
Notes:
|
For some reason just installing the
In the end I just downloaded the
I did also had to manually copy the following DLLs in order for GDB to launch correctly:
I haven't tried all of the toolchain executables so it's possible that there are other dependent DLLs but I think that the principle of compiling the Windows native bare-metal toolchain using MSYS2 has been illustrated adequately. |
The binary version of expat is distrubuted as mingw-w64-ucrt-x86_64-expat for this platform. |
Thanks @QBos07 - I didn't realise that I was searching only base packages and not all packages earlier! |
I guess that these DLLs probably need to be copied to the toolchain
|
If you don't want to copy the dlls. It's possible to just add |
Yes, but I'm thinking of the situation where one builds a native Windows toolchain for use by somebody who doesn't have/want to install MSYS2. |
Depending on the position in the PATH, this might break other programs using different versions of these libraries. I'm no Windows specialist, so I might be wrong, but I think that the safest location is the same folder as the executable that uses the library. |
Two methods for building a Windows toolchain have been shown to work:
I haven't had time to pursue a third way:
I will try to look into that at some point but for now I will close this issue as the original question has been addressed. |
How can I compile a riscv-tolchain on Windows for nuclei N300 (arch=rv32imafcp)?
The text was updated successfully, but these errors were encountered: