Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewC
New Contributor I
118 Views

Composer XE (12.0.2) libcmt being linked by libmatmul

I have am transitioning my Visual Studio 2008 projects from Compiler 11.1 (067) to Composer XE (12.0.2).

A problem is that when I link the "Release/x64" build of my DLL I get the following error due to libcmt.lib being introduced into the link somehow.

>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup


And I found what was causing the issue

One of my projects was being compiled /O3 /Qparallel. If you read the "fine print" this automatically invokes /Qopt-matmul

Searching E:\\Program Files (x86)\\Intel\\ComposerXE-2011\\compiler\\lib\\intel64\\libmatmul.lib

If you do a
dumpbin /DIRECTIVES of libmatmul.lib above you see


Linker Directives
-----------------
-defaultlib:"libiomp5md"
-defaultlib:"libmmt"
-defaultlib:"LIBCMT" <-------------- ERROR
-defaultlib:"libirc"
-defaultlib:"svml_disp"
-defaultlib:"OLDNAMES"
-defaultlib:"libdecimal"

Note : sample project attached. Requires VS 2008 and Composer X3E 12.0.2
Build X64/Release configuration
0 Kudos
7 Replies
TimP
Black Belt
118 Views

If you know that you don't want the library MATMUL, you could turn off opt-matmul. This might be the right course anyway if your matrices aren't large, like 30x100.
Does the /nodefaultlib:libcmt.lib work, in case you do want the opt-matmul?
AndrewC
New Contributor I
118 Views

I can turn off the option manually once I knew what the issue was.

But the points are
  • This is a pretty subtle hidden change and quite a trap to fall into. I think /O3 and /Qparallel should not "automatically" turn on another option.
  • It occupied me for the better part of a day to diagnose the issue. It is actually very difficult to track down which dependent library forces libcmt to be included.
  • the "matmul" option is not well documented
  • There clearly is a bug in that there needs to be a libmatmulMD.lib and libmatmulMDd.lib for when /MD and /MDd are set in the compiler options.
Om_S_Intel
Employee
118 Views

I think depedancy checker would help in finding the dependant modules. I do not think debug version of libray would help.
AndrewC
New Contributor I
118 Views

Dependency checker ( do you mean dependency walker) works with .DLL and .EXE. It is of no us in this situation.
The Intel Compiler and build system is automatically linking in libmatmul.lib. libmatmul.lib has been linked against libcmt.lib. This is a bug in the build system
JenniferJ
Moderator
118 Views

Hi vasci_intel,
I agree that it's a bug in building the libmatmul.lib. The "libcmt.lib" should not be linked in because /MD is used. I'll file a bug report about this.

Although changing /O3 to /O2worked around the issue,because the libmatmul.lib is not linked in. But "/nodefaultlib:libcmt" worked for me.

thanks for letting us know and also thanks for providing a testcase.

Jennifer
JenniferJ
Moderator
118 Views

Hello,
This bug has been fixed in Update 9 at least. The latest update is update 10 right now.

thanks,
Jennifer
junziyang
Beginner
118 Views

I'm fraid the problem still exist for the Fortran Compiler.
When I try to compile with the /Qopt-matmul I got the following error:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
libifcoremd.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main
pdesolverLW.mexw32 : fatal error LNK1120: 1 unresolved externals
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:libraryMSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:librarylibifcoremd.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _mainpdesolverLW.mexw32 : fatal error LNK1120: 1 unresolved externals
Reply