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

Linker error with Visual Studio on Windows 10 with IFX 2024.0 with /Qipo due to object file format

Quintin_Hill
Novice
2,517 Views

TLDR: Using Visual Studio to complile a trivial executable with IFX 2024.0 with /Qipo because the linker expects COFF format object file but LLVM IR bitcode is created instead.  I expected that IPO would be supported.

 

I wanted to try out the new IFX compiler but am hitting failures when compiling in release mode with both the latest IFX 2024.0 and 2023.2.1 (IIRC).   Debug mode works fine and the IFORT compiler has never had such errors.  It also works if whole program optimisation is disabled. The errors I get are of the form:

x64\Release\AntennaTest\Path_Utils.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0xB2C

With the exact obj file with error changing depending on which source files are included in the project.  I managed to reproduce this with a fairly minimal amount of code (10 lines of Fortran).  These are attached to this post along with the vfproj file (with an .xml extension as it was rejected without this, also gzipped).  Can others reproduce this with these files?  I would appreciate it if someone connected to Intel could look at this.

 

Apparently plain text can't be attached here...

The attachment's antennatest.txt content type (text/plain) does not match its file extension and has been removed.

Edit: added /Qipo to title and TLDR.

 

 

Labels (1)
0 Kudos
16 Replies
mecej4
Honored Contributor III
2,505 Views

The file Path_utils.obj that you attached is not a COFF object file; it is a LLVM IR bitcode file, which the linker is unable to process. You will have to look at your build log, compiler options passed, etc., to determine why this file was output in an improper manner (i.e., file suffix not matching actual file format).

The Windows version of IFX 2024.0, which I installed last evening, compiled the two .f90 files that you provided and produced proper AMD64 COFF objects.

Quintin_Hill
Novice
2,495 Views

Interesting.    There is nothing special in the configuration that caused this.

Relevant part of the project file (I attached a version with more settings but this fails too):

		<Configuration Name="Release|x64" UseCompiler="ifxCompiler" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)\$(ProjectName)" WholeProgramOptimization="true">
			<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true"/>
			<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemConsole"/>
			<Tool Name="VFResourceCompilerTool"/>
			<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
			<Tool Name="VFCustomBuildTool"/>
			<Tool Name="VFPreLinkEventTool"/>
			<Tool Name="VFPreBuildEventTool"/>
			<Tool Name="VFPostBuildEventTool"/>
			<Tool Name="VFManifestTool" SuppressStartupBanner="true"/>
		</Configuration>

Note the critical setting is WholeProgramOptimisation everything works without that.  Did you have that set in your successful build?

The output is:

Rebuild started...
1>------ Rebuild All started: Project: AntennaTest (IFX), Configuration: Release x64 ------
Deleting intermediate files and output files for project 'AntennaTest', configuration 'Release|x64'.
Compiling with Intel® Fortran Compiler 2024.0.0 [Intel(R) 64]...
Path_Utils.F90
AntennaTest.F90
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.
Linking...
x64\Release\AntennaTest\Path_Utils.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0xB28

Build log written to  "file://C:/Users/quintin.hill/repos/ifx_test/x64/Release/AntennaTest/BuildLog.htm"
AntennaTest - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild started at 11:01 and took 00.696 seconds ==========

 

0 Kudos
mecej4
Honored Contributor III
2,480 Views

I rarely use Visual Studio -- I compiled with the command

     ifx /Od /MD /Qxhost /c Path_Utils.F90 AntennaTest.F90

and the output messages:

     Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
    Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

I did not request PGO (whole program optimization). Perhaps you could add the phrase to the thread title so that Intel reps will pay attention to that aspect.

0 Kudos
Quintin_Hill
Novice
2,459 Views

Thank you.  I've added /Qipo to the title now.  I ran your command with /Qipo added it gave no error but the question is are the object files in the correct format?

0 Kudos
Quintin_Hill
Novice
2,421 Views

Checking myself the presence of /Qipo determines the type of the generated obj files.

ifx /Od /MD /Qxhost /c Path_Utils.F90 AntennaTest.F90

file *.obj
AntennaTest.obj: Intel amd64 COFF object file, not stripped, 7 sections, symbol offset=0x28b, 23 symbols, 1st section name ".text"
Path_Utils.obj: Intel amd64 COFF object file, not stripped, 4 sections, symbol offset=0x16e, 12 symbols, 1st section name ".text"

 

ifx /Od /MD /Qipo /Qxhost /c Path_Utils.F90 AntennaTest.F90

file *.obj
AntennaTest.obj: LLVM IR bitcode
Path_Utils.obj: LLVM IR bitcode

But the linker doesn't handle the latter case properly.

0 Kudos
Barbara_P_Intel
Moderator
2,373 Views

/ipo is implemented differently with ifx. ifx uses LLVM Link Time Optimization. The /ipo compiler option becomes -flto.  The object files will be different.

Be sure to link with /ipo or -flto. 

0 Kudos
Quintin_Hill
Novice
2,318 Views

The problem is that the Visual Studio integration isn't changing the command line based on the whole program optimisisation.  If I manually add /Qipo to the linker command line it works.

Quintin_Hill_0-1701257781745.png

Gives command line:
/OUT:"x64\Release\AntennaTest.exe" /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\AntennaTest\AntennaTest.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\quintin.hill\repos\ifx_test\x64\Release\AntennaTest.lib"

0 Kudos
andrew_4619
Honored Contributor II
2,312 Views

I am not using IFX as my production build as yet but it does build and run OK.

If I do a release built in VS I have:

andrew_4619_0-1701259293393.png

and

andrew_4619_1-1701259369091.png

 

That gived /Qipo on the compile and nothing on the link. Is that what one would expect? The comments confused me a little.

Quintin_Hill
Novice
2,305 Views

Are you compiling/linking with IFX.  It seems that IFORT doesn't need /Qipo on the linker command line but IFX does need it on the linker command line.  And as you say the Visual Studio intergration is not adding /Qipo to the command line in either case.

0 Kudos
andrew_4619
Honored Contributor II
2,299 Views

That is IFX and it add /Qipo only to the compile not to the link which gets nothing. The optimisation report is full of nothing!

Interesting if I add /Qipo manually to the link command it forces a compile of all the sources so a link option that effects com;piling!  I still  don't get an optimisation report. I have a hunch in both cases it is doing some opt work as the link is taking a long time compared to a none Qipo link.

jimdempseyatthecove
Honored Contributor III
2,107 Views

FWIW the ipo processing occurs at link time, it always has been.

Think of ifort and ifx as being a pre-processor for ipo. The ipo option does cause the compilers to generate additional data structures/files, but the actual optimization occurs at link time.

 

Jim Dempsey

0 Kudos
Barbara_P_Intel
Moderator
2,192 Views

@andrew_4619, do you have a reproducer that shows you're not get the optimization report? The optimization report functionality is different for ifx. For example, for /Qopt-report has levels 1, 2, 3. ifort has 5 levels. Not all the variations of /Qopt-report are supported yet in ifx.

0 Kudos
andrew_4619
Honored Contributor II
2,173 Views

Actually I mis-spoke it seems the Opt report was set to disabled in IFX presumably because of the incompatible level.  If I set a valid level it seems to work ok.

 

0 Kudos
Quintin_Hill
Novice
1,980 Views

So how do we proceed here?  Please can someone raise a ticket to correct the Visual Studio integration such that it adds /Qipo to the linker command line when Interprocedural Optimisation is marked Yes in the linker options in the project properties dialog.

0 Kudos
Barbara_P_Intel
Moderator
1,777 Views

Can you please provide a reproducer?

 

0 Kudos
JohnNichols
Valued Contributor III
1,762 Views

With a stock standard new solution the \qipo is set to yes - see below

Screenshot 2023-12-11 172704.png

but there is no evidence of it in the command line list is this the reproducer you want as I did not change the sln file from its creation. 

 

Screenshot 2023-12-11 172646.png

0 Kudos
Reply