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

Trouble creating executables/general xilink information

Stephanie_W_
Beginner
769 Views

Hello,

Apologies for the basic question. I'm running a makefile from the command line (version 11.1 of the Intel Visual Fortran Compiler, 64-bit). In my makefile, after defining an INC variable that specifies the location of the includes subdirectory and an OBJS variable which consists of .obj files, I run:

filename : $(OBJS)

     xilink $(OBJS) /out:filename.exe /map:filename.map /FORCE

This is followed by a series of 

name.obj : name.f

     ifort $(INC) name.f

for each of the .obj files in the OBJS variable. 

When I run nmake, the commands get printed out and no errors are thrown, but it does not look like filename.exe gets created. 

I was hoping for some insight on what might be happening or just to be pointed toward resources that discuss xilink, as I haven't been able to find a discussion on how it works nor does xilink /help return anything (I just get errors).

Thanks!

0 Kudos
13 Replies
mecej4
Honored Contributor III
769 Views

Please display the actual and full contents of the makefile (or attach the file to your reply). The fragments that you showed above are not quite accurate. For example, the name of the first target is missing the suffix ".exe", and the rule for making .obj files from .f files is missing the "compile only" option flags. If your makefile contains these errors, you should expect to see rather odd behavior to occur when you run nmake.

0 Kudos
IanH
Honored Contributor II
769 Views

Beyond makefile issues, I'd be inclined to replace the use of xilink with the normal ifort driver - i.e. just use ifort for both compiling (ifort /c ...) and linking.

0 Kudos
Stephanie_W_
Beginner
769 Views

I'm not sure I'm able to publicly share the makefile (will confirm), but can you clarify what you mean by "the name of the first target is missing the suffix '.exe' "? Where exactly should there be a .exe? As for the second issue, it was run with the following flags: "/compile_only /nodebug /fpconstant /optimize:0 /nopdbfile /free /traceback /assume:byterecl /assume:source_include /nolist /static /fpscomp:ldio_spacing"

Also of note: replacing xilink with ifort does not seem to solve the problem.

Thanks!

0 Kudos
mecej4
Honored Contributor III
769 Views

Stephanie W. wrote:

I'm not sure I'm able to publicly share the makefile (will confirm), but can you clarify what you mean by "the name of the first target is missing the suffix '.exe' "? Where exactly should there be a .exe?

The line in the makefile that specifies the first target should be

filename.exe : $(OBJS)

because, unlike in Linux/Unix, the suffix .exe is mandatory in Windows. Since there is no use for an executable file without the suffix, and none is created by the linker, nmake can get confused when the suffix is left out.

As for the second issue, it was run with the following flags: "/compile_only /nodebug /fpconstant /optimize:0 /nopdbfile /free /traceback /assume:byterecl /assume:source_include /nolist /static /fpscomp:ldio_spacing"

This is important and relevant information that should have been provided in the initial post.

Also of note: replacing xilink with ifort does not seem to solve the problem.

It would be more useful if you stated what exactly happened, instead of stating "does not seem to solve...".

0 Kudos
Stephanie_W_
Beginner
769 Views

By "does not seem to solve", I mean the outcome was the same as it was initially, which I described in my first post: " the commands get printed out and no errors are thrown, but it does not look like filename.exe gets created. "

When I change filename to filename.exe in the target, the outcome is the same: the same commands are printed out, without any apparent errors, but no .exe files are created, so I don't think that is the issue.

Without further information (i.e., the full makefile), I understand that this issue will be hard to address.

0 Kudos
Lorri_M_Intel
Employee
769 Views

Not to be too picky, but what "commands get printed out"?   Can you cut-and-paste an example?   Change any filenames to something generic like "myfile.f90" or "myfile.obj" if you want to preserve your company's IP.

If the xilink command is using the same set of compiler flags, then you're passing /compile-only to the linker as well, which means it will not create an executable.

                        --Lorri

0 Kudos
Stephanie_W_
Beginner
769 Views

When I run the makefile in the command line, the output is as follows:

    ifort /compile_only /nodebug /fpconstant /optimize:0 /nopdbfile /free /traceback /assume:byterecl /assume:source_include /nolist /static /fpscomp:ldio_spacing /include:'.\includes\' file1.f
    ifort /compile_only /nodebug /fpconstant /optimize:0 /nopdbfile /free /traceback /assume:byterecl /assume:source_include /nolist /static /fpscomp:ldio_spacing /include:'.\includes\' file2.f

[and so on for the files that are being compiled]

xilink file8.obj file1.obj file2.obj file7.obj file9.obj  file18.obj file19.obj  file20.obj  file21.obj  file22.obj file23.obj  file24.obj  file25.obj  file26.obj file27.obj file28.obj  file29.obj file30.obj file31.obj file32.obj file33.obj  file34.obj  file35.obj  file6.obj  file36.obj file37.obj file38.obj file39.obj  file40.obj file41.obj file42.obj file43.obj file44.obj  file14.obj file15.obj file45.obj lib1.lib lib2.lib lib3.lib lib4.lib lib5.lib lib6.lib /out:output1.exe /map:output1.map /FORCE

[and so on for the executables I am trying to create]

There are no error messages that I can see, but "output1.exe" does not get created anywhere. 

Also, I do not run the xilink with any compiler flags except those specified in the initial post (which you can see in the output).

Hopefully this information is helpful.

0 Kudos
Lorri_M_Intel
Employee
769 Views

Hmm.

Do you also see lines that look like this (possibly with a build version appended as well)

    Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.1   
    Copyright (C) 1985-2011 Intel Corporation.  All rights reserved.

Since this is Windows, by default the banner information (those two lines above) are displayed, and so I'd expect you to see them.

Also, let's try adding /verbose to the xilink options.   This will display a bunch of "stuff" on the screen, and maybe it will give clues as to what's happening?

                        --Lorri

 

0 Kudos
Stephanie_W_
Beginner
769 Views

Yes, I do see the banner information when I open the command window.

However, adding /verbose to the xilink options (now it is is xilink file8.obj file1.obj file2.obj file7.obj file9.obj  file18.obj file19.obj  file20.obj  file21.obj  file22.obj file23.obj  file24.obj  file25.obj  file26.obj file27.obj file28.obj  file29.obj file30.obj file31.obj file32.obj file33.obj  file34.obj  file35.obj  file6.obj  file36.obj file37.obj file38.obj file39.obj  file40.obj file41.obj file42.obj file43.obj file44.obj  file14.obj file15.obj file45.obj lib1.lib lib2.lib lib3.lib lib4.lib lib5.lib lib6.lib /verbose /out:output1.exe /map:output1.map /FORCE) doesn't change the text that is printed out (except the addition of "/verbose"). Is it possible that it is only printing this text without actually running?

0 Kudos
IanH
Honored Contributor II
769 Views

Perhaps this is silly/too obvious - but nmake's behaviour will be to display commands without executing them if it is invoked with the /n command line option.
 

0 Kudos
Stephanie_W_
Beginner
769 Views

Ian, I think that might actually be connected to the issue.

When I first tried to run nmake, I was getting the following errors: "filename.f (line number) error #5102: Cannot open include file 'subfile' " where 'subfile' was a file located in the includes subdirectory called by filename.f which was trying to compile. These problems were resolved by adding 'includes/subfile' to the include statements in filename.f, but there were tens of files being compiled, so I did not want to add 'includes/' to each instance of a file being included. I was under the impression that running nmake with -l includes would help find the includes folder, but it did not. Somewhere (I wish I could find the source), I found a reference to -lincludes and tried running nmake -lincludes, which is how I got to the issue of everything being printed out. The output of nmake -lincludes is the same as nmake /n, which makes me think that I'm somehow just printing everything in the nmake. Does that seem correct? If so, I guess my actual problem is how to get the compiler to find the includes subdirectory without manually modifying every reference to a file in the includes subdirectory...

Thanks, and sorry for these VERY basic questions.

0 Kudos
IanH
Honored Contributor II
769 Views

I suspect that invoking `nmake -Iincludes` is being interpreted as `nmake /I /i /n /c /l /u /d /e /s` or some such bizarreness.  I have no idea what the outcome of that will be, but it won't be what you want!  Type `nmake /?` at a command prompt and see if you can figure it out.

If your makefile is called Makefile, then nmake may not need any command line options.  If your makefile is called something other than `Makefile`, then you might only need the /f xxx option to specify that other name. 

It is the Fortran compiler that was not finding the included Fortran source - it is the Fortran compiler that needs to be told where to search for Fortran include files.  The /include: option that appears in your compiler invocations (which is the same as the /I option) is one way of doing this (and probably the best way), another way is to use the INCLUDE environment variable.

But your example ifort invocation appears to have single quotes in it around the argument to the include option.  I don't know what ifort's command line conventions are for this, but the typical convention for Windows programs is to use double quotes, if quotes are required at all.  Double quotes are only required if the include directory contains special characters or spaces.

Common command line options, such as those specifying include directories would be typically defined in an nmake macro.  That appears to be what INC is in your example.  In the following I use FFLAGS, for Fortran Flags, because I would normally put more than just an include specification in the macro for common command line options.

FC=ifort /nologo /c
FFLAGS=/include:some\include\directory ...other options...

file.obj : file.f
  $(FC) $(FFLAGS) file.f

I only use make under duress, I'll leave it to others to provide better examples.  Bear in mind that the more information you provide, the more likely you are to receive helpful responses.

0 Kudos
Steven_L_Intel1
Employee
769 Views

You also asked what xilink does. This is the Intel "prelinker" that is required if you are linking any objects that were compiled with /Qipo. It scans the objects looking for IPO-compiled sources, collects them, runs them through the compiler optimizer and code generator, then invokes the standard linker. In most cases it just passes through to link without doing anything else.

xilink is described in the compiler documentation, but in general I recommend using "ifort" to the linking rather than xilink as it will supply the necessary library paths.

0 Kudos
Reply