Mon Jan 11 04:48:57 2010: Request 53584 was acted upon.
Transaction: Ticket created by KMX
       Queue: Alien-wxWidgets
     Subject: Another 64-bit troubles with mingw-w64 compiler
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: k...@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53584 >


Hi,

I have done another testing with mingw-w64 bit compiler.

After fixing #53471 and #53293 Alien::wxWidgets works nice with 32-bit
compiler from mingw-w64 projects. However there are still some issue
concerning 64-bit compiler by mingw-w64 (yes they do not deliver only
64-bit compiler). 

Here are 2 of them (both tested on Alien::wxWidgets 0.50 +
wxWidgets-2.8.10):

1) filefn.h issue

I have experienced this error during compilation:

g++ -c -o gcc_mswudll\basedll_appbase.o  -O2 -mthreads  -DHAVE_W32API_H
-D__WXMSW__ -D_UNICODE   -I..\..\lib\gcc_dll\mswu -I..\..\include -Wall
-I..\..\src\tiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib
-I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 DWXMAKINGDLL_BASE
-DwxUSE_BASE=1   -Wno-ctor-dtor -privacy
-MTgcc_mswudll\basedll_appbase.o -MFgcc_mswudll\basedll_appbase.o.d -MD
-MP ../../src/common/appbase.cpp
In file included from ..\..\include/wx/utils.h:21,
                 from ../../src/common/appbase.cpp:35:
..\..\include/wx/filefn.h:286: error: 'stati64' in namespace '::' does
not name a type
make: *** [gcc_mswudll\basedll_appbase.o] Error 1

The problem is in this section of filefn.h:

#if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) ||
defined(__MINGW64__)
    #define wxPOSIX_IDENT(func)    ::func
#else // by default assume MSVC-compatible names
    #define wxPOSIX_IDENT(func)    _ ## func
    #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS
#endif

I do not know why there is defined(__MINGW64__) because AFAIK mingw-w64
compiler fits into #else branche (uses underscore).

Fix is to remove defined(__MINGW64__) from #if condition

Note:
__MINGW64__ is defined by 64-bit compiler from mingw-w64 project
__MINGW32__ is defined by both 32/64-bit compilers from mingw-w64 project

2) Problem with src/msw/thread.cpp

g++ -c -o gcc_mswudll\basedll_thread.o  -O2 -mthreads  -DHAVE_W32API_H
-D__WXMSW__ -D_UNICODE -I..\..\lib\gcc_dll\mswu -I..\..\include -Wall
-I..\..\src\tiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib
-I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE
-DwxUSE_BASE=1   -Wno-ctor-dtor-privacy  
-MTgcc_mswudll\basedll_thread.o -MFgcc_mswudll\basedll_thread.o.d -MD
-MP ../../src/msw/thread.cpp
../../src/msw/thread.cpp: In static member function 'static
THREAD_RETVAL wxThreadInternal::DoThreadStart(wxThread*)':
../../src/msw/thread.cpp:525: error: cast from 'void*' to
'THREAD_RETVAL' losesprecision
../../src/msw/thread.cpp: In member function 'wxThreadError
wxThreadInternal::WaitForTerminate(wxCriticalSection&, void**, wxThread*)':
../../src/msw/thread.cpp:845: error: cast from 'void*' to 'DWORD' loses
precision
../../src/msw/thread.cpp: In member function 'void wxThread::Exit(void*)':
../../src/msw/thread.cpp:1165: error: cast from 'void*' to 'unsigned
int' loses precision
gmake: *** [gcc_mswudll\basedll_thread.o] Error 1

The problem is IMHO in this section of 

// define wxUSE_BEGIN_THREAD if the compiler has _beginthreadex() function
// which should be used instead of Win32 ::CreateThread() if possible
#if defined(__VISUALC__) || \
    (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
    (defined(__GNUG__) && defined(__MSVCRT__)) || \
    defined(__WATCOMC__) || defined(__MWERKS__)

as it should contain also defined(__MINGW64__) or perhaps also
defined(__MINGW32__) - in case of incompatibility with mingw.org headers
we can use defined(__MINGW64_VERSION_MAJOR).

Unfortunately I am short of time to test it further now, I just want to
keep a record of my up-to-now findings.

If anybody wants to analyse issues on MS Windows 64-bit platform here
you can download my strawberry-like manual build of 64-bit perl:
http://svn.ali.as/cpan/users/kmx/strawberry_64bit-pre/

--
kmx

Reply via email to