openzfsonwindows/openzfs

Compilers used in the project

sskras opened this issue · 3 comments

@lundman wrote in #2:

the cmake thing compiles everything as clang, which is not right - it is supposed to do driver.c (plus three other files) and then link, using visual studio compiler.

Ummm. Could you give more details about CLang vs MSVC compilers usage in this project?

I guess it would be very nice to compile it with no MSVC set up at all.

https://github.com/openzfsonwindows/openzfs/blob/windows/module/os/windows/README.md

Yeah, it is a hassle - 99% of it is compiled with clang, but, there is no /kernel flag for clang (yet), so we use MSVC++ to compile driver.c then link it. Technically, probably just linking is enough but ah well. So you need cl.exe and ah whatever the linker is called.

Nice, thanks.

there is no /kernel flag for clang (yet), so we use MSVC++ to compile driver.c then link it

If @reactos can do this by using clang, I guess it's still doable (configurable):
https://reactos.org/wiki/Building_ReactOS#Windows_or_ReactOS#:~:text=clang

OTOH, it would be nice if someone ported this to gcc (MinGW-w64) too. It seemingly can compile drivers too:
https://myworks2012.wordpress.com/2014/05/26/how-to-compile-windows-x64-driver-using-mingw-w64-gcc/

I suspect it can be made to work with just clang - I've just not had the time yet, since there is so much to do. But the lines with --entry,DriverEntry@8 (and the others) is probably what is needed so it has a load address. Feel free to experiment though!