kdebase compile problem

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sat Dec 22 11:51:10 CET 2007


Ralf Habacker schrieb:
> Hi,
> 
> with cmake 2.4.7, CMAKE_BUILD_TYPE=RelWithDebInfo the following code  in 
> FindKDE4Internals.cmake
> 
>    # make sure that no header adds libcmt by default using #pragma 
> comment(lib, "libcmt.lib") as done by mfc/afx.h
>    KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" 
> CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "Release with Debug Info")
>    KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" 
> CMAKE_EXE_LINKER_FLAGS_RELEASE "release")
>    KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" 
> CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "release minsize")
>    KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmtd /DEFAULTLIB:msvcrtd" 
> CMAKE_EXE_LINKER_FLAGS_DEBUG "debug")
> 
> I got the following linker error, which indicates that 
> CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO isn't used as I stated already 
> before.
> 
> Linking CXX executable ..\..\bin\khc_indexbuilder.exe
> msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall 
> type_info::type_info(class type_info const &)" (??0type_info@@AAE at AB
> V0@@Z) already defined in LIBCMT.lib(typinfo.obj)
> msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & 
> __thiscall type_info::operator=(class type_info const &)" (??
> 4type_info@@AAEAAV0 at ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
> LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' 
> conflicts with use of other libs; use /NODEFAULTLIB:library
> ..\..\bin\khc_indexbuilder.exe : fatal error LNK1169: one or more 
> multiply defined symbols found
> NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~4\VC\bin\cl.exe' : return 
> code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Programme\Microsoft Platform SDK for 
> Windows Server 2003 R2\Bin\nmake.exe"' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Programme\Microsoft Platform SDK for 
> Windows Server 2003 R2\Bin\nmake.exe"' : return code '0x2'
> Stop.
> 
> 
> It only works when I use the following code CMAKE_EXE_LINKER_FLAGS
> 
>  KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" 
> CMAKE_EXE_LINKER_FLAGS "Release")
> 
I can't say much on this atm but I wonder why you need the /nodefaultlib
at all. Wouldn't it be better to search where the wrong msvcrt comes
from instead trying to fix it with the crude linker flag. Afaik this
flag makes more trouble than it solves because the warning is correct
sometimes - Peter or apaku showed me where it can break some months ago
while I used this flag in my qt-patches for msvc.  I had no problems
some weeks ago when I build the last kde4-beta releases (which also use
relwithdebinfo as target)


Christian




More information about the Kde-windows mailing list