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

VS2008 lib link problem using Intel Fortran

Ralph_Nelson
Novice
3,093 Views
It has been a year+ since I've worked with the Intel Fortran compiler using VS2008 and I think I've forgotten everything I once knew so forgive my ignorance.

Programs and subroutines compile OK for my application but am getting a link error to "libcmtd.lib" as follows:
"D:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\lib\\LIBCMTD.lib : fatal error LNK1136: invalid or corrupt file"

Would appear to me that it is looking into VC (C compiler stuff?) and not the Intel Fortran libary? I probably don't have a pointer to the library set correctly but suggestions/corrections would be greatly apprecriated.
0 Kudos
25 Replies
Steven_L_Intel1
Employee
2,587 Views
It is normal for LIBCMTD.lib to be referenced - that is indeed the MSVC run-time library but it is needed by the Fortran library. The only thing I can think of here is that the file really is corrupted. Have you tried building a C++ application to see if that works?
0 Kudos
mecej4
Honored Contributor III
2,587 Views
This is not intended to be a solution to your problem: the library LIBCMTD.lib is selected if you have compiled on or more of your sources with "debug" options selected. Can you do clean and rebuild in "release" mode without linker errors?
0 Kudos
Ralph_Nelson
Novice
2,587 Views
No but don't have an C++ apps handy. Could I just reload or add a different distribution for VS?
0 Kudos
mecej4
Honored Contributor III
2,587 Views
You do not need C++ apps. Rebuild the same project as described in your initial post but use a "release" configuration in Visual Studio for your Fortran project/solution.

Intel Fortran cannot link the objects it compiles without using libraries such as LIBCMT.lib, LIBCMTd.lib, MSVCRTxx.lib, etc. Therefore, almost every Fortran program (unless it can be completely optimized away) will use one or more of the Microsoft SDK libraries.
0 Kudos
Steven_L_Intel1
Employee
2,587 Views
I would suggest uninstalling Intel Fortran, doing a "repair" on Visual Studio 2008 (will require that you have the installation media) and then reinstalling Intel Fortran. You do a repair by selecting Visual Studio in Programs and Features (or Add or Remove Programs on XP) and selecting Change/Modify. You will be given the Repair option on a subsequent screen.

Another thing to try, as a workaround, is to open the project properties, go to Fortran > Libraries, and change the run-time library type from "Multi-Threaded Debug" to "Multithreaded". But I worry that if LIBCMTD.LIB is corrupted, other files may be as well.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
Steve,

Apprecriate your assistance.

I had to work out an old include statement syntax which was different than required now.

I tried to compile a released version and see a couple problems that I didn't remember (this is a very old fortran code dating back to Cray XMP days) and there are a few ifdef's that built the excutable for different platforms. I'll have to resolve those.

After I straigthen those out and uninstalling Intel Fortran and repairing VS2008, I'll come back.

Thanks again.

0 Kudos
mecej4
Honored Contributor III
2,586 Views
The Intel Fortran compiler has a number of options to help with preprocessor directives in the input file. Before you set out to modify portions of code containing #ifdef directives, especially if you had the code working with a recent version of IFort, it would be worth your time to read about those options.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
The code hasn't run in a decade and the ifdef coding is extremely outdated in terms of the platforms they were aimed at. I've gone ahead and changed them to coding with will work with my current Win7 environment. It all compiles now and I'm back to the lib problem when it tries to link.
0 Kudos
Steven_L_Intel1
Employee
2,586 Views
What happens if you make the "Use runtime library" change I suggested above?
0 Kudos
Ralph_Nelson
Novice
2,586 Views
When I select "Release" instead of "Debug", basically the same result as previous.

End of build log as follows:

Linking... Creating temporary file "RSP1.rsp" with contents
[ /OUT:"Release\Macro3d.exe" /NOLOGO /MANIFEST /MANIFESTFILE:"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\Release\Macro3d.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS /IMPLIB:"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\Release\Macro3d.lib" "Release\newsolver.obj" "Release\geogen1.obj" "Release\qave.obj" "Release\input.obj" "Release\solve.obj" "Release\krtot2.obj" "Release\cgs1.obj" "Release\bcset.obj" "Release\tempadj.obj" "Release\coeff2.obj" "Release\onofftemp.obj" "Release\dry.obj" "Release\qext.obj" "Release\geogen2.obj" "Release\aaxf.obj" "Release\stemtrack.obj" "Release\kradax1.obj" "Release\cgs2.obj" "Release\thermprop.obj" "Release\macro3d.obj" "Release\datagen.obj" "Release\dtcon.obj" "Release\out.obj" "Release\hover.obj" "Release\qgen.obj" "Release\kradax2.obj" "Release\activate.obj" "Release\submain.obj" "Release\macthin.obj" "Release\clamslib.obj" "Release\timcpu.obj" "Release\datain.obj" "Release\postpro.obj" "Release\exit2.obj" "Release\qtotal.obj" "Release\initial2.obj" "Release\aperf.obj" "Release\tave.obj" "Release\krtot1.obj" "Release\coeff1.obj" "Release\volume.obj" "Release\newmac.obj" "Release\deactivate.obj" "E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\Release\Macro3d.exe.embed.manifest.res" ]

Creating command line "Link @"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\Release\RSP1.rsp""

Link: executing 'link' D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\LIBCMT.lib : fatal error LNK1136: invalid or corrupt file

Macro3d - 1 error(s), 0 warning(s)
0 Kudos
Steven_L_Intel1
Employee
2,586 Views
This is a "Win32" project configuration, yes? At this point I suggest the repair of Visual Studio.
0 Kudos
SergeyKostrov
Valued Contributor II
2,586 Views
- Please take a look at MSDN for LNK1136 error:

...

The input file either has a corrupt header or is zero size or abnormally small.
LNK1136 may also be caused if the file was incorrectly specified as an additional dependency.
See Corrupt Object File for more information.
...

- In Post #6 you'vementioned aboutVS2008 Repair. Did you try to Repair your installation? You have a
corrupted 'LIBCMT.lib' file and it doesn't matter if you change a project configuration it will be still corrupted.

- Take a look at MSDN'stopic "C Run-Time Libraties (CRT)" regardingnaming convensions for Visual
Studio libraries.

'LIBCMT.lib' is a Multi-threaded Staticlibrary forRelease configurations.
In case of Debug configurations 'LIBCMTD.lib' has to be used.

0 Kudos
Steven_L_Intel1
Employee
2,586 Views
Sergey, it is fine to use LIBCMT.LIB in a debug configuration. Using the Debug C libraries gets you some additional error checking around memory allocations, but is not required to debug applications.

I suggested a repair to restore the original versions of the library files, as it seems they have become corrupted. Perhaps a check of the disk structure consistency would also be in order.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
OK, have
1) removed Intel Fortran and repaired VS2008.
2) reinstalled Intel Fortran.
3) switched build to x64 and Release.

Get the following error:
************************** from build log *****************************
Linking... Creating temporary file "RSP1.rsp" with contents
[ /OUT:"x64\Release\Macro3d.exe" /NOLOGO /MANIFEST /MANIFESTFILE:"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\x64\Release\Macro3d.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS /IMPLIB:"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\x64\Release\Macro3d.lib" "x64\Release\stemtrack.obj" "x64\Release\kradax1.obj" "x64\Release\cgs2.obj" "x64\Release\thermprop.obj" "x64\Release\macro3d.obj" "x64\Release\datagen.obj" "x64\Release\dtcon.obj" "x64\Release\out.obj" "x64\Release\hover.obj" "x64\Release\qgen.obj" "x64\Release\kradax2.obj" "x64\Release\activate.obj" "x64\Release\submain.obj" "x64\Release\macthin.obj" "x64\Release\clamslib.obj" "x64\Release\timcpu.obj" "x64\Release\datain.obj" "x64\Release\postpro.obj" "x64\Release\exit2.obj" "x64\Release\qtotal.obj" "x64\Release\initial2.obj" "x64\Release\aperf.obj" "x64\Release\tave.obj" "x64\Release\krtot1.obj" "x64\Release\coeff1.obj" "x64\Release\volume.obj" "x64\Release\newmac.obj" "x64\Release\deactivate.obj" "x64\Release\newsolver.obj" "x64\Release\geogen1.obj" "x64\Release\qave.obj" "x64\Release\input.obj" "x64\Release\solve.obj" "x64\Release\krtot2.obj" "x64\Release\cgs1.obj" "x64\Release\bcset.obj" "x64\Release\tempadj.obj" "x64\Release\coeff2.obj" "x64\Release\onofftemp.obj" "x64\Release\dry.obj" "x64\Release\qext.obj" "x64\Release\geogen2.obj" "x64\Release\aaxf.obj" "E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\x64\Release\Macro3d.exe.embed.manifest.res" ]

Creating command line "Link @"E:\ralph\Macro3d\macro3d.3.12.2012\Macro3d\Macro3d\x64\Release\RSP1.rsp""

Link: executing 'link'
D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64\LIBCMT.lib : fatal error LNK1136: invalid or corrupt file

Macro3d - 1 error(s), 0 warning(s)
************************************ end build log **********************************

When I go look at D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64\LIBCMT.lib it is of length zero so therein lies the problem of course.

Repair of VS didn't solve the problem. Should I remove Fortran compiler and VS2008 then reinstall or is there an easier way.
0 Kudos
Steven_L_Intel1
Employee
2,586 Views
You clearly have bigger problems than this. I suggest running a disk error check. Right click on D in My Computer, select Properties. Go to the Tools tab and select Error Checking > Check Now.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
The check shows all is well. By the way, it is a SSD but that shouldn't matter.
0 Kudos
Steven_L_Intel1
Employee
2,586 Views
The size of the .lib being 0 is something you'll have to fix before anything will work. At this point I suggest uninstalling Fortran and Visual Studio, deleting the Visual Studio 9 folder, then reinstalling.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
Steve,

Went back and checked all drives since it had been awhile. All showed OK.

I'll proceed as you suggest.

Thanks again.
0 Kudos
Ralph_Nelson
Novice
2,586 Views
OK, 2 steps forward and 1 back. The library file is now non-zero.

Next problem is unresolved externals (SSDOMN, SSLUOM, SSLUBC, SSILUR, SSJAC SSLUCS) which are part of the LANL CLAMS library. Any idea were I can download a copy of the LANL CLAMS fortran library or an appropriate library containing them? CLAMS (Common Los Alamos Mathematical Software) Looks like SLATEC might work as well.

Suggestions?
0 Kudos
Ralph_Nelson
Novice
2,499 Views
Looks like SLATEC may fill the bill. Working on getting it going for now.

Per chance you know a library compatible with Intel Fortran to save effort I would apprecriate a point to it. Otherwise I'll continue building SLATEC.

Thanks!
0 Kudos
Reply