Page 1 of 1

patch for win64 build

Posted: 2011-04-06 09:36
by twu2
http://trac.filezilla-project.org/ticket/7271

this include patch for filezilla 3.4.0, wxWidgets 2.8.12, gnutls 2.10.5.
after patched, you can build win64 version using mingw64.

it work for FTP and SFTP.
but still not work for FTPS and FTPES, it will crash during handshake. I'm still trying to find the reason for this.

Re: patch for win64 build

Posted: 2011-04-06 11:36
by twu2
the crash caused by the asm code in libgcrypt, it's not work when use mingw64.
after add --disable-asm for libgcrypt, then rebuild libgcrypt, gnutls, filezilla.
now the win64 filezilla work fine also for FTPS/FTPES.

Re: patch for win64 build

Posted: 2011-04-06 11:58
by twu2
if you want to test this, you can download the binary file build by me, just replace the win32 file in filezilla folder.

here is the file:
http://sourceforge.net/projects/filezil ... z/download

edit: update the new binary file created using the new wxwidgets patch.

Re: patch for win64 build

Posted: 2011-04-06 22:19
by botg
I fail to see how this is supposed to work, considering that wxWidgets 2.x does not compile as 64bit Windows application.

In particular, your patch for wx is flawed in that you cast 64bit pointers to 32bit integers.

Re: patch for win64 build

Posted: 2011-04-07 04:35
by tateu
botg wrote:wxWidgets 2.x does not compile as 64bit Windows application.
Not true. I am using a 64bit static build of wxWidgets v2.8.10 with my 64 bit app and Visual Studio 2008.

Re: patch for win64 build

Posted: 2011-04-07 06:08
by twu2
I just update the patch for wxWidgets, remove some un-necessary cast from int64 to int32.

some type I change in this patch, the size in win64 are:

Code: Select all

sizeof int = 4
sizeof size_t = 8
sizeof ssize_t = 8
sizeof intptr_t = 8
sizeof HANDLE = 8
sizeof HGLOBAL = 8
sizeof HINSTANCE = 8
sizeof LPDEVMODE = 8
sizeof UINT_PTR = 8
sizeof ULONG_PTR = 8
sizeof LPARAM = 8
and in win32, all above (except intptr_t, it's not define in win32) size are 4.

the only cast from int64 to int32 in this new patch is the return value of thread.

Code: Select all

diff --strip-trailing-cr -Nur wxWidgets-2.8.12/src/msw/thread.cpp wxWidgets-2.8.12.patched/src/msw/thread.cpp
--- wxWidgets-2.8.12/src/msw/thread.cpp	2011-03-22 20:00:54 +0800
+++ wxWidgets-2.8.12.patched/src/msw/thread.cpp	2011-04-07 13:32:55 +0800
@@ -522,7 +522,7 @@
             return (THREAD_RETVAL)-1;
         }
 
-        rc = (THREAD_RETVAL)thread->Entry();
+        rc = (THREAD_RETVAL)(intptr_t)thread->Entry();
     }
     wxCATCH_ALL( wxTheApp->OnUnhandledException(); )
 
@@ -842,7 +842,7 @@
             break;
         }
 
-        if ( (DWORD)rc != STILL_ACTIVE )
+        if ( (intptr_t)rc != STILL_ACTIVE )
             break;
 
         // give the other thread some time to terminate, otherwise we may be
@@ -1000,7 +1000,7 @@
     // could we set all bits?
     if ( level != 0 )
     {
-        wxLogDebug(_T("bad level %u in wxThread::SetConcurrency()"), level);
+        wxLogDebug(_T("bad level %Iu in wxThread::SetConcurrency()"), level);
 
         return false;
     }
@@ -1162,7 +1162,7 @@
     }
 
 #ifdef wxUSE_BEGIN_THREAD
-    _endthreadex((unsigned)status);
+    _endthreadex((unsigned)(intptr_t)status);
 #else // !VC++
     ::ExitThread((DWORD)status);
 #endif // VC++/!VC++
in wxWidgets 2.9.x trunk, it's doing the same cast here. the return value for thread is a 32bits integer, it can't hold win64 pointer also.
and the _endthreadex() parameter is a unsigned int also in win64. so I think the cast for this won't cause any bad result.