Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ironhead on February 22, 2012, 02:31:47 am

Title: Rev. 7830 build issues
Post by: ironhead on February 22, 2012, 02:31:47 am
I've updated to rev. 7830 and I'm having issues compiling using 32-bit mingw:

Code
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1032:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1033:72: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1045:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1046:72: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1056:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
Process terminated with status 1 (4 minutes, 24 seconds)
10 errors, 36 warnings (4 minutes, 24 seconds)

I'm guessing a type issue with the 64-bit modifications?
Title: Re: Rev. 7830 build issues
Post by: Jenna on February 22, 2012, 06:41:56 am
I've updated to rev. 7830 and I'm having issues compiling using 32-bit mingw:

Code
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1032:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1033:72: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1045:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1046:72: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
C:\codeblocks\trunk\src\plugins\debuggergdb\/gdb_commands.h:1056:67: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
C:\wxWidgets-2.8.12\include/wx/string.h:1188:10: error:   initializing argument 1 of 'bool wxString::ToULong(long unsigned int*, int) const' [-fpermissive]
Process terminated with status 1 (4 minutes, 24 seconds)
10 errors, 36 warnings (4 minutes, 24 seconds)

I'm guessing a type issue with the 64-bit modifications?
I got this also (win7 64-bit, but 32-bit compiler).
It comes from these changes:
http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/debuggergdb/debugger_defs.h?op=diff&rev=7828 (http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/debuggergdb/debugger_defs.h?op=diff&rev=7828)

wxString::ToULong, needs an unsigned long * as first parameter, but gets a size_t *.
size_t is defined as unsigned int on 32-bit and can not guarantee to hold the conversion to unsigned long (obviously).
Title: Re: Rev. 7830 build issues
Post by: MortenMacFly on February 22, 2012, 06:47:25 am
I've updated to rev. 7830 and I'm having issues compiling using 32-bit mingw:
What compiler are you using?
Title: Re: Rev. 7830 build issues
Post by: MortenMacFly on February 22, 2012, 06:51:20 am
...could you try this patch, please:
Code
Index: src/plugins/debuggergdb/debugger_defs.h
===================================================================
--- src/plugins/debuggergdb/debugger_defs.h (revision 7830)
+++ src/plugins/debuggergdb/debugger_defs.h (working copy)
@@ -222,9 +222,13 @@
     }
     bool valid; ///< Is this stack frame valid?
     // 64 bit compatibility: don't use unsigned long int here:
+#if defined(_WIN64)
     size_t number; ///< Stack frame's number (used in backtraces).
-    // ...and here:
     size_t address; ///< Stack frame's address.
+#else
+    unsigned long int number; ///< Stack frame's number (used in backtraces).
+    unsigned long int address; ///< Stack frame's address.
+#endif
     wxString function; ///< Current function name.
     wxString file; ///< Current file.
     wxString line; ///< Current line in file.
Title: Re: Rev. 7830 build issues
Post by: Jenna on February 22, 2012, 07:31:43 am
...could you try this patch, please:
Code
Index: src/plugins/debuggergdb/debugger_defs.h
===================================================================
--- src/plugins/debuggergdb/debugger_defs.h (revision 7830)
+++ src/plugins/debuggergdb/debugger_defs.h (working copy)
@@ -222,9 +222,13 @@
     }
     bool valid; ///< Is this stack frame valid?
     // 64 bit compatibility: don't use unsigned long int here:
+#if defined(_WIN64)
     size_t number; ///< Stack frame's number (used in backtraces).
-    // ...and here:
     size_t address; ///< Stack frame's address.
+#else
+    unsigned long int number; ///< Stack frame's number (used in backtraces).
+    unsigned long int address; ///< Stack frame's address.
+#endif
     wxString function; ///< Current function name.
     wxString file; ///< Current file.
     wxString line; ///< Current line in file.

I did the same yesterday (without the win64 macro) and it works here (TDM MinGW 4.4 32-bit).
Title: Re: Rev. 7830 build issues
Post by: stahta01 on February 22, 2012, 07:35:11 am
...could you try this patch, please:
Code
Index: src/plugins/debuggergdb/debugger_defs.h
===================================================================
--- src/plugins/debuggergdb/debugger_defs.h (revision 7830)
+++ src/plugins/debuggergdb/debugger_defs.h (working copy)
@@ -222,9 +222,13 @@
     }
     bool valid; ///< Is this stack frame valid?
     // 64 bit compatibility: don't use unsigned long int here:
+#if defined(_WIN64)
     size_t number; ///< Stack frame's number (used in backtraces).
-    // ...and here:
     size_t address; ///< Stack frame's address.
+#else
+    unsigned long int number; ///< Stack frame's number (used in backtraces).
+    unsigned long int address; ///< Stack frame's address.
+#endif
     wxString function; ///< Current function name.
     wxString file; ///< Current file.
     wxString line; ///< Current line in file.

Win32 build of Code::Blocks main project compiled with the above patch did not try running or compiling contrib projects.

Tim S.

Title: Re: Rev. 7830 build issues
Post by: killerbot on February 22, 2012, 07:43:26 am
why not always have both variables being of type unsigned long ?
Title: Re: Rev. 7830 build issues
Post by: MortenMacFly on February 22, 2012, 08:01:09 am
why not always have both variables being of type unsigned long ?
Because on 32 bit its unsigned long int, on 64 bit its unsigned long long (size_t).
Title: Re: Rev. 7830 build issues
Post by: MortenMacFly on February 22, 2012, 08:02:53 am
did not try running or compiling contrib projects.
Contrib plugins are not yet supported for 64 bit builds, 32 bit builds should not be affected.
Title: Re: Rev. 7830 build issues
Post by: ironhead on February 22, 2012, 12:50:52 pm
why not always have both variables being of type unsigned long ?
Because on 32 bit its unsigned long int, on 64 bit its unsigned long long (size_t).

Why not just use size_t and leave it to the compiler to sort out?  32-bit MinGW will define size_t appropriately, as will 64-bit mingw-w64.
Title: Re: Rev. 7830 build issues
Post by: killerbot on February 22, 2012, 01:07:09 pm
Because on 32 bit its unsigned long int, on 64 bit its unsigned long long (size_t).

Yes, so, if I look at the ifdef posted above (note WIN64 --> what happens on linux 64 bit ??) :
if WIN64 bit --> size_t ==> 64 bits  BUT unsigned long is also 64 bit on 64 bits machines
else (considering this means 32 bit !!!! ??)
unsigned long ==> 32 bits, but size_t is also 32 bits here

Meaning that either unsigned long can be used in both cases, or for that matter size_t can be used for both.

When using unsigned long for printf '%lu' can be used,
and for size_t "%zu"
Title: Re: Rev. 7830 build issues
Post by: MortenMacFly on February 22, 2012, 01:58:14 pm
and for size_t "%zu"
Uaaah - careful here, remember that this caused a silent crash? I would prefer a solution that uses a well established standard... hence I don't know any. :-(
Title: Re: Rev. 7830 build issues
Post by: Biplab on February 22, 2012, 02:20:45 pm
Because on 32 bit its unsigned long int, on 64 bit its unsigned long long (size_t).

Yes, so, if I look at the ifdef posted above (note WIN64 --> what happens on linux 64 bit ??) :
if WIN64 bit --> size_t ==> 64 bits  BUT unsigned long is also 64 bit on 64 bits machines
else (considering this means 32 bit !!!! ??)
unsigned long ==> 32 bits, but size_t is also 32 bits here

Meaning that either unsigned long can be used in both cases, or for that matter size_t can be used for both.

When using unsigned long for printf '%lu' can be used,
and for size_t "%zu"

Win 32 -
size_t => unsigned long int

Win 64 -
size_t => unsigned long long int

Linux 32 & 64 bit
size_t => unsigned long int

So if you use size_t it'll work on all platform. However printf format identifier will be different only under Win 64. You have to use %I64u printf format string to print unsigned 64 bit integer.
Title: Re: Rev. 7830 build issues
Post by: Jenna on February 22, 2012, 03:28:39 pm
As far as I know size_t is usually the same as __SIZE_TYPE__
Win 32 -
size_t => unsigned long int

__SIZE_TYPE__ => unsigned int

Win 64 -
size_t => unsigned long long int

not tested

Linux 32 & 64 bit
size_t => unsigned long int

Linux 32:
__SIZE_TYPE__ => unsigned int

Linux 64:
__SIZE_TYPE__ => long unsigned int

Title: Re: Rev. 7830 build issues
Post by: Biplab on February 22, 2012, 04:47:06 pm
As far as I know size_t is usually the same as __SIZE_TYPE__
Win 32 -
size_t => unsigned long int

__SIZE_TYPE__ => unsigned int

Win 64 -
size_t => unsigned long long int

not tested

Linux 32 & 64 bit
size_t => unsigned long int

Linux 32:
__SIZE_TYPE__ => unsigned int

Linux 64:
__SIZE_TYPE__ => long unsigned int

Win32:
Code
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
Win64:
Code
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
sizeof(long long)=sizeof(unsigned long long)=8
Linux-32-bit:
Code
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
Linux-64-bit:
Code
sizeof(int)=4
sizeof(long)=sizeof(unsigned long)=8
Title: Re: Rev. 7830 build issues
Post by: oBFusCATed on February 22, 2012, 04:59:05 pm
I guess you're after this specs: http://en.wikipedia.org/wiki/64-bit#64-bit_data_models
Title: Re: Rev. 7830 build issues
Post by: Biplab on February 22, 2012, 05:15:19 pm
I guess you're after this specs: http://en.wikipedia.org/wiki/64-bit#64-bit_data_models

There are other guidelines available, too. Wikipedia one is comprehensive.

You can also read the following article.
Quote
http://software.intel.com/en-us/articles/lessons-on-development-of-64-bit-cc-applications/
They have an nice summary about size_t