Author Topic: Rev. 7830 build issues  (Read 18721 times)

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Rev. 7830 build issues
« 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?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Rev. 7830 build issues
« Reply #1 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

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Rev. 7830 build issues
« Reply #2 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?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Rev. 7830 build issues
« Reply #3 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Rev. 7830 build issues
« Reply #4 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).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: Rev. 7830 build issues
« Reply #5 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.

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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: Rev. 7830 build issues
« Reply #6 on: February 22, 2012, 07:43:26 am »
why not always have both variables being of type unsigned long ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Rev. 7830 build issues
« Reply #7 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Rev. 7830 build issues
« Reply #8 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: Rev. 7830 build issues
« Reply #9 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.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: Rev. 7830 build issues
« Reply #10 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"
« Last Edit: February 22, 2012, 01:19:06 pm by killerbot »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Rev. 7830 build issues
« Reply #11 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. :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Rev. 7830 build issues
« Reply #12 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.
Be a part of the solution, not a part of the problem.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Rev. 7830 build issues
« Reply #13 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


Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Rev. 7830 build issues
« Reply #14 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
Be a part of the solution, not a part of the problem.