Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28484 Discussions

Error while using Intel Fortran Compiler and information on linking LAPACK BLAS libraries

singh_balwinderd-p-l
611 Views
Hi All,
I recently installed Intel Fortran compiler on a windows platform. The compiler runs fine in the "console" window for Intel Visual Fortran (automatically installed after the installation of compiler) but it doesn't run in the windows native console window (which pops up when we type "cmd" in start->Run). I get the following error:

ifort: error #10037: could not find 'link'

whenever I try to run any fortran program.

My second question is related to LAPACk and BLAS. I am not using Visual Studio therefore I have to mention flags for LAPACK and BLAS on command line while compiling. I do not know how to mention flags for linking LAPACk and BLAS libraries with ifort. Can anybody help me in this regard?

Thanks.


0 Kudos
8 Replies
TimP
Honored Contributor III
611 Views
If "could not find link" is due to absence of MSVC link.exe and libraries, you will have to correct that, by installing at least (for 32-bit) Visual Studio Express and C++, or, for recent versions, the PPE components of Visual Studio. In some cases, you must fill in the linker path in ifort.cfg, or you might conceivably use mingw link, but you still require the MSVC libraries.
The MKL lapack and BLAS libraries come with current ifort. The libraries differ somewhat between 32- and 64-bit (Intel64). You should start by reading the docs which come with it, after you have decided between 32- and 64-bit. These libraries are supplementary to, not replacements for, those which come from Microsoft, so "not using Visual Studio" is not an option. There is a separate forum for MKL questions.
0 Kudos
singh_balwinderd-p-l
611 Views
Thanks for your reply.

So there is no way I can compile and run a program depending upon LAPACK and BLAS libraries on command line using ifort on a windows platform. The only way is to use visual studio. Am I correct in my understanding?

Thanks.



0 Kudos
Les_Neilson
Valued Contributor II
611 Views
Thanks for your reply.

So there is no way I can compile and run a program depending upon LAPACK and BLAS libraries on command line using ifort on a windows platform. The only way is to use visual studio. Am I correct in my understanding?

Thanks.


Presumably it's all to do with your PATH.

The window from the start->run->cmd does not (necessarily) know the PATH where to find everything you need to compile and link; unless youfirst run the ifortvars batch file in that window.

That is why there is a cmd shell provided with the Intel Fortran installation which automatically runs the batch file for you.

Les
0 Kudos
TimP
Honored Contributor III
611 Views
I think we have a misunderstanding here. You can certainly link to MKL as effectively from command line as from Visual Studio GUI. In either case, you need the Visual Studio libraries which ifort invokes implicitly, so you can't avoid using Visual Studio implicitly. Specific link command line would still depend on whether you are compiling for ia32 or Intel64, and on whether you want shared (dll) or static libraries.
0 Kudos
Steven_L_Intel1
Employee
611 Views
As Les says, there is a command script, ifortvars.bat, which is provided to establish the environment. If you do not want to use a provided shortcut which calls ifortvars.bat, you must call it yourself from your command environment. At a minimum it requires an argument of "ia32", "intel64" or "ia64" to indicate the target platform. ("ia64" is Intel Itanium.) For more details, see the compiler documentation on using the compiler from the command line.

For non-Intel libraries, you will need to specify the path to those in the link command or add them to the LIB environment variable.
0 Kudos
singh_balwinderd-p-l
611 Views
Thanks all for the clarification. It was really helpful.
I am on a 32 bit machine. If I run the batch file from the cmd and then compile and run a simple program, the program runs without any issue. Now, my next question is about linking MKL LAPACk and BLAS libraries with my program and compile it using command line.

I went through the documentation and it was quite confusing for me. I am not sure how to mention path for these libraries. When I provide full path, I get error message saying "ignoring extra terms". Can anybody provide me with some more info on this?

I am really thankful to you guys for ur help.

Thanks.

0 Kudos
Steven_L_Intel1
Employee
611 Views
I suggest that you look at the MKL documentation, or ask in the MKL forum, for help on using MKL. The path to the MKL libraries is automatically added by ifortvars.bat so that all you have to do is list the library names on the ifort command line that links the application. The MKL documentation lists the set(s) of libraries to link with for different purposes.
0 Kudos
singh_balwinderd-p-l
611 Views

Thanks a lot. I will go to the MKL forum to ask my questions. I really appreciate your help!
0 Kudos
Reply