Author Topic: Anyone building Code::Blocks using GCC 7.1?  (Read 6414 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Anyone building Code::Blocks using GCC 7.1?
« on: July 05, 2017, 08:07:24 pm »
Is anyone building Code::Blocks using GCC 7.1?

I am using MSys2 GCC 7.1 to try to build Code::Blocks and I think I am getting GCC version related errors.
The first one I fixed by adding an missing C header include for strcmp function.
Decided on the second build error to wait and have someone else fix the issues; or wait till I have more free time.

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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #1 on: July 05, 2017, 09:12:02 pm »
My builds for Fedora 26 and Rawhide (nightlies and official builds of 16.01) are build with gcc 7.1 .
No problems as far as I see.
Logs for the nightlies: https://copr.fedorainfracloud.org/coprs/jenslody/codeblocks/build/575575/ (click on the chroot name).

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #2 on: July 05, 2017, 09:20:18 pm »
is on Fedora gcc 7.1 the system compiler ?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #3 on: July 05, 2017, 10:30:51 pm »
is on Fedora gcc 7.1 the system compiler ?
On coming F26 (current RC 1.4) and Rawhide (development version).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #4 on: July 06, 2017, 06:14:29 am »
Thank you all for your replies.

I have decided to go back to MSys2 GCC 6.3 for now; just do NOT have the time and energy to fix the errors.
Also, I have decided that GCC 7 is just too cutting edge for me to use this early.

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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #5 on: July 06, 2017, 11:21:17 pm »
is on Fedora gcc 7.1 the system compiler ?
On coming F26 (current RC 1.4) and Rawhide (development version).
F26 Final will be released on Tuesday, July 11th, 2017.
« Last Edit: July 06, 2017, 11:24:08 pm by jens »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #6 on: July 11, 2017, 09:36:42 am »
I have installed OpenSuse Tumbleweed:
- gcc 7.1
- wx 3.0.3

BUT the wx (+devel) by default is the stl variant (wxUSE_STL is defined), and as such I hit a compile time error real soon:

Code
./toolsmanager.h:46:32: error: ‘ToolsList::Node’ has not been declared
   void DoRemoveTool(ToolsList::Node* node);

So it seems our code is not safe to be build with wx using std containers, they foresee a wrapper (aka wxList -> std::list), but like in this case probably a subtype is not supported anymore ?

How did you build on fedora ? wx containers or std containers ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #7 on: July 11, 2017, 09:50:08 am »
I've tried to fix this in the past, but I don't have the code for this any more.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #8 on: July 11, 2017, 10:36:15 am »
when I switched back to non stl containers CB builds nicely.

And give the same warning/errors while loading resources (new wx 3 behavior)

Code
Manager failed to load XRC resource '/usr/local/share/codeblocks/Cccc.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/CppCheck.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/Cscope.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/DoxyBlocks.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/EditorConfig.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/headerfixup.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/ThreadSearch.zip'.
Tools Plus Plugin: Registering shell type Piped Process Control
Manager failed to load XRC resource '/usr/local/share/codeblocks/ToolsPlus.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/Valgrind.zip'.
Manager failed to load XRC resource '/usr/local/share/codeblocks/wxSmithAui.zip'.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #9 on: July 11, 2017, 03:15:35 pm »
I've tried to fix this in the past, but I don't have the code for this any more.

Partial copy of your old code.
Code
From ed491236a0dd05a647fd06cbcaca465a22ac5c7e Mon Sep 17 00:00:00 2001
From: oBFusCATed <fuscated@gmail.com>
Date: Tue, 6 May 2014 01:04:05 +0300
Subject: [PATCH] - build fixes to make C::B compatible with wx build with stl
 support

---
 src/include/toolsmanager.h                         |  2 +-
 src/plugins/compilergcc/compiler_defs.cpp          | 25 ++++++++----------
 src/plugins/compilergcc/compilergcc.cpp            |  6 ++---
 .../KWIC/src/wx/KWIC/BmpSwitcher.cpp               | 18 ++++---------
 src/sdk/toolsmanager.cpp                           | 30 ++++++++--------------
 5 files changed, 31 insertions(+), 50 deletions(-)

diff --git a/src/include/toolsmanager.h b/src/include/toolsmanager.h
index 9db68d33f..3eeb9ba05 100644
--- a/src/include/toolsmanager.h
+++ b/src/include/toolsmanager.h
@@ -43,7 +43,7 @@ class DLLIMPORT ToolsManager : public Mgr<ToolsManager>, public wxEvtHandler
  private:
  ToolsManager();
  ~ToolsManager();
- void DoRemoveTool(ToolsList::Node* node);
+
  int Configure();
  bool Execute(const cbTool* tool);
  void LoadTools();
diff --git a/src/plugins/compilergcc/compiler_defs.cpp b/src/plugins/compilergcc/compiler_defs.cpp
index 293f51e3c..a5eb4d97e 100644
--- a/src/plugins/compilergcc/compiler_defs.cpp
+++ b/src/plugins/compilergcc/compiler_defs.cpp
@@ -54,30 +54,27 @@ void CompilerQueue::Add(CompilerCommand* cmd)
 
 void CompilerQueue::Add(CompilerQueue* queue)
 {
-    wxCompilerCommandsNode* node = queue->m_Commands.GetFirst();
-    while (node)
+    for (CompilerCommands::iterator it = queue->m_Commands.begin(); it != queue->m_Commands.end(); ++it)
     {
-        if (node->GetData())
-            Add(new CompilerCommand(*(node->GetData())));
-        node = node->GetNext();
+        if (*it)
+            Add(new CompilerCommand(**it));
     }
 }
 
 CompilerCommand* CompilerQueue::Peek()
 {
-    wxCompilerCommandsNode* node = m_Commands.GetFirst();
-    if (!node)
-        return 0;
-    return node->GetData();
+    if (m_Commands.empty())
+        return nullptr;
+    else
+        return m_Commands.front();
 }
 
 CompilerCommand* CompilerQueue::Next()
 {
-    wxCompilerCommandsNode* node = m_Commands.GetFirst();
-    if (!node)
-        return 0;
-    CompilerCommand* cmd = node->GetData();
-    m_Commands.Erase(node);
+    if (m_Commands.empty())
+        return nullptr;
+    CompilerCommand* cmd = m_Commands.front();
+    m_Commands.pop_front();
     m_LastWasRun = cmd ? cmd->isRun : false;
     return cmd;
 }
diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index 92ba52a6d..48f53851d 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -1384,10 +1384,10 @@ void CompilerGCC::DoClearTargetMenu()
     if (m_TargetMenu)
     {
         wxMenuItemList& items = m_TargetMenu->GetMenuItems();
-        while (wxMenuItemList::Node* node = items.GetFirst())
+        for (wxMenuItemList::iterator it = items.begin(); it != items.end(); ++it)
         {
-            if (node->GetData())
-                m_TargetMenu->Delete(node->GetData());
+            if (*it)
+                m_TargetMenu->Delete(*it);
         }
 // mandrav: The following lines DO NOT clear the menu!
 //        wxMenuItemList& items = m_TargetMenu->GetMenuItems();
diff --git a/src/plugins/contrib/wxContribItems/KWIC/src/wx/KWIC/BmpSwitcher.cpp b/src/plugins/contrib/wxContribItems/KWIC/src/wx/KWIC/BmpSwitcher.cpp
index 7838d6e73..dde2ada7d 100644
--- a/src/plugins/contrib/wxContribItems/KWIC/src/wx/KWIC/BmpSwitcher.cpp
+++ b/src/plugins/contrib/wxContribItems/KWIC/src/wx/KWIC/BmpSwitcher.cpp
@@ -72,14 +72,9 @@ kwxBmpSwitcher::~kwxBmpSwitcher()
 {
  delete membitmap;
 
- CBmpList::Node *node= m_bmplist.GetFirst() ;
-
- while(node)
- {
-        wxBitmap *current = node->GetData();
- delete current ;
- node = node->GetNext() ;
- }
+ m_bmplist.DeleteContents(true);
+ m_bmplist.Clear();
+ m_bmplist.DeleteContents(false);
 }
 
 void kwxBmpSwitcher::OnPaint(wxPaintEvent &WXUNUSED(event))
@@ -102,19 +97,16 @@ void kwxBmpSwitcher::OnPaint(wxPaintEvent &WXUNUSED(event))
  // Cryogen 16/4/10 Fixed to prevent a crash when m_nCount = 0. This is necessary for
  // wxSmithKWIC to be able to initialise the control before bitmaps are added.
  // Also moved update of m_nCount and m_nState to the appropriate functions.
- CBmpList::Node *node;
  switch(m_nCount){
  case 0:
  break;
  case 1:
- node = m_bmplist.GetFirst();
- pCurrent = node->GetData() ;
+ pCurrent = m_bmplist.front();
  dc.DrawBitmap(*pCurrent, 0, 0, TRUE);
  break;
 
  default:
- node = m_bmplist.Item(m_nState);
- pCurrent = node->GetData() ;
+ pCurrent = m_bmplist.Item(m_nState)->GetData();
 
  dc.DrawBitmap(*pCurrent, 0, 0, TRUE);
  break;
diff --git a/src/sdk/toolsmanager.cpp b/src/sdk/toolsmanager.cpp
index a0116bde3..c82968273 100644
--- a/src/sdk/toolsmanager.cpp
+++ b/src/sdk/toolsmanager.cpp
@@ -214,31 +214,23 @@ void ToolsManager::InsertTool(int position, const cbTool* tool, bool save)
 void ToolsManager::RemoveToolByIndex(int index)
 {
     int idx = 0;
-    for (ToolsList::Node* node = m_Tools.GetFirst(); node; node = node->GetNext())
+    for (ToolsList::iterator it = m_Tools.begin(); it != m_Tools.end(); ++it)
     {
         if (idx == index)
         {
-            DoRemoveTool(node);
+            m_Tools.erase(it);
+            SaveTools();
             return;
         }
         ++idx;
     }
 }
 
-void ToolsManager::DoRemoveTool(ToolsList::Node* node)
-{
-    if (node)
-    {
-        m_Tools.DeleteNode(node);
-        SaveTools();
-    }
-}
-
 cbTool* ToolsManager::GetToolByMenuId(int id)
 {
-    for (ToolsList::Node* node = m_Tools.GetFirst(); node; node = node->GetNext())
+    for (ToolsList::iterator it = m_Tools.begin(); it != m_Tools.end(); ++it)
     {
-        cbTool* tool = node->GetData();
+        cbTool* tool = *it;
         if (tool->GetMenuId() == id)
             return tool;
     }
@@ -248,9 +240,9 @@ cbTool* ToolsManager::GetToolByMenuId(int id)
 cbTool* ToolsManager::GetToolByIndex(int index)
 {
     int idx = 0;
-    for (ToolsList::Node* node = m_Tools.GetFirst(); node; node = node->GetNext())
+    for (ToolsList::iterator it = m_Tools.begin(); it != m_Tools.end(); ++it)
     {
-        cbTool* tool = node->GetData();
+        cbTool* tool = *it;
         if (idx == index)
             return tool;
         ++idx;
@@ -290,9 +282,9 @@ void ToolsManager::SaveTools()
     }
 
     int count = 0;
-    for (ToolsList::Node* node = m_Tools.GetFirst(); node; node = node->GetNext())
+    for (ToolsList::iterator it = m_Tools.begin(); it != m_Tools.end(); ++it)
     {
-        cbTool* tool = node->GetData();
+        cbTool* tool = *it;
         wxString elem;
 
         // prepend a 0-padded 2-digit number to keep ordering
@@ -320,9 +312,9 @@ void ToolsManager::BuildToolsMenu(wxMenu* menu)
         m_ItemsManager.Add(menu, wxID_SEPARATOR, _T(""), _T(""));
     }
 
-    for (ToolsList::Node* node = m_Tools.GetFirst(); node; node = node->GetNext())
+    for (ToolsList::iterator it = m_Tools.begin(); it != m_Tools.end(); ++it)
     {
-        cbTool* tool = node->GetData();
+        cbTool* tool = *it;
         if (tool->GetName() == CB_TOOLS_SEPARATOR)
         {
             m_ItemsManager.Add(menu, wxID_SEPARATOR, _T(""), _T(""));
--
2.13.2.windows.1
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Anyone building Code::Blocks using GCC 7.1?
« Reply #10 on: July 25, 2017, 06:56:32 pm »
Decided to go back to GCC 7.1 under MSys2.

Turns out only the first error was caused by GCC 7.1.

Patch below in case it looks like one worth fixing in SVN

Code
--- a/src/include/scripting/sqplus/sqplus.h	(revision 11115)
+++ b/src/include/scripting/sqplus/sqplus.h (working copy)
@@ -11,6 +11,7 @@
 #define _SQ_PLUS_H_
 
 #include <stdlib.h>
+#include <strings.h>  // strcasecmp
 
 #ifdef __APPLE__
   #include <malloc/malloc.h>

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