Building Lapack w/ CMake, 64-bit, Visual Studio

Post here if you have a question about linking your program with LAPACK or ScaLAPACK library

Building Lapack w/ CMake, 64-bit, Visual Studio

Postby gboyinfinity » Tue Jan 05, 2016 11:23 am

Summary of what I'm trying to do:

- Get Lapack up and running in support of 64-bit C++ software I'm writing in Visual Studio 2013.
- I'm following the general instructions at http://icl.cs.utk.edu/lapack-for-windows/lapack
- Previously, I tried to use the pre-built libraries there - but that failed (see my sister post at viewtopic.php?f=12&t=4873&p=11707#p11707)
- So, based on comments in a previous post at viewtopic.php?f=12&t=4260, I'm trying to use CMake to generate the Lapack libraries on my system.
- But CMake is complaining about the Fortran compiler I'm specifying.


Steps I'm taking
- I download the lapack build files at http://netlib.org/lapack/lapack.tgz and placed the files at C:\Program Files\Common Files\MSVC\LAPACK\lapack-3.6.0
- I created a build folder at C:\Program Files\Common Files\MSVC\LAPACK\build
- I already have CMake 3.4.1 on my computer
- To get MinGW-w64, I followed the link to http://mingw-w64.sourceforge.net/ which auto-downloads the mingw-w64-install.exe installer program - which forces you to select 'settings'. I chose the following: (Version 4.9.3, Architecture: x86_64, Threads: win32, Exception: seh, Build Revision: 1)
- This installed mingw to the default location on my computer
- I added the bin folder w/in mingw to my path
- Started CMake, specified the Lapack folders, upon hitting configure I selected (Generator: Visual Studio 12 2013 Win64, Specify native compiler, and for the 3 compilers I chose: For the c & c++ compiler the x86_64-w64-mingw32-gcc.exe file in the bin folder of mingw and for the Fortran compiler the x86_64-w64-mingw32-gfortran.exe file also in the bin folder of mingw)
- Upon hitting 'Finish' I get a long list of errors, the initial ones being:
>
Code: Select all
The Fortran compiler identification is unknown
Check for working Fortran compiler using: Visual Studio 12 2013 Win64
Check for working Fortran compiler using: Visual Studio 12 2013 Win64  -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/CMakeTestFortranCompiler.cmake:54 (message):
  The Fortran compiler "C:/Program
  Files/mingw-w64/x86_64-4.9.3-win32-seh-rt_v4-rev1/mingw64/bin/x86_64-w64-mingw32-gfortran.exe"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Program Files/Common Files/MSVC/LAPACK/build/CMakeFiles/CMakeTmp

  Run Build Command:"C:/Program Files (x86)/Microsoft Visual Studio
  12.0/Common7/IDE/devenv.com" "CMAKE_TRY_COMPILE.sln" "/build" "Debug"
  "/project" "cmTC_5ad31"

...


I confirmed that x86_64-w64-mingw32-gfortran.exe is visible on the Path with the 'where' command at the Dos prompt. Am I specifying the wrong compilers? Or am I making a different mistake?

PS I apologize for the brevity of some my descriptions above - my posts keep getting flagged as spam and denied if I'm too verbose (or perhaps if I specify too many paths!) - so I abridged some of my descriptions.
gboyinfinity
 
Posts: 5
Joined: Sun Jan 03, 2016 12:40 pm

Re: Building Lapack w/ CMake, 64-bit, Visual Studio

Postby admin » Tue Jan 05, 2016 11:27 am

This looks like a permission / folder issue.
- I created a build folder at C:\Program Files\Common Files\MSVC\LAPACK\build
Just create a build folder in My Document or something alike
admin
Site Admin
 
Posts: 609
Joined: Wed Dec 08, 2004 7:07 pm

Re: Building Lapack w/ CMake, 64-bit, Visual Studio

Postby gboyinfinity » Tue Jan 05, 2016 2:02 pm

Thanks for the reply. And, yes, I have run smack into failed attempts due to insufficient permissions too many times! I get around this by habitually running CMake, command-prompt, Visual Studio (and most other software of importance) as administrator.

Actually, I found my problem! After submitting my last, I realized that my problem was that I specified a 'Visual Studio 12 2013 Win64' as the generator in CMake. What I needed to do was specify 'MinGW Makefiles' as the generator in CMake. Then I specified the native c, c++ and fortran compilers as I described in my last and everything pretty much proceeded as described in http://icl.cs.utk.edu/lapack-for-windows/lapack/#build

Once the Lapack libraries were built, I just needed to add the new 'bin' folder to my system path, update the Project Property paths in my Visual Studio project I described in my sister post at viewtopic.php?f=12&t=4873 and both the Release and Debug configurations of my simple Lapack program compiled and ran.
gboyinfinity
 
Posts: 5
Joined: Sun Jan 03, 2016 12:40 pm


Return to Linking Problem

Who is online

Users browsing this forum: No registered users and 1 guest