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

ifort with NAG under 64-bit Windows

Valerie_L_
Beginner
5,256 Views

Hello,

I am trying to migrate with my research code from Linux HPC cluster to 64-bit Windows (changed job recently and got a new PC).

The code is a set of Matlab and Fortran subroutines, which also call stand-alone NAG Fortran library. It all worked well in the old configuration with pgf90 compiler and Mark21 NAG library under Linux.

Now I have Mark23 NAG library and Intel 64 Visual Studio, of which I use 'ifort' in command line.

In my Makefile, the compilation lines are as follows:

LIBDIR = 'C:/Program Files/NAG/FL23/flw6i23dcl/bin/' LIBNAME = FLW6I23DC_nag.dll

OBJS1 = myprog.f ukf.f OBJS2 = contour.f cdens_subr.f potfit_subr.f

myprog: $(OBJS1)

$(FC) $(OBJS1) $(LIBDIR)$(LIBNAME)

 When I run the package (via Matlab envelope code), I get the following error message:

------------------------------------

ifort myprog.f ukf.f 'C:/Program Files/NAG/FL23/flw6i23dcl/bin/'FLW6I23DC_nag.dll

Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.0.0.089 Build 20120731

Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

ifort: command line warning #10161: unrecognized source type 'C:/Program Files/NAG/FL23/flw6i23dcl/bin/FLW6I23DC_nag.dll'; object file assumed

ipo: warning #11010: file format not recognized for C:/Program Files/NAG/FL23/flw6i23dcl/bin/FLW6I23DC_nag.dll

link: unknown option -- s

Try `link --help' for more information.

Makefile:15: recipe for target `myprog' failed

make: *** [myprog] Error 1

---------------------

I also tried static library from the same Mark23, and it did not work either. Not to mention that I tried 'nagfor' compiler before that - I managed to obtain an executable, but it crashed at call saying about division by zero (which did not happen with 'pgf90').

I would be very grateful if you advised how to resolve the compilation issue with 'ifort'.

Thank you

Valerie Livina

0 Kudos
26 Replies
Steven_L_Intel1
Employee
1,477 Views

You are trying to use Linux syntax for the command line and are still naming a DLL on the ifort line - this won't work. If you have the import .lib corresponding to this DLL, simply name it on the ifort line as if it were a source file.  However, you can't mix 32-bit and 64-bit code, so if the NAG library you are linking to is 64-bit, you need to do a 64-bit build of your application.

I see you are using the included Visual Studio Shell, which is fine. Have you by any chance installed any other Visual Studio products on this system, such as an "Express Edition" of Visual C++?

0 Kudos
Valerie_L_
Beginner
1,477 Views

Dear Steve,

> You are trying to use Linux syntax for the command line and are still naming a DLL on the ifort line - this won't work. If you have the import .lib corresponding to this DLL, simply name it on the ifort line as if it were a source file.  However, you can't mix 32-bit and 64-bit code, so if the NAG library you are linking to is 64-bit, you need to do a 64-bit build of your application.

I installed 32-bit Mark22 NAG library and using IA-32 Visual Studio Command Prompt I compiled the code with NAG library by the following command

ifort myprog.f ukf.f "C:\Program Files (x86)\NAG\FL22\flw3222dcl\lib\FLW3222DC_nag.lib

It produces an exe-file, and I am certain that it works, because when I run the exe-file outside the matlab-package with input parameters in the command line, it generates an output series as it should. Now I have to adjust the Makefile to be able to run it using 'nmake' (so that I would not need to use Cygwin and just run Matlab from the IA-32 Visual Studio Command Prompt).

My Makefile is as follows:

---------

OBJS1=myprog.f ukf.f OBJS2=contour.f cdens_subr.f potfit_subr.f

LIBNAME=FLW3222DC_nag.lib LIBDIR='C:\Program Files (x86)\NAG\FL22\flw3222dcl\lib\'

myprog.exe: $(OBJS1)

ifort $(OBJS1) $(LIBDIR)$(LIBNAME)

contourprog.exe: $(OBJS2)

ifort $(OBJS2) $(LIBDIR)$(LIBNAME) /exe:contourprog.exe

clean: del *.exe *.obj

-----------

When it is called, it produces the following error message:

 makefile(10) : fatal error U1034: syntax error : separator missing

I understand that nmake is different from make, but as I am reading various online manuals and examples, my simple makefile seems correct to me - would you please advise what is wrong with syntax there?

> I see you are using the included Visual Studio Shell, which is fine. Have you by any chance installed any other Visual Studio products on this system, such as an "Express Edition" of Visual C++?

I found installed Microsoft Windows SDK, which also has its own Command Prompt, 64-bit configured and calling startup script

"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"

However, since the 32-bit NAG library is working with my code now, I am happy with it and just want to adjust the Makefile to be able to use 'nmake', so I am looking forward to your advice regarding that.

Thank you

Valerie

 

0 Kudos
Steven_L_Intel1
Employee
1,477 Views

I'm not an nmake expert - perhaps someone else can comment.

0 Kudos
mecej4
Honored Contributor III
1,477 Views

Your makefile is defective (one reason may be that when you paste its contents into a post, tabs, which are rather important in makefiles, may get converted to spaces; line-breaks, which are also important to preserve in makefiles, can get mangled as well).

I have attached a fixed up makefile (remove the .txt suffix before using).

0 Kudos
Valerie_L_
Beginner
1,477 Views

Dear mecej4,

Thank you very much for looking into this.

> Your makefile is defective (one reason may be that when you paste its contents into a post, tabs, which are rather important in makefiles, may get converted to spaces; line-breaks, which are also important to preserve in makefiles, can get mangled as well).

Yes, you are right: this is how the content of the file went into the webform by copy&paste, without linebreaks

> I have attached a fixed up makefile (remove the .txt suffix before using).

I just saved it on my computer (without any editing) and attempted to run my codes with this Makefile - I got the following error messages:

-------

LINK : fatal error LNK1104: cannot open file ''C:\Program.obj'

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Intel\Composer XE 2013\bin\ia32\ifort.EXE"' : return code '0x450'

ifort: command line warning #10161: unrecognized source type ''C:\Program'; object file assumed

ifort: command line warning #10161: unrecognized source type 'Files'; object file assumed

ipo: error #11018: Cannot open 'C:\Program ipo: error #11018: Cannot open Files

ipo: error #11018: Cannot open (x86)\NAG\FL22\flw3222dcl\lib\'FLW3222DC_nag.lib

----------

Strangely enough, when I got back to my old Makefile (where I added the line from your code that was missing in mine, all: myprog.exe contourprog.exe), removed all blank lines, and also added a slash as an additional separator (although it was given in the LIBDIR, it also wanted to see the slash as $(LIBDIR)\$(LIBNAME) in the call)

Now my code works! With your help, I have managed to migrate the package, at last.

I am very grateful to you guys, many thanks to Steve, too!

I was stuck with this task for several weeks, and NAG support could not help me with compilation (well, with Christmas break making my silly questions even sillier for them, I assume).

Thank you both very much!

Yours sincerely

Valerie

0 Kudos
Steven_L_Intel1
Employee
1,477 Views

We're glad to hear it!

0 Kudos
Reply