Menu

#425 Batch mode doesn't work on MacOS

Undefined
fixed
osx (8)
Bug_Report
2016-12-04
2016-11-03
Riot
No

Attempting to run codeblocks from terminal to build a project with /Applications/CodeBlocks.app/Contents/MacOS/CodeBlocks --build -ns -nc --no-log ./advertcity.workspace --target=All_Mac produces the two following errors:


The .cbp file mentioned does exist in the working directory. Specifying the .cbp file directly just produces the first error twice instead.

Discussion

  • Teodor Petrov

    Teodor Petrov - 2016-11-03
    • labels: --> osx
    • Type: Undefined --> Bug_Report
     
  • Franko F

    Franko F - 2016-11-16

    There is a bug in C::B in batch mode. C::B is looking for libcompiler.so instead of libcompiler.dylib

    patch:

    Index: src/sdk/pluginmanager.cpp
    ===================================================================
    --- src/sdk/pluginmanager.cpp   (revision 10921)
    +++ src/sdk/pluginmanager.cpp   (working copy)
    @@ -948,12 +948,10 @@
             if (!bbplugins.GetCount())
             {
                 // defaults
    
    -            if      (platform::windows)
    -                bbplugins.Add(_T("compiler.dll"));
    -            else if (platform::darwin || platform::macosx)
    -                bbplugins.Add(_T("libcompiler.dylib"));
    -            else
    -                bbplugins.Add(_T("libcompiler.so"));
    +            const wxString compiler = platform::windows                      ? _T("compiler.dll")
    +                                    : (platform::darwin || platform::macosx) ? _T("libcompiler.dylib")
    +                                    :                                          _T("libcompiler.so");
    +            bbplugins.Add(compiler);
             }
         }
    
    Index: src/src/compilersettingsdlg.cpp
    ===================================================================
    --- src/src/compilersettingsdlg.cpp (revision 10921)
    +++ src/src/compilersettingsdlg.cpp (working copy)
    @@ -70,10 +70,10 @@
         if (!bbplugins.GetCount())
         {
             // defaults
    
    -        if (platform::windows)
    -            bbplugins.Add(_T("compiler.dll"));
    -        else
    -            bbplugins.Add(_T("libcompiler.so"));
    +        const wxString compiler = platform::windows                      ? _T("compiler.dll")
    +                                : (platform::darwin || platform::macosx) ? _T("libcompiler.dylib")
    +                                :                                          _T("libcompiler.so");
    +        bbplugins.Add(compiler);
         }
         wxCheckListBox* clb = XRCCTRL(*this, "chkBBPlugins", wxCheckListBox);
         clb->Clear();
    @@ -249,7 +249,9 @@
                 }
             }
    
    
    -        const wxString compiler(platform::windows ? _T("compiler.dll") : _T("libcompiler.so"));
    +        const wxString compiler = platform::windows                      ? _T("compiler.dll")
    +                                : (platform::darwin || platform::macosx) ? _T("libcompiler.dylib")
    +                                :                                          _T("libcompiler.so");
    
             if (bbplugins.Index(compiler) == wxNOT_FOUND)
             {
    

    You can try my build rev10921 goo.gl/o7zjR8
    but first remove config file:
    rm "/Users/$USER/Library/Application Support/codeblocks/default.conf"

    then run "normally":
    /Applications/CodeBlocks.app/Contents/MacOS/CodeBlocks ./advertcity.workspace

    and then:
    /Applications/CodeBlocks.app/Contents/MacOS/CodeBlocks --build -ns -nc --no-log ./advertcity.workspace --target=All_Mac

    regards
    frankofrank

     

    Last edit: Franko F 2016-11-16
  • Teodor Petrov

    Teodor Petrov - 2016-11-16

    For the record the code you've written is unreadable.
    Please next time don't do it like this, but just use several if/else statements!
    The goal of always using const shouldn't affect readability!

     
    • Franko F

      Franko F - 2016-11-17

      So why this was good:

      svn blame src/src/compilersettingsdlg.cpp | grep compiler
      6030 biplab const wxString compiler(platform::windows ?
      _T("compiler.dll") : _T("libcompiler.so"));
      6030 biplab if (bbplugins.Index(compiler) == wxNOT_FOUND)
      6030 biplab bbplugins.Add(compiler);

       
      • Teodor Petrov

        Teodor Petrov - 2016-11-17

        Because there is a single ternary operator.

         
    • Franko F

      Franko F - 2016-11-17

      On Thu, Nov 17, 2016 at 12:36 AM, Teodor Petrov fuscated@users.sf.net
      wrote:

      For the record the code you've written is unreadable.
      Please next time don't do it like this, but just use several if/else
      statements!
      The goal of always using const shouldn't affect readability!

      Hmm, unreadable...
      I was trying write code like You guys.

      svn blame ./src/sdk/pluginmanager.cpp

           5    mandrav int PluginManager::ScanForPlugins(const wxString& path)
           5    mandrav {
        8740 mortenmacf     static const wxString PluginsMask =
      platform::windows                      ? _T("*.dll")
        8737    tpetrov                                       : (platform::darwin
      || platform::macosx) ? _T("*.dylib")
        8740 mortenmacf
      :                                          _T("*.so");
      
       

      Last edit: Franko F 2016-11-17
      • Teodor Petrov

        Teodor Petrov - 2016-11-17

        If it is written by us doesn't make it readable. :)

         
  • Franko F

    Franko F - 2016-11-17

    Next attempt, without 'const'

    Index: src/src/compilersettingsdlg.cpp
    ===================================================================
    --- src/src/compilersettingsdlg.cpp (revision 10921)
    +++ src/src/compilersettingsdlg.cpp (working copy)
    @@ -72,6 +72,8 @@
             // defaults
             if (platform::windows)
                 bbplugins.Add(_T("compiler.dll"));
    
    +        else if (platform::darwin || platform::macosx)
    +            bbplugins.Add(_T("libcompiler.dylib"));
             else
                 bbplugins.Add(_T("libcompiler.so"));
         }
    @@ -249,7 +251,9 @@
                 }
             }
    
    
    -        const wxString compiler(platform::windows ? _T("compiler.dll") : _T("libcompiler.so"));
    +        const wxString compiler = platform::windows                      ? _T("compiler.dll")
    +                                : (platform::darwin || platform::macosx) ? _T("libcompiler.dylib")
    +                                :                                          _T("libcompiler.so");
    
             if (bbplugins.Index(compiler) == wxNOT_FOUND)
             {
    
     
    • Teodor Petrov

      Teodor Petrov - 2016-11-17

      Don't botter with this anymore. I'll commit a cleaner version.

       
  • Teodor Petrov

    Teodor Petrov - 2016-11-17
    • assigned_to: Teodor Petrov
     
  • Teodor Petrov

    Teodor Petrov - 2016-12-04
    • status: open --> fixed
     
  • Teodor Petrov

    Teodor Petrov - 2016-12-04

    Fixed in rev10931.

     

Log in to post a comment.

MongoDB Logo MongoDB