News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

CodeBlocks compiling fail

Started by je_rem_y, January 03, 2012, 02:42:20 AM

Previous topic - Next topic

je_rem_y

Since wxWidgets is not necessarily compiled with "--with-regex=builtin", it might be a good idea to add a condition to handle this case right ?

polylux

Quote from: oBFusCATed on January 03, 2012, 05:12:23 PM
The only thing you could do is to report a bug to the maintainers of wxGTK in Arch.
Building separate version of wxgtk is a workaround with high maintenance cost.

I agree. It's necessary to fix the issue in the repo version. I go write a bug report for that. Thanks everyone.

stahta01

#17
I am willing to post a patch to svn trunk that fixes part of this problem.
But, it will not be perfect.

Edit: It will require testing on your part.

Does anyone wish me to do so?

Tim S.

Patch of first location needed; more locations are still needed to be patched.


Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 7657)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -86,7 +86,7 @@
     m_RE_IfSp.Compile(_T("[^=!<>]+|(([^=!<>]+)[ ]*(=|==|!=|>|<|>=|<=)[ ]*([^=!<>]+))"), wxRE_EXTENDED | wxRE_NEWLINE);
     m_RE_Script.Compile(_T("(\\[\\[(.*)\\]\\])"), wxRE_EXTENDED | wxRE_NEWLINE);
     m_RE_ToAbsolutePath.Compile(_T("\\$TO_ABSOLUTE_PATH{([^}]*)}"),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
                                 wxRE_ADVANCED);
#else
                                 wxRE_EXTENDED);

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]

oBFusCATed

It is not that simple, you should verify that the expressions still work. Probably with the wxregexp testbed plugin.
(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!]

stahta01

#19
Patch that needs tested. Note: It is not worth my time to test it.
The users under Linux with the problem needs to test it.
After, they test it please think about submitting it as a patch to the proper Code::Blocks site.

EDIT2: Possible flaw of patch the defining of wxHAS_REGEX_ADVANCED; I can not find it under windows.
EDIT3: Found it. Wrote a simple wx Program to confirm it is defined for windows wx Build.


Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 7657)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -86,19 +86,19 @@
    m_RE_IfSp.Compile(_T("[^=!<>]+|(([^=!<>]+)[ ]*(=|==|!=|>|<|>=|<=)[ ]*([^=!<>]+))"), wxRE_EXTENDED | wxRE_NEWLINE);
    m_RE_Script.Compile(_T("(\\[\\[(.*)\\]\\])"), wxRE_EXTENDED | wxRE_NEWLINE);
    m_RE_ToAbsolutePath.Compile(_T("\\$TO_ABSOLUTE_PATH{([^}]*)}"),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
                                wxRE_ADVANCED);
#else
                                wxRE_EXTENDED);
#endif
    m_RE_To83Path.Compile(_T("\\$TO_83_PATH{([^}]*)}"),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
                                wxRE_ADVANCED);
#else
                                wxRE_EXTENDED);
#endif
    m_RE_RemoveQuotes.Compile(_T("\\$REMOVE_QUOTES{([^}]*)}"),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
                                wxRE_ADVANCED);
#else
                                wxRE_EXTENDED);
Index: src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp
===================================================================
--- src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp (revision 7657)
+++ src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp (working copy)
@@ -206,7 +206,12 @@

void PipedProcessCtrl::ParseLinks(int lineno, int lastline)
{
-    wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #ifdef wxHAS_REGEX_ADVANCED
+        wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #else
+        wxRegEx re(m_linkregex,wxRE_EXTENDED|wxRE_NEWLINE);
+    #endif
+
    while(lineno<lastline)
    {
        int col=0;
@@ -305,7 +310,11 @@
    wxString text=m_textctrl->GetTextRange(start,end+1);

    //retrieve the file and line number parts of the link
-    wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #ifdef wxHAS_REGEX_ADVANCED
+        wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #else
+        wxRegEx re(m_linkregex,wxRE_EXTENDED|wxRE_NEWLINE);
+    #endif
    wxString file;
    long line;
    if(!re.Matches(text))
Index: src/plugins/contrib/DoxyBlocks/Expressions.h
===================================================================
--- src/plugins/contrib/DoxyBlocks/Expressions.h (revision 7657)
+++ src/plugins/contrib/DoxyBlocks/Expressions.h (working copy)
@@ -84,7 +84,7 @@
    "([^)]*)?"                      // The function's parameters.
    "\\)"                           // The closing parenthesis.
    ),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
    wxRE_ADVANCED);
#else
    wxRE_EXTENDED);
@@ -104,7 +104,7 @@
    "([^)]*)?"                      // The function's parameters.
    "\\)"                           // The closing parenthesis.
    ),
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && defined(wxHAS_REGEX_ADVANCED)
    wxRE_ADVANCED);
#else
    wxRE_EXTENDED);


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]

je_rem_y

I tested your patch and it work perfectly (with all plugins too).
Great work, thank you ;)

It would be nice that it be added to the codeblocks source.

stahta01

Feel free to submit to the Code::Blocks site; I do NOT have the time to keep it up to date till the devs approve it. Also, it needs more testing before the devs should even think about approving it.

http://developer.berlios.de/patch/?func=addpatch&group_id=5358

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]

MortenMacFly

Quote from: stahta01 on January 03, 2012, 07:32:35 PM
Patch that needs tested. Note: It is not worth my time to test it.
OK, I think this patch is fine, but I believe you can safely remove the __WXMAC__ stuff, thus checking only for wxHAS_REGEX_ADVANCED should work on the Mac, too. I was under the impression that this was a Mac only issue, but it isn't as you see.
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]

stahta01

Removing the wxMAC macro from patch; building Code::Blocks on windows right now to verify syntax error not introduced.

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]

stahta01

Updated patch; still not really well tested. But, really not very major changes.
Should be verified it compiles for at least Linux and Mac would be good idea.

No Functional testing done by me; just compile only testing.

Tim S.


Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 7665)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -86,19 +86,19 @@
     m_RE_IfSp.Compile(_T("[^=!<>]+|(([^=!<>]+)[ ]*(=|==|!=|>|<|>=|<=)[ ]*([^=!<>]+))"), wxRE_EXTENDED | wxRE_NEWLINE);
     m_RE_Script.Compile(_T("(\\[\\[(.*)\\]\\])"), wxRE_EXTENDED | wxRE_NEWLINE);
     m_RE_ToAbsolutePath.Compile(_T("\\$TO_ABSOLUTE_PATH{([^}]*)}"),
-#ifndef __WXMAC__
+#ifdef wxHAS_REGEX_ADVANCED
                                 wxRE_ADVANCED);
#else
                                 wxRE_EXTENDED);
#endif
     m_RE_To83Path.Compile(_T("\\$TO_83_PATH{([^}]*)}"),
-#ifndef __WXMAC__
+#ifdef wxHAS_REGEX_ADVANCED
                                 wxRE_ADVANCED);
#else
                                 wxRE_EXTENDED);
#endif
     m_RE_RemoveQuotes.Compile(_T("\\$REMOVE_QUOTES{([^}]*)}"),
-#ifndef __WXMAC__
+#ifdef wxHAS_REGEX_ADVANCED
                                 wxRE_ADVANCED);
#else
                                 wxRE_EXTENDED);
Index: src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp
===================================================================
--- src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp (revision 7665)
+++ src/plugins/contrib/ToolsPlus/PipedProcessCtrl.cpp (working copy)
@@ -206,7 +206,12 @@

void PipedProcessCtrl::ParseLinks(int lineno, int lastline)
{
-    wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #ifdef wxHAS_REGEX_ADVANCED
+        wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #else
+        wxRegEx re(m_linkregex,wxRE_EXTENDED|wxRE_NEWLINE);
+    #endif
+
     while(lineno<lastline)
     {
         int col=0;
@@ -305,7 +310,11 @@
     wxString text=m_textctrl->GetTextRange(start,end+1);

     //retrieve the file and line number parts of the link
-    wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #ifdef wxHAS_REGEX_ADVANCED
+        wxRegEx re(m_linkregex,wxRE_ADVANCED|wxRE_NEWLINE);
+    #else
+        wxRegEx re(m_linkregex,wxRE_EXTENDED|wxRE_NEWLINE);
+    #endif
     wxString file;
     long line;
     if(!re.Matches(text))
Index: src/plugins/contrib/DoxyBlocks/Expressions.h
===================================================================
--- src/plugins/contrib/DoxyBlocks/Expressions.h (revision 7665)
+++ src/plugins/contrib/DoxyBlocks/Expressions.h (working copy)
@@ -84,7 +84,7 @@
     "([^)]*)?"                      // The function's parameters.
     "\\)"                           // The closing parenthesis.
     ),
-#ifndef __WXMAC__
+#ifdef wxHAS_REGEX_ADVANCED
     wxRE_ADVANCED);
#else
     wxRE_EXTENDED);
@@ -104,7 +104,7 @@
     "([^)]*)?"                      // The function's parameters.
     "\\)"                           // The closing parenthesis.
     ),
-#ifndef __WXMAC__
+#ifdef wxHAS_REGEX_ADVANCED
     wxRE_ADVANCED);
#else
     wxRE_EXTENDED);
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]

oBFusCATed

Anyone testing this patch should use the new option -v, when staring C::B!
(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!]

je_rem_y

#26
The new patch still works well on Arch Linux.

But if I start codeblocks with "codeblocks -v" I get this message :
17:46:29: Invalid regular expression '\[([A-z]:)(.*) @ ([0-9]+)\]': Fin d'intervalle invalide
17:46:29: Invalid regular expression '[0-9]+[ ]+([A-Fa-f0-9]+)[ ]+[A-Fa-f0-9]+[ ]+(.*)\[([A-z]:)(.*) @ ([0-9]+)\]': Fin d'intervalle invalide
17:46:29: Invalid regular expression '[ ]([A-z]+.*)[ ]+\[([A-z]:)(.*) @ ([0-9]+)\]': Fin d'intervalle invalide
17:46:29: Invalid regular expression '([A-z0-9]+)[ ]+(0x[0-9A-Fa-f]+)[ ]+(.*)': Fin d'intervalle invalide
17:46:32: Invalid regular expression '\$TO_ABSOLUTE_PATH{([^}]*)}': Contenu invalide de \{\}
17:46:32: Invalid regular expression '\$TO_83_PATH{([^}]*)}': Contenu invalide de \{\}
17:46:32: Invalid regular expression '\$REMOVE_QUOTES{([^}]*)}': Contenu invalide de \{\}
17:46:37: can't open file 'plugin_find_broken_files.script' (error 2: Aucun fichier ou dossier de ce type)
17:46:37: can't open file '/usr/local/share/codeblocks/scripts/plugin_find_broken_files.script' (error 2: Aucun fichier ou dossier de ce type)
17:46:37: can't open file '' (error 2: Aucun fichier ou dossier de ce type)


I don't know if it's due to the patch or not (I hope not).

oBFusCATed

(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!]

stahta01

#28
Just curiosity, but does anyone have a Mac with CB trunk with no patch on it.

What does "codeblocks -v" give?

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]

oBFusCATed

It enables wx logging, I think and you get lots of annoying dialogs :)
(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!]