Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • dietfrid.maliptv.deAugust 6, 2009 9:56 AM PDT   
    Linker errors

    I am currently trying to build a Windows DLL using the Intel C++ compiler from the command line (this has to be because the goal is to integrate the Intel C++ compiler into our automated build processes). I have built all libraries the DLL depends on using Intel C++ in debug mode. Now when I try to link I either get multiply defined symbols from msvcrt.dll, libcmt.dll and libc.dll, or missing symbols when I exclude these from the link (with /NODEFAULTLIB).

    In my environment, the Intel compiler works inside (or together with) a Visual C 2005 environment.

    What's going wrong here?

    I haven't found anything useful in the (rather pathetic) documentation that has come with the compiler, nor with Google.

    TimP (Intel)August 6, 2009 11:44 AM PDT
    Rate
     
    Re: Linker errors

    Presence of references to multiple math libraries contradicts your belief that everything was built with VS2005 debug mode.  All references should be to multithreaded libraries, either debug or release.  You would have to link with just one VS math library, which should happen automatically if everything is consistent.
    There is a specific named msvcrt for each VS version, making it difficult should versions get mixed.


    Jennifer Jiang (Intel)August 6, 2009 12:06 PM PDT
    Rate
     
    Re: Linker errors

    Could be that the command env has different libs linked.

    Also please see this kb http://support.microsoft.com/kb/148652.

    do you have another version of VS like VC.NET 2003 or VS2008? if so, make sure to set up the env to use VS2005. You need to follow instructions here.

    Jennifer



    Download Intel(R) Compiler Product Updates: Registration Center.
    Try Intel(R) Compiler Products: Intel Software Evaluation Center

    dietfrid.maliptv.deAugust 7, 2009 5:32 AM PDT
    Rate
     
    Re: Linker errors

    Quoting - tim18
    Presence of references to multiple math libraries contradicts your belief that everything was built with VS2005 debug mode.  All references should be to multithreaded libraries, either debug or release.  You would have to link with just one VS math library, which should happen automatically if everything is consistent.
    There is a specific named msvcrt for each VS version, making it difficult should versions get mixed.

    What multiple math libraries?

    The DLL I am trying to build uses 6 other libraries. These libraries also have been built with Intel C++, I just checked that. The build process is using identical settings for all artefacts (components) it builds.

    Maybe its a good idea to list all libs I am linking against here:

    From the MS platform SDK: version wsock32 ole32 oleaut32 netapi32 gdi32 user32 kernel32
    From Intel C: libmmd libirc svml_disp libdecimal libmmt libm libguide

    (I omitted the .lib extensions). I figured the Intel C libs to be linked against from linker errors I got (first it complained about libmmd missing, so I added it, then it complained about libirc missing ... etc).

    I am working on two subjects new for me at the same time: Intel C++ and our automated build environment. To integrate Intel C, I have simply taken the build system's VS2005 path, copied and modified it to the best of my knowledge. As I found information about command line usage of Intel C rather sparse, I may of course have made some mistakes when chosing libraries and linker related compiler switches.



    dietfrid.maliptv.deAugust 7, 2009 5:40 AM PDT
    Rate
     
    Re: Linker errors

    Could be that the command env has different libs linked.

    Also please see this kb http://support.microsoft.com/kb/148652.

    do you have another version of VS like VC.NET 2003 or VS2008? if so, make sure to set up the env to use VS2005. You need to follow instructions here.

    Jennifer


    I have multiple VS versions on my machine. Intel C++ has been linked with VS2005, and iclvars_ia32.bat is calling the proper vsvars32.bat file (@call "C:ProgrammeMicrosoft Visual Studio 8Common7Toolsvsvars32.bat").

    I am also wondering that the linker tries to link against the release libs mentioned above, and not the debug libs.


    TimP (Intel)August 7, 2009 7:36 AM PDT
    Rate
     
    Re: Linker errors

    I figured the Intel C libs to be linked against from linker errors I got (first it complained about libmmd missing, so I added it, then it complained about libirc missing ... etc).

    Better way is to run a link with 'icl -# ...' to see which libraries are in use.  You must expect trouble when you add VS2003 libraries, or force the use of release and debug libraries together. I don't see how you can talk about an automated build when you want to over-ride the library choices made by the compiler.


    dietfrid.maliptv.deAugust 7, 2009 8:21 AM PDT
    Rate
     
    Re: Linker errors

    Quoting - tim18
    Better way is to run a link with 'icl -# ...' to see which libraries are in use.  You must expect trouble when you add VS2003 libraries, or force the use of release and debug libraries together. I don't see how you can talk about an automated build when you want to over-ride the library choices made by the compiler.

    Tim,

    I wonder how you come to the conclusion or even assumption I am linking against VS2003 libraries. Apart from that I cannot see a point in making smart assed comments about our build environment, so much more as I wrote that the compiler didn't automatically chose any libraries (I started with no Intel specific libs at all and added those the linker complained about, and I hate having to write this twice because you cannot be bothered to both read and understand what I wrote before). What has build automation to do with selection of link libraries anyway? Nothing!

    So far you haven't helped me at all, just told me that I screwed up (which I found out *before* coming here already).

    Please refrain from posting unconstructive and provocative replies here which have nothing to do with my problem in the future.




    Jennifer Jiang (Intel)August 7, 2009 9:49 AM PDT
    Rate
     
    Re: Linker errors

    Hi,
    Let's try to find out the problem here.

    Here is several things to try:
    0. make sure all the libs are the same: either using /MT or /MD, but not mixed.

    1. remove "libmmt" because "libmmd" is linked already.
    2. if it doesn't help, add option "/Zl" (Z as in Zip, l as in last) to the compiling phrase (this is to tell the compiler do not emit library names to be linked).
    when using /Zl option, you need to explicitely specify all the libs to be linked.

    Let us know how it goes.

    Jennifer


    Download Intel(R) Compiler Product Updates: Registration Center.
    Try Intel(R) Compiler Products: Intel Software Evaluation Center

    mtlroomAugust 7, 2009 12:48 PM PDT
    Rate
     
    Re: Linker errors

    The problem is that you are mixing runtimes, which is a road to a disaster. Most likely in some dll or exe build you are trying to link some static libs that were build using different runtime library. Make sure that all of the static libs are build with the same runtime(check switches: /MD, /MDd, /MT, /MTd and make sure that you don't mix them). If you build debug lib, then use /MTd everywhere and don't mix them. Don't manually make compiler link to LIBCMT.lib or libmm.lib or anything like that. Let it properly choose correct libraries. kernel32.lib, user32.lib etc are unrelated to this problem. Post final line that is used to link and it will be obvious what's wrong.




    mtlroomAugust 8, 2009 6:02 PM PDT
    Rate
     
    Re: Linker errors

    I would like to add some more info on that. Most likely the original poster had the same problem as me. I'm having exactly the same problem right now and I'm absolutely sure that's a bug in the compiler or more likely some bug related to VS integration.
    I'm building ffmpeg library (as I wrote in the other thread). I did a batch build with all targets and I saw some errors related to mixed runtimes. At first I didn't pay attention (I thought that it was invalid zero-sized obj file as usual) and I did full rebuild. Everything went fine. Then I manually deleted all intermidiate folders and did full batch build and I saw again link errors. This time instead of rebuilding I decided to check what's wrong. What I see is definetely compiler for some reason tried to link to outputs from release builds. I'm absolutely sure that I don't have configuration errors (and I don't mix release with deug builds in my configs) and my config as is works if I do rebuild.
    Here's what I got in build output:


    ------ Build started: Project: avcodec-52, Configuration: Release Win32 ------
    Linking... (Intel C++ Environment)
    xilink: executing 'link'
    C:FFMPEGReleaseobjavcodec-52/dsputil_mmx.obj : fatal error LNK1136: invalid or corrupt file
    Build log was saved at "file://C:FFMPEGReleaseobjavcodec-52BuildLog.htm"
    avcodec-52 - 1 error(s), 0 warning(s)
    ------ Build started: Project: avcodec-52, Configuration: Debug Win32 ------
    Compiling with Intel(R) C++ 11.1.038 [IA-32]... (Intel C++ Environment)
    dsputil_mmx.c
    ... ... ...
    Linking... (Intel C++ Environment)
    xilink: executing 'link'
       Creating library C:FFMPEGDebugavcodec-52.lib and object C:FFMPEGDebugavcodec-52.exp
    LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
    Embedding manifest... (Microsoft VC++ Environment)
    Build log was saved at "file://C:FFMPEGDebugobjavcodec-52BuildLog.htm"
    avcodec-52 - 0 error(s), 4 warning(s)
    ------ Build started: Project: avformat-52, Configuration: Release Win32 ------
    Linking... (Intel C++ Environment)
    xilink: executing 'link'
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)


    As you see, I deleted dsputil_mmx.obj because it was invalid obj file, then did batch build. This file was recompiled for release and debug builds and all depended projects had to be relinked. In Release for some reason it's again invalid obj file error (see the first error message) and C:FFMPEGReleaseobjavcodec-52/dsputil_mmx.obj is zero in size. But look the next build: avcodec-52, Configuration: Debug it has a warning LIBCMT conflicts with other libs!! The third one fails completely, becase it links to LIBCMTD and LIBCMT at the same time. Here's a portion of the file://C:FFMPEGDebugobjavcodec-52BuildLog.htm (from the second build that didn't fail but had a warning):


    Build Log      Build started: Project: avcodec-52, Configuration: Debug|Win32
     Command Lines      Creating temporary file "C:DOCUME~1pavelLOCALS~1tempRSP3727.bs" with contents
    [
    /c /O2 /Ob1 /Oi /I "C:FFMPEG\" /I "C:FFMPEGmsvc9include" /I "C:FFMPEGmsvc9include_deps" /D "AV_LOG_MAXLEVEL=24" /D "libavcodec_EXPORTS" /D "HAVE_AV_CONFIG_H" /D "_LARGEFILE_SOURCE=1" /D "_FILE_OFFSET_BITS=64" /D "__USE_ISOC99" /D "__USE_W32_SOCKETS" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WIN32_WINNT=0x0501" /D "_CRT_SECURE_NO_WARNINGS" /D "_WINDLL" /EHsc /MTd /GS /arch:SSE2 /fp:fast /Fo"C:FFMPEGDebugobjavcodec-52/" /W2 /nologo /ZI /Qwd144 /Qwd167 /Qwd175 /Qwd177 /Qwd188 /Qwd556 /Qwd963 /Qwd964 /Qwd10006 /Qwd10156 /Qunroll:0 /debug:expr-source-pos /Qstd:c99 /Qip- /Qunroll0 /Qvec- /Qprof-gen- /Qvec-report0 /Qopt-report:0 /Qvc9 /Qlocation,link,"C:vs2008VCbin"
    ..libavcodecx86dsputil_mmx.c
    ]
    Creating command line "icl.exe "@C:DOCUME~1pavelLOCALS~1tempRSP3727.bs""
    Creating temporary file "C:DOCUME~1pavelLOCALS~1tempRSP372A.bs" with contents
    [
    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /OUT:"C:FFMPEGDebugavcodec-52.dll" /INCREMENTAL:NO /nologo /MANIFEST /MANIFESTFILE:"C:FFMPEGDebugobjavcodec-52avcodec-52.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /TLBID:1 /DEBUG /PDB:"C:FFMPEGDebugavcodec-52.pdb" /SUBSYSTEM:WINDOWS /qnoipo /BASE:"0x16000000" /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:FFMPEGDebugavcodec-52.lib" /MACHINE:X86 /DLL
    C:FFMPEGReleaseSDL.lib
    C:FFMPEGReleaselibz.lib
    C:FFMPEGReleaselibbz2.lib
    C:FFMPEGReleaseavutil-50.lib
    C:FFMPEGReleaselibmp3lame.lib
    C:FFMPEGReleaseSDLmain.lib
    C:FFMPEGReleaselibogg.lib
    C:FFMPEGReleaselibspeex.lib
    C:FFMPEGDebugobjavcodec-52/4xm.obj
    C:FFMPEGDebugobjavcodec-52/8bps.obj
    C:FFMPEGDebugobjavcodec-52/8svx.obj
     
    And if colors worked in this forum editor I would emphasize words Release and Debug from the BuildLog.htm


    dietfrid.maliptv.deAugust 10, 2009 9:31 AM PDT
    Rate
     
    Re: Linker errors

    Well, I tried to make sure everything got recompiled using /MDd, simply removed all explicit library specifications and had the compiler search them out, but I still get a linker error about libc.lib not being found.

    I will recheck whether all my objects and libs are up to date, but assuming they are I am clueless.

    Here is my build log:
    Performing Makefile project actions
    D:ProjectsgplibsptvlibsrcLogLibbuild>if intel == vc7bc (call "C:ProgrammeMicrosoft Visual Studio .NET 2003Common7Toolsvsvars32.bat" ) else if intel == vc7 (call "C:ProgrammeMicrosoft Visual Studio .NET 2003Common7Toolsvsvars32.bat" ) else if intel == vc8 (call "C:ProgrammeMicrosoft Visual Studio 8Common7Toolsvsvars32.bat" ) else if intel == intel (call "C:ProgrammeIntelCompiler11.075cppbinia32iclvars_ia32.bat" )
    Intel(R) C++ Compiler Professional for applications running on IA-32, Version 11.0.075
    Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
    Setting environment for using Microsoft Visual Studio 2005 x86 tools.
    Project : LogDLL
    Project top directory (PROJECT_TOP) : .
    Build project (BUILD) : LogDLL
    Host Operating System (OS) : nt
    Host Platform (OSPLAT) : x86
    Target OS (TARGET_OS) : nt
    Target Platform (TARGET_OSPLAT) : x86
    System Interface (SYS) :
    Byte Order (BYTEORDER) : le
    Graphic User Interface (GUI) :
    Toolset (TOOLSET) : intel
    Configuration (CONFIG) : debug
    Optimization (OPTIM) : /debug:full /Gm /GS /Oy- /Qfp-stack-check /Od
    C Flags (CCFLAGS) : /DWIN32 /Zc:wchar_t- /MDd /W3 /GX
    C++ Flags (C++FLAGS) : /D_MBCS /D_DEBUG /DWIN32 /Zc:wchar_t- /MDd /W3 /GX /DNOMINMAX /DDLL_EXPORTS /D_USRDLL /D_WINDOWS /D_WINDLL
    Linkflags (LINKFLAGS) : /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL
    Libs to link (LINKLIBS) : "C:ProgrammeMicrosoft Visual Studio 8VCatlmfc"libatlsd.lib libsPlatformLibdeliverybinlibntintelPlatformLibd.lib libsIOLibdeliverybinlibntintelIOLibd.lib libsMiscLibdeliverybinlibntintelMiscLibd.lib libsNetLibdeliverybinlibntintelNetLibd.lib libsStringLibdeliverybinlibntintelStringLibd.lib
    C Compiler (CC) : C:ProgrammeIntelCompiler11.075cppbinia32icl
    C++ Compiler (C++) : C:ProgrammeIntelCompiler11.075cppbinia32icl
    Linker (LINK) : C:ProgrammeIntelCompiler11.075cppbinia32icl
    ...found 128 targets...
    ...updating 1 target...
    Link ..deliverybinlibntintelLogDLLd.dll
    LINKFLAGS (INTELC): /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL /DLL /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL
    Intel(R) C++ Compiler Professional for applications running on IA-32, Version 11.0 Build 20090609 Package ID: w_cproc_p_11.0.075
    Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
    Microsoft (R) Incremental Linker Version 8.00.50727.762
    Copyright (C) Microsoft Corporation. All rights reserved.
    -out:LogDLL.exe
    /INCREMENTAL:NO
    /DEBUG
    /verbose:lib
    /DEF:..srcLogDLL.def
    /SUBSYSTEM:WINDOWS
    /MACHINE:X86
    /DLL
    /DLL
    /INCREMENTAL:NO
    /DEBUG
    /verbose:lib
    /DEF:..srcLogDLL.def
    /SUBSYSTEM:WINDOWS
    /MACHINE:X86
    /DLL
    /PDB:..deliverybinlibntintelLogDLLd.pdb
    /out:..deliverybinlibntintelLogDLLd.dll
    tempntx86leinteldebugLogDLLLogDLL.obj
    tempntx86leinteldebugLogDLLLogBase.obj
    tempntx86leinteldebugLogDLLLogConsole.obj
    tempntx86leinteldebugLogDLLLogDebug.obj
    tempntx86leinteldebugLogDLLLogFactory.obj
    tempntx86leinteldebugLogDLLLogFile.obj
    tempntx86leinteldebugLogDLLLogLib.obj
    tempntx86leinteldebugLogDLLLogManager.obj
    tempntx86leinteldebugLogDLLLogTCP.obj
    tempntx86leinteldebugLogDLLLogTool.obj
    tempntx86leinteldebugLogDLLLogUDP.obj
    ..deliverybinlibntintelLogDLL.res
    libsPlatformLibdeliverybinlibntintelPlatformLibd.lib
    libsIOLibdeliverybinlibntintelIOLibd.lib
    libsMiscLibdeliverybinlibntintelMiscLibd.lib
    libsNetLibdeliverybinlibntintelNetLibd.lib
    libsStringLibdeliverybinlibntintelStringLibd.lib
    "C:ProgrammeMicrosoft Visual Studio 8VCatlmfclibatlsd.lib"
    Searching libraries
    Searching libsPlatformLibdeliverybinlibntintelPlatformLibd.lib:
    Searching libsIOLibdeliverybinlibntintelIOLibd.lib:
    Searching libsMiscLibdeliverybinlibntintelMiscLibd.lib:
    Searching libsNetLibdeliverybinlibntintelNetLibd.lib:
    Searching libsStringLibdeliverybinlibntintelStringLibd.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCatlmfclibatlsd.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibuuid.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibmsvcprtd.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32libmmdd.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibMSVCRTD.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32libirc.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32svml_disp.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibOLDNAMES.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32libdecimal.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibkernel32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlibuser32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlibadvapi32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlibole32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlibshell32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKliboleaut32.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlibshlwapi.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32libmmd.lib:
    Searching C:ProgrammeMicrosoft Visual Studio 8VClibMSVCRT.lib:
    Searching C:ProgrammeIntelCompiler11.075cppLibia32libm.lib:
    LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
    set PATH=C:ProgrammeMicrosoft Visual Studio 8VCvcbin;%PATH%
    set PATH=C:ProgrammeMicrosoft Visual Studio 8VCCommon7IDE;%PATH%
    set LIB=C:ProgrammeMicrosoft Visual Studio 8VClib;"C:ProgrammeMicrosoft Visual Studio 8VCatlmfc"lib;C:ProgrammeMicrosoft Visual Studio 8VCPlatformSDKlib;%LIB%
    Echo LINKFLAGS (INTELC): /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL /DLL /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL
    "C:ProgrammeIntelCompiler11.075cppbinia32icl" tempntx86leinteldebugLogDLLLogDLL.obj tempntx86leinteldebugLogDLLLogBase.obj tempntx86leinteldebugLogDLLLogConsole.obj tempntx86leinteldebugLogDLLLogDebug.obj tempntx86leinteldebugLogDLLLogFactory.obj tempntx86leinteldebugLogDLLLogFile.obj tempntx86leinteldebugLogDLLLogLib.obj tempntx86leinteldebugLogDLLLogManager.obj tempntx86leinteldebugLogDLLLogTCP.obj tempntx86leinteldebugLogDLLLogTool.obj tempntx86leinteldebugLogDLLLogUDP.obj ..deliverybinlibntintelLogDLL.res libsPlatformLibdeliverybinlibntintelPlatformLibd.lib libsIOLibdeliverybinlibntintelIOLibd.lib libsMiscLibdeliverybinlibntintelMiscLibd.lib libsNetLibdeliverybinlibntintelNetLibd.lib libsStringLibdeliverybinlibntintelStringLibd.lib "C:ProgrammeMicrosoft Visual Studio 8VCatlmfc"libatlsd.lib /MDd /link /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL /DLL /INCREMENTAL:NO /DEBUG /verbose:lib /DEF:..srcLogDLL.def /SUBSYSTEM:WINDOWS /MACHINE:X86 /DLL /PDB:..deliverybinlibntintelLogDLLd.pdb /out:..deliverybinlibntintelLogDLLd.dll
    ...failed Link ..deliverybinlibntintelLogDLLd.dll...
    ...failed updating 1 target...



Forum jump:  

Intel Software Network Forums Statistics

16,371 users have contributed to 46,346 threads and 163,988 posts to date.

In the past 24 hours, we have 15 new thread(s) 83 new posts(s), and 61 new user(s).

In the past 3 days, the most popular thread for everyone has been Formula for the intersection of straight lines The most posts were made to Take a look at John Burkhard&# The post with the most views is \"-check none\" generates error

Please welcome our newest member claudepi


For more complete information about compiler optimizations, see our Optimization Notice.