Author Topic: Building CB with CB issues  (Read 7350 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5503
Building CB with CB issues
« on: August 28, 2012, 09:43:58 pm »
When I build CB with CB, followed by running the "./update" script in src directory, and then launching this build CB from within the first CB, I get message boxes.
The boxes do not occur when the build CB (which is in the output directory) is launched on the shell through the run script.

The mentioned message reads :
Quote
Can not enumerate files '/usr/share/myspell/dicts/th*.dat' (error 2: No such file or directory)

Second issue : in the running instance I then option a project which has multiple targets (debug/release variants for certain compiler) and a virtual target "All" (containing all the other targets), then the build process hangs :
I builds the first target (gcc - debug), then it switches to the second one gcc (Release) and nothing happens anymore.
This does not happen and works correctly when again launching through the run script in output directory.
« Last Edit: August 28, 2012, 09:47:31 pm by killerbot »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Building CB with CB issues
« Reply #1 on: August 28, 2012, 10:04:05 pm »
The message box appears, becaus eC::B itself launches C::B with the -v parameter, which turns on additional debug-logging.

I can not say anything about the second issue.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Building CB with CB issues
« Reply #2 on: August 29, 2012, 06:44:27 am »
Second issue : in the running instance I then option a project which has multiple targets (debug/release variants for certain compiler) and a virtual target "All" (containing all the other targets), then the build process hangs :
I builds the first target (gcc - debug), then it switches to the second one gcc (Release) and nothing happens anymore.
This does not happen and works correctly when again launching through the run script in output directory.
Sorry, but I didn't get it: You mean during a running build process you switch to another project and active a certain target?
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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5503
Re: Building CB with CB issues
« Reply #3 on: August 29, 2012, 09:41:56 pm »
ok , let me re-explain .

Project A :    - 4 targets + virtual target (All ==< the 4 targets)
- target 1 : gcc compiler (debug)
- target 2 : gcc compiler (release)
- target 3 : compiler X (debug)
- target 4 : compiler X (release)

CB1 (the one build and installed on the system).
In CB1 load the CB.workspace, and build CB (let's called the build one CB2), in the source tree of CB2 run the update script (devel stuff going into output). IN CB1 launch the build CB2, then in this CB2 load our Project A, choose virtual target 'All' and choose rebuild :
- 4 targets get cleaned
- target 1 gets build
- switch to target2 is made, and hangs, nothing else happens

When the build CB2 would be launched from the shell in the output directory thought the run script ==> all is ok.


Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Building CB with CB issues
« Reply #4 on: September 01, 2012, 02:21:17 pm »
The mentioned message reads :
Quote
Can not enumerate files '/usr/share/myspell/dicts/th*.dat' (error 2: No such file or directory)
This is from the patch to the SpellChecker plugin to make it search the system for resources; the warnings can be removed with:
Code
Index: src/plugins/contrib/SpellChecker/Thesaurus.cpp
===================================================================
--- src/plugins/contrib/SpellChecker/Thesaurus.cpp (revision 8322)
+++ src/plugins/contrib/SpellChecker/Thesaurus.cpp (working copy)
@@ -58,12 +58,17 @@
     else
     {
         Manager::Get()->GetLogManager()->Log(_T("SpellChecker: Thesaurus files '") + idxpath + _T("' not found!"));
-        wxString altIdx = wxFindFirstFile(idxpath.BeforeLast(wxT('.')) + wxT("*.idx"), wxFILE); // "*_v2.idx"
+        wxString altIdx;
+        {
+            wxLogNull logno;
+            altIdx = wxFindFirstFile(idxpath.BeforeLast(wxT('.')) + wxT("*.idx"), wxFILE); // "*_v2.idx"
+        }
         if (altIdx.IsEmpty()) // try again with more wildcards
         {
             altIdx = idxpath.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.')) + wxT("*.idx");
             altIdx.Replace(wxT("_"), wxT("*"));
             altIdx.Replace(wxT("-"), wxT("*"));
+            wxLogNull logno;
             altIdx = wxFindFirstFile(idxpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altIdx, wxFILE);
         }
         if (altIdx.IsEmpty()) // try to find the thesaurus of a related language (something is better than nothing)
@@ -72,6 +77,7 @@
             altIdx.Replace(wxT("_"), wxT("*"));
             altIdx.Replace(wxT("-"), wxT("*"));
             altIdx = altIdx.BeforeLast(wxT('*')) + wxT("*.idx");
+            wxLogNull logno;
             altIdx = wxFindFirstFile(idxpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altIdx, wxFILE);
         }
 
@@ -81,6 +87,7 @@
             altDat = datpath.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.')) + wxT("*.dat");
             altDat.Replace(wxT("_"), wxT("*"));
             altDat.Replace(wxT("-"), wxT("*"));
+            wxLogNull logno;
             altDat = wxFindFirstFile(datpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altDat, wxFILE);
         }
         if (altDat.IsEmpty()) // try to find the thesaurus of a related language (something is better than nothing)
@@ -89,6 +96,7 @@
             altDat.Replace(wxT("_"), wxT("*"));
             altDat.Replace(wxT("-"), wxT("*"));
             altDat = altDat.BeforeLast(wxT('*')) + wxT("*.dat");
+            wxLogNull logno;
             altDat = wxFindFirstFile(datpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altDat, wxFILE);
         }
 
Index: src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp
===================================================================
--- src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp (revision 8322)
+++ src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp (working copy)
@@ -139,6 +139,7 @@
     dictPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
     for (size_t i = 0; i < dictPaths.GetCount(); ++i)
     {
+        wxLogNull logno;
         if (!wxFindFirstFile(dictPaths[i] + wxFILE_SEP_PATH + wxT("*.dic"), wxFILE).IsEmpty())
             return dictPaths[i];
     }
@@ -172,6 +173,7 @@
     thesPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
     for (size_t i = 0; i < thesPaths.GetCount(); ++i)
     {
+        wxLogNull logno;
         if (!wxFindFirstFile(thesPaths[i] + wxFILE_SEP_PATH + wxT("th*.dat"), wxFILE).IsEmpty())
             return thesPaths[i];
     }

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Building CB with CB issues
« Reply #5 on: September 02, 2012, 09:59:03 am »
Code
+            wxLogNull logno;
BTW: Are you aware that the wx guys do not recommend the use of wxLogNull all over the place? I think a better way would be to verify the file/path (whenever possible) before doing a file system based operation.
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 Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Building CB with CB issues
« Reply #6 on: September 02, 2012, 03:06:40 pm »
BTW: Are you aware that the wx guys do not recommend the use of wxLogNull all over the place?
I seem to remember something like that :)...
Will switch to actual checks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Building CB with CB issues
« Reply #7 on: September 02, 2012, 03:58:30 pm »
BTW: Are you aware that the wx guys do not recommend the use of wxLogNull all over the place?
I seem to remember something like that :)...
There are good reasons though to use wxLogNull. For example: If you are accessing multiple directories at once an would need to add endless checks or is you are using low-level function (like locale) where you simply don't know what path's these are going to access.
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 Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Building CB with CB issues
« Reply #8 on: September 02, 2012, 08:15:47 pm »
Code
Index: src/plugins/contrib/SpellChecker/Thesaurus.cpp
===================================================================
--- src/plugins/contrib/SpellChecker/Thesaurus.cpp (revision 8330)
+++ src/plugins/contrib/SpellChecker/Thesaurus.cpp (working copy)
@@ -58,6 +58,8 @@
     else
     {
         Manager::Get()->GetLogManager()->Log(_T("SpellChecker: Thesaurus files '") + idxpath + _T("' not found!"));
+        if (!wxDirExists(idxpath.BeforeLast(wxFILE_SEP_PATH)) || !wxDirExists(datpath.BeforeLast(wxFILE_SEP_PATH)))
+            return; // path does not exist, silence invalid directory warnings
         wxString altIdx = wxFindFirstFile(idxpath.BeforeLast(wxT('.')) + wxT("*.idx"), wxFILE); // "*_v2.idx"
         if (altIdx.IsEmpty()) // try again with more wildcards
         {
Index: src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp
===================================================================
--- src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp (revision 8330)
+++ src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp (working copy)
@@ -139,7 +139,7 @@
     dictPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
     for (size_t i = 0; i < dictPaths.GetCount(); ++i)
     {
-        if (!wxFindFirstFile(dictPaths[i] + wxFILE_SEP_PATH + wxT("*.dic"), wxFILE).IsEmpty())
+        if (wxDirExists(dictPaths[i]) && !wxFindFirstFile(dictPaths[i] + wxFILE_SEP_PATH + wxT("*.dic"), wxFILE).IsEmpty())
             return dictPaths[i];
     }
     return dictPaths[0];
@@ -172,7 +172,7 @@
     thesPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
     for (size_t i = 0; i < thesPaths.GetCount(); ++i)
     {
-        if (!wxFindFirstFile(thesPaths[i] + wxFILE_SEP_PATH + wxT("th*.dat"), wxFILE).IsEmpty())
+        if (wxDirExists(thesPaths[i]) && !wxFindFirstFile(thesPaths[i] + wxFILE_SEP_PATH + wxT("th*.dat"), wxFILE).IsEmpty())
             return thesPaths[i];
     }
     return thesPaths[0];
@@ -181,9 +181,9 @@
 {
     wxString bitmPath = m_BitmPath;
     Manager::Get()->GetMacrosManager()->ReplaceEnvVars(bitmPath);
-    if (wxFindFirstFile(bitmPath + wxFILE_SEP_PATH + wxT("*.png"), wxFILE).IsEmpty())
-        return m_pPlugin->GetOnlineCheckerConfigPath();
-    return bitmPath;
+    if (wxDirExists(bitmPath) && !wxFindFirstFile(bitmPath + wxFILE_SEP_PATH + wxT("*.png"), wxFILE).IsEmpty())
+        return bitmPath;
+    return m_pPlugin->GetOnlineCheckerConfigPath();
 }
 
 const wxString SpellCheckerConfig::GetRawDictionaryPath()const{return m_DictPath;}