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

Compilation with ifort ok but problem with link , i don’t have the error messages

Pierre78
Beginner
2,541 Views

Hello

I do the compilation with ifort like this: ifort file1.f90 file2.F90 file3.f90 /exe:program.exe

Output:

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

File2.F90(793): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.

 

No error during compilation, the .obj files are created, but the exe file is not created, probably due to an error during link

The problem: the link is done in a new shell window that closes immediately after, so it is not possible to see the messages. I just can see a command window blinking but it is too quick to read something.

I also tried to launch a link command beginning by start: start Link xx.obj

Or finishing by /K: Link xx.obj /K

But without success

Any idea to know what is wrong ?

Thank you

 

Remark: Compilation with visual studio is OK:

1>------ Rebuild All started: Project: Verifications, Configuration: Debug Win32 ------

1>Deleting intermediate files and output files for project 'Verifications', configuration 'Debug|Win32'.

1>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.7.287 [IA-32]...

1>file2.F90(793): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.

1>Linking...

1>Embedding manifest...

1>Build log written to file://c:\user\visual studio 2015\projects\verifications\Verifications\Debug\BuildLog.htm

1>Verifications - 0 error(s), 0 warning(s)

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

 

0 Kudos
28 Replies
mecej4
Honored Contributor III
1,804 Views

Check whether all three object files from the compilation are present (and none has zero length). If not, use ifort /c <source file names> to create them.

Now, try calling link directly:

     link file1.obj file2.obj file3.obj

If you do not see any messages, you can also add the /verbose option. If you still see nothing, try 

     link /?

We may be able to figure out what the problem is by examining the console outputs that you get.

0 Kudos
Pierre78
Beginner
1,796 Views

Thanks for answering.

Object file are generated normally

The /verbose option doesn’t exist.

The problem is that console output is not readable because the command windows closes.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,788 Views

jimdempseyatthecove_0-1596042045430.png

Select the desired command line build environment

For Hello World (project created in MS VS but no build performed)

 

C:\Users\Jim\Source\Repos\Console2\Console2>dir
 Volume in drive C has no label.
 Volume Serial Number is F8CE-A4A4

 Directory of C:\Users\Jim\Source\Repos\Console2\Console2

07/29/2020  12:11 PM    <DIR>          .
07/29/2020  12:11 PM    <DIR>          ..
07/29/2020  12:04 PM               484 Console2.f90
07/29/2020  12:04 PM             2,057 Console2.vfproj
07/29/2020  12:04 PM             1,071 ReadMe.txt
               3 File(s)          3,612 bytes
               2 Dir(s)  348,342,235,136 bytes free

C:\Users\Jim\Source\Repos\Console2\Console2>ifort /c Console2.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on IA-32, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.


C:\Users\Jim\Source\Repos\Console2\Console2>dir
 Volume in drive C has no label.
 Volume Serial Number is F8CE-A4A4

 Directory of C:\Users\Jim\Source\Repos\Console2\Console2

07/29/2020  12:12 PM    <DIR>          .
07/29/2020  12:12 PM    <DIR>          ..
07/29/2020  12:04 PM               484 Console2.f90
07/29/2020  12:12 PM               898 Console2.obj
07/29/2020  12:04 PM             2,057 Console2.vfproj
07/29/2020  12:04 PM             1,071 ReadMe.txt
               4 File(s)          4,510 bytes
               2 Dir(s)  348,342,243,328 bytes free

C:\Users\Jim\Source\Repos\Console2\Console2>ifort Console2.obj
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on IA-32, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:Console2.exe
-subsystem:console
Console2.obj

C:\Users\Jim\Source\Repos\Console2\Console2>dir
 Volume in drive C has no label.
 Volume Serial Number is F8CE-A4A4

 Directory of C:\Users\Jim\Source\Repos\Console2\Console2

07/29/2020  12:12 PM    <DIR>          .
07/29/2020  12:12 PM    <DIR>          ..
07/29/2020  12:12 PM           484,864 Console2.exe
07/29/2020  12:04 PM               484 Console2.f90
07/29/2020  12:12 PM               898 Console2.obj
07/29/2020  12:04 PM             2,057 Console2.vfproj
07/29/2020  12:04 PM             1,071 ReadMe.txt
               5 File(s)        489,374 bytes
               2 Dir(s)  348,341,751,808 bytes free

C:\Users\Jim\Source\Repos\Console2\Console2>

 

 

First ifort built from .f90 to .obj only (compiled with /c)
Second ifort built from .obj to .exe  (IOW Link only)

Jim Dempsey

 

0 Kudos
Pierre78
Beginner
1,759 Views

Hello Jim

That’s what I do, but when ifort does the link, it opens a new windows, performs the link, and then the window closes so it is not possible to get the potential error message (unless recording the screen with a high speed camera)

0 Kudos
andrew_4619
Honored Contributor II
1,745 Views

Strange, opening the Intel command window and doing a simple hello world build look like below for me. why don'y you do the same and copy paste the full output to see if there are any clues people can spot.

Copyright (C) 2009-2020 Intel Corporation. All rights reserved.
Intel(R) Inspector 2020 (build 604266)
Copyright (C) 2009-2020 Intel Corporation. All rights reserved.
Intel(R) Advisor 2020 (build 605410)

Intel(R) MPI Library 2019 Update 7 for Windows* Target Build Environment for Intel(R) 64 applications
Copyright 2007-2020 Intel Corporation.

Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
Intel(R) Compiler 19.1 Update 1 (package 216)

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.22
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files (x86)\IntelSWTools>cd %homepath%

C:\Users\cadfi>ifort hello.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.16.27039.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:hello.exe
-subsystem:console
hello.obj

C:\Users\cadfi>dir hello.*
 Volume in drive C is OS
 Volume Serial Number is 3257-09CB

 Directory of C:\Users\cadfi

30/07/2020  10:24           658,432 hello.exe
30/07/2020  10:18               125 hello.f90
30/07/2020  10:24             1,424 hello.obj
               3 File(s)        659,981 bytes
               0 Dir(s)  365,178,253,312 bytes free

C:\Users\cadfi>hello
  hello world

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,738 Views

FWIW As an observation, it is amazing how far advanced we've come in compiler code generation and O/S integration that we've finally managed to squeeze a 124 byte 3 statement program into the tiny little space of 658,432 bytes of executable.

Jim Dempsey

0 Kudos
andrew_4619
Honored Contributor II
1,733 Views

Yes Jim I remember the pain of  DOS programs that had to fit in 512K of memory along with all OS and graphics memory. For every day spent adding new features we had two days of finding ways to make the code smaller so it could run. I remember the joy of the Phar Lap DOS extender in Powerstation. This first thing I did was make a 10 line program with a 6MB integer array that I filled with 1 to 6M and then  was amazed that I could randomly ask what was at  location 1,345,567 or similar  and marvelled when the answer 1,345,567  was printed on the screen. Such joy! Such Freedom! Been writing bloatware every since  

0 Kudos
andrew_4619
Honored Contributor II
1,716 Views

so do you get the same is you do the minimal command line?

ifort  name.f90 

Also check the path. Do you have some batch file that is being run with the same name as an ifort command?

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,708 Views

This is what I can see from the flashing window:

jimdempseyatthecove_0-1596133043111.png

 

There wasn't a frame capture with the remainder of the output.

Your command line, and linker output (as much as I can see) is OK.

On my system, the Console2 link that works:

C:\Users\Jim\Source\Repos\Console2\Console2>link Console2.obj /SUBSYSTEM:console /OUT:Console2.exe
Microsoft (R) Incremental Linker Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 

0 Kudos
Stephen_Sutcliffe
New Contributor II
1,700 Views

Just a thought but this has happened to me in the past.

Could your virus checker be deleting the .exe file as soon as it gets created?

0 Kudos
Steve_Lionel
Honored Contributor III
1,697 Views

I have never seen the link appear in a new window. Ever.

0 Kudos
Pierre78
Beginner
1,678 Views

Hello Jim , I tried this, but same result:

 

del *.obj

del example_not_ok.exe

ifort example_not_ok.F90 /exe:example_not_ok.exe

link example_not_ok.obj /SUBSYSTEM:console /OUT:example_not_ok.exe

 

Normally I should have an error message  about a missing subroutine (call Missing_Routine)

 

Workaround: I compile in the visual_studio environment to get the messages, but I much prefer to compile in a shell window.

 

@Steve:  there's a first time for everything

 

Pierre

0 Kudos
andrew_4619
Honored Contributor II
1,675 Views

I asked this a few posts back. What happens when you do "ifort example_not_ok.f90" ? Also, check in the PATH that you do not have something such as "link.bat" that is sitting between the your command line an the invocation of link.exe. A rogue (non-standard) script could cause the problem you are seeing.   

0 Kudos
andrew_4619
Honored Contributor II
1,761 Views
0 Kudos
mecej4
Honored Contributor III
1,667 Views

Pierre78 wrote: "The /verbose option doesn’t exist."

That finding may be a clue to what is going wrong. As Andrew also noted, you may have more than one Link.exe or Link.bat accessible along %PATH%. For example, Cygwin installs a link.exe that is used to create and manage links to other files. If this is the case for you, just make sure that the MSVC linker appears earlier along %PATH%.

Every version of the Microsoft linker that I have seen for years has had  the /verbose option.

Please report what you see when, in your development command window, you type the command

     link /?

0 Kudos
Pierre78
Beginner
1,654 Views

Many thanks

No link in path , No link.bat

What happens  when I do “ifort example_not_ok.F90” :

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

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

I specify that when there is no error the exe file is generated.

Here the content of link /?

usage: LINK [options] [files] [@commandfile]

   options:

      /ALIGN:#

      /ALLOWBIND[:NO]

      /ALLOWISOLATION[:NO]

      /APPCONTAINER[:NO]

    / TLBOUT:filename

 

I didn’t see the verbose option for the same reason: window closes

 

When I try , it works , but  for the same reason , I don’t catch the messages  , even trying “link example_not_ok.obj /verbose > file.txt”

 

0 Kudos
andrew_4619
Honored Contributor II
1,647 Views

Are there any LINK or _LINK_ environment variables set? link.exe will parse those....

also if you type <full path>link.exe on your command line does that fare any better?

 

0 Kudos
Pierre78
Beginner
1,642 Views

no "LINK" in the environnement variables

for full path to  link.exe , i will try

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,501 Views

What is the version of the linker shown when you do the link /? command?

When you do that command, you have to hit Enter a few times to get down to /VERBOSE:

      /TIME
      /TSAWARE[:NO]
      /USEPROFILE[:{AGGRESSIVE|PGD=filename}]
      /VERBOSE[:{CLR|ICF|INCR|LIB|REF|SAFESEH|UNUSEDDELAYLOAD|UNUSEDLIBS}]
      /VERSION:#[.#]
      /WINMD[:{NO|ONLY}]
      /WINMDDELAYSIGN[:NO]
0 Kudos
Reply