CMAKE with error by compiling on Windows with mingw32-make

wter26: <p>Now i want to compile the code of libtorch by using the mingw32-make.<br>
First i compiled the blas_libraries with the openblas what contains the laplack libraries.<br>
But the cmake cant find the laplack libraries,tips like:</p>
<pre><code class="lang-auto">CMake Error at cmake/Modules/FindLAPACK.cmake:137 (check_function_exists):
  Unknown CMake command "check_function_exists".
Call Stack (most recent call first):
  cmake/Dependencies.cmake:1745 (find_package)
  CMakeLists.txt:708 (include)
</code></pre>
<p>And other</p>
<pre><code class="lang-auto">CMake Error at cmake/Dependencies.cmake:1562 (add_subdirectory):
  The source directory

    C:/proj/libpytorch/third_party/onnx

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)


CMake Error at cmake/Dependencies.cmake:1564 (add_subdirectory):
  The source directory

    C:/proj/libpytorch/third_party/foxi

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)


CMake Error at cmake/public/utils.cmake:226 (get_target_property):
  get_target_property() called with non-existent target "onnx".
Call Stack (most recent call first):
  cmake/Dependencies.cmake:1574 (caffe2_interface_library)
  CMakeLists.txt:708 (include)


CMake Error at cmake/Dependencies.cmake:1579 (target_compile_options):
  Cannot specify compile options for target "onnx" which is not built by this
  project.
Call Stack (most recent call first):
  CMakeLists.txt:708 (include)
</code></pre>
<p>There are so many options could choose for the compiling.I just dont know to or is there some guider could looked for</p>

ptrblck: <aside class="quote no-group" data-username="wter26" data-post="1" data-topic="159140">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/wter26/48/52369_2.png" class="avatar"> wter26:</div>
<blockquote>
<pre><code class="lang-auto">CMake Error at cmake/Modules/FindLAPACK.cmake:137 (check_function_exists):
  Unknown CMake command "check_function_exists".
</code></pre>
</blockquote>
</aside>
<p>This is often caused by a missing:</p>
<pre><code class="lang-auto">INCLUDE(CheckFunctionExists)
</code></pre>
<p>in the cmake files so you might want to add it to <code>FindLAPACK.cmake</code> and see if it would solve the issue.</p>

wter26: <p>In fact.I just compiled successfully with the other machine learning library by using the laplack.<br>
Now i just wondered if there any possible to compile the pytorch with mingw32-make and for x86_62 arch on win32 platforms(not x86_64 for win64),cause I seen that the manual books are designed for the x86_64  os platforms.And some topics in this forum also mentioned that it would take a lot of works by using the compile tool of mingw32-make.</p>

ptrblck: <p>I didn"t realize you are trying to compile for 32bit architectures and don’t think that’s possible, but others can correct me if I’m wrong.</p>

wter26: <p>Yeah,I agreed with you.When i just viewed the CMAKELIST,I saw that there’re no options of the x86_32,only supported ARM64/x86_64 arm and so on.<br>
One of the questions is why?<br>
And the other is that any possible to compile with the mingw32-make on win64?</p>

ptrblck: <p>Wouldn’t 32bit applications be limited by 2GB RAM by default and 4GB if they are linked with <code>/LARGEADDRESSAWARE</code>? If so, this would make their use cases quite limited and I would believe not many users would care about it, which is probably why this path is not maintained.</p>

dfalbel: <p>I don’t think it’s possible to compile LibTorch with mingw make. With some work you might be able to compile the CPU version but definitely not the CUDA version.</p>