Building ATLAS (v3.10.3) for x86 and x64 on Windows 10 with Visual Studio

Due to a lot of challenges I have summarized the steps to build ATLAS for Windows 10 (64-bit as well as the 32-bit):

  • Download LAPACK (I am using version 3.7.0) and place the file under the ATLAS folder (mine is under “c:\solvers\atlas”).
  • You will need to download and install Cygwin, a linux environment for Windows, to compile ATLAS (use the 64-bit version) if you do not have it already. During the install (or if you already have it run the “setup-x86_64.exe” again) and add the following packages:
    • Separately search for “gcc”, “mingw” and “fortran” and select these packages to be installed,
  • Download ATLAS (v3.10.3 is the one I used) from SourceForge,
  • Extract ATLAS (I use 7Zip), to a folder (I have put mine under “c:\solvers\atlas”) and create a sub-folder to build the libraries (I called my sub-folder “win”, you can do the following from a Windows cmd.exe command prompt but you can do this in Explorer):
    • mkdir c:\solvers\atlas\win
      cd c:\solvers\atlas\win
  • Change the ATLAS compiler from gcc to mingw so that the output with be compatible for a Windows build:
    • In the new “win” folder create a file called “MinGW64.bat” and then insert the following lines:
    • x86_64-w64-mingw32-ar.exe
  • Now from inside the Cygwin terminal window (type Cygwin in the Windows search bar and you should find the Cygwin Terminal program you installed):
    • Navigate to the new “win” folder that was created (for Cygwin the path “cygdrive” takes you to the root of the Windows system):
    • cd /cygdrive/c/solvers/atlas/win
    • Now we run the ATLAS configure script to prepare build files for our Windows build (“-v 2” can be added if you need more error reporting):
    • ../configure -b 64 -Si nocygwin 1 --shared --with-netlib-lapack-tarfile=/cygdrive/c/solvers/atlas/lapack-3.7.0.tgz
    • If successful you can now build:
    • make build

Then confirming that you have the libtatlas.def, libtatlas.dll (for x64), libsatlas.def and libsatlas.dll (for x86), then you will be able to use the windows “lib” command (from the Windows command prompt, not the Cygwin terminal):

  • Open a new command prompt in Windows (type cmd.exe in the start bar), and then navigate to the sub-folder “lib” which was created under the “win” folder:
  • cd c:\solvers\atlas\win\lib
  • For the 32-bit library (x86):
  • lib /nologo /MACHINE:X86 /DEF:libsatlas.def
  • For the 64-bit library (x64):
  • lib /nologo /MACHINE:X64 /DEF:libtatlas.def
  • You should now have the files libtatlas.lib (x64) and libsatlas.lib (x86) created and ready for inclusion in your program.

© 2024 A Theme