Compilation error for "emerge kdelibs" on Win7 / MSVC 2008 (SP1)

Martin Spindler spindler at ovgu.de
Tue Aug 24 13:44:22 CEST 2010


   Hi there,

I just tried to "emerge kdelibs" on a Win7 / MSVC 2008 (SP1) system 
resulting with an compilation error. A previous "emerge qt" worked 
without any problems.

However, now (with "emerge kdelibs") there is a compilation error at 
klocale_win.cpp (see below). Apparently, GetLocalInfo(...) returns 
size=0 and thus wchar_t buffer[size] cannot be allocated properly.

Here is the corresponding code snippet (with some additional comments of 
mine):

*** snip - 
%KDEROOT%\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp 
(line 56 - 66) ***
QString KLocaleWindowsPrivate::windowsLocaleValue( LCTYPE key ) const
{
     // Find out how big the buffer needs to be
     int size = GetLocaleInfo( m_winLocaleId, key, 0, 0 );  // (line 59) 
<-- ERROR: returns size = 0!!!
     wchar_t 
buffer[size];                                                     // 
(line 60) <-- ERROR: cannot allocate buffer of size 0 !!!
     if ( GetLocaleInfo( m_winLocaleId, key, buffer, size ) ) {
         return QString::fromWCharArray( buffer );
     } else {
         return QString();
     }
}
*** snap ***

Could I safely do something like this: "wchar_t buffer[((size) ? size : 
10)]? Or do you know about a more appropriate patch?

Please let me know, if you need more information for debugging!

Also, how can I resume "emerge kdelibs" without rebuilding/ downloading 
everything again? My guess would be "emerge kdelibs". Is this correct?

Kind regards,
Martin.

Here is the console log:
D:\KDE-4.4\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp(60) : 
error C2057: expected constant expression
D:\KDE-4.4\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp(60) : 
error C2466: cannot allocate an array of constant size 0
D:\KDE-4.4\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp(60) : 
error C2133: 'buffer' : unknown size
D:\KDE-4.4\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp(90) : 
warning C4996: 'strcpy': This function or variable may be unsafe. Con
sider using strcpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
         C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\INCLUDE\../include/string.h(74) : see declaration of 'strcpy'
D:\KDE-4.4\svn\trunk\KDE\kdelibs\kdecore\localization\klocale_win.cpp(95) : 
warning C4996: 'strcpy': This function or variable may be unsafe. Con
sider using strcpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
         C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\INCLUDE\../include/string.h(74) : see declaration of 'strcpy'
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe' : 
return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 
Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 
Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
emerge fatal error: while running make cmd: nmake /NOLOGO
emerge fatal error: running python 
D:\KDE-4.4\emerge\portage\kde\kdelibs\kdelibs-20080202.py compile
emerge error: fatal error: package kde/kdelibs-20080202 all failed



More information about the Kde-windows mailing list