Can I build libtorch from source with mingw?

I need to know any chance to build torch with mingw? If it is possible, How? Did anyone build it?

OS:Windows 10

If you want to build the CPU version, it is possible but you will need to make some changes to the code. The answer is absolutely no if you want the CUDA version. Because nvcc doesn’t work with it under Windows.

Hi @peterjc123
I know this is old… but can you elaborate on the changes to make the package compile for CPU with mingw?
is there a repo that can be cloned?


No, there isn’t a working build. You’ll need to switch the CMake generator to MinGW (currently MSVC) and adapt the code to the toolchain line by line. I’m afraid that’s a lot of work for you.

1 Like