News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Rev. 7830 build issues

Started by ironhead, February 22, 2012, 02:31:47 AM

Previous topic - Next topic

ironhead

I've updated to rev. 7830 and I'm having issues compiling using 32-bit mingw:

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?

Jenna

Quote from: 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:

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

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).

MortenMacFly

Quote from: 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:
What compiler are you using?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

...could you try this patch, please:
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

Quote from: MortenMacFly on February 22, 2012, 06:51:20 AM
...could you try this patch, please:
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).

stahta01

Quote from: MortenMacFly on February 22, 2012, 06:51:20 AM
...could you try this patch, please:
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.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

why not always have both variables being of type unsigned long ?

MortenMacFly

Quote from: killerbot on February 22, 2012, 07:43:26 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

Quote from: stahta01 on February 22, 2012, 07:35:11 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

ironhead

Quote from: MortenMacFly on February 22, 2012, 08:01:09 AM
Quote from: killerbot on February 22, 2012, 07:43:26 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).

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.

killerbot

#10
Quote from: MortenMacFly on February 22, 2012, 08:02:53 AM
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"

MortenMacFly

Quote from: killerbot on February 22, 2012, 01:07:09 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. :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Biplab

Quote from: killerbot on February 22, 2012, 01:07:09 PM
Quote from: MortenMacFly on February 22, 2012, 08:02:53 AM
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.
Be a part of the solution, not a part of the problem.

Jenna

As far as I know size_t is usually the same as __SIZE_TYPE__
Quote from: Biplab on February 22, 2012, 02:20:45 PM
Win 32 -
size_t => unsigned long int

__SIZE_TYPE__ => unsigned int

Quote from: Biplab on February 22, 2012, 02:20:45 PM
Win 64 -
size_t => unsigned long long int

not tested

Quote from: Biplab on February 22, 2012, 02:20:45 PM
Linux 32 & 64 bit
size_t => unsigned long int

Linux 32:
__SIZE_TYPE__ => unsigned int

Linux 64:
__SIZE_TYPE__ => long unsigned int


Biplab

Quote from: jens on February 22, 2012, 03:28:39 PM
As far as I know size_t is usually the same as __SIZE_TYPE__
Quote from: Biplab on February 22, 2012, 02:20:45 PM
Win 32 -
size_t => unsigned long int

__SIZE_TYPE__ => unsigned int

Quote from: Biplab on February 22, 2012, 02:20:45 PM
Win 64 -
size_t => unsigned long long int

not tested

Quote from: Biplab on February 22, 2012, 02:20:45 PM
Linux 32 & 64 bit
size_t => unsigned long int

Linux 32:
__SIZE_TYPE__ => unsigned int

Linux 64:
__SIZE_TYPE__ => long unsigned int

Win32:
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
Win64:
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
sizeof(long long)=sizeof(unsigned long long)=8

Linux-32-bit:
sizeof(int)=sizeof(long)=sizeof(unsigned long)=4
Linux-64-bit:
sizeof(int)=4
sizeof(long)=sizeof(unsigned long)=8
Be a part of the solution, not a part of the problem.