Menu

#1126 When loading a project no compiler validation checks are done

Undefined
pending
None
Feature_Request
2022-07-02
2021-08-09
No

When a project is loaded there are no compiler validation checks done to ensure that the compilers in the project are valid and installed in C::B.
The code used to check for valid compilers and the pop up when selecting the build options on a project that has been loaded with invalid compilers should occur in the project loading.

Ticket 1125is also part of the complete solution to this issue as you do NOT want the user to be able to select invalid compilers in the dialog that pops up.

Related

Tickets: #1165

Discussion

  • Andrew Cottrell

    Andrew Cottrell - 2021-08-10

    The code to resolve tickets 1125 & 1126 are available from the following github branch:
    https://github.com/acotty/codeblocks_sf/commits/AC-ProjectLoadInvalidCompilerDetection

     
    • Dimitry Sibiryakov

      It is not a good idea to popup every time when a cross-platform project is loaded on Linux while it has Windows targets using msvc compiler.

       

      Last edit: Dimitry Sibiryakov 2021-08-24
  • Morten MacFly

    Morten MacFly - 2022-02-24
    • status: open --> pending
    • assigned_to: Morten MacFly
     
  • Morten MacFly

    Morten MacFly - 2022-02-24

    Please be very careful here! It is perfectly OK to have (targets) with invalid compilers. This will be the case if you have a shared project files that contains targets for different platforms and/or you have specific compilers only available on certain PC's (e.g. nightly builds).

    So any changes that would not reflect these possibilities should seriously be rejected.

    Check your patch again against these use-cases, please and if it is obsolete, flag close it accordingly. Thank you!

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-02-24

      Can you please supply a project for the use case so I can test and update it.

       
  • Morten MacFly

    Morten MacFly - 2022-02-24

    You can easily do it yourself:
    - copy your compiler folder
    - copy a compiler in C::B
    - setup the compiler path to point to the copied compiler folder
    - setup a taget to use the new compiler
    - close project and c::b
    - delete the copied compiler folder
    - open c::b and the project
    - the compiler is invalid but that is and shall be ok.

    Thats what the message that will appear is for.

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-02-24

      Your previous posts was about "shared project files that contains targets for different platforms and/or you have specific compilers only available on certain PC's (e.g. nightly builds"
      I do not have such a complex project and was hoping you had one to save me setting up one that may not be as complex.

      The steps you indicate will on pop up the following message, but I will need to change the detection code as it does not take into consideration the different platforms:

      +        if (!allCompilersDetected)
      +        {
      +            wxString msg(   "At least one of the compiler(s) defined in the project file cannot be located.\n"
      +                            "You will need to manually fix the project compiler usage before you can build the project.\n");
      +
      +            cbMessageBox(   msg,
      +                            "ERROR - Compiler(s) not found",
      +                            wxICON_ERROR
      +                         );
      +        }
      
       
  • Morten MacFly

    Morten MacFly - 2022-02-24

    Btw, it is also perfectly ok to select an invalid compiler therefore. This is by design.

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-02-24

      Looks like you have not looked at the latest patch from yesterday as the design has not changed and therefore I do not understand why you are so against letting an end user know that the project will not build when it is loaded due to invalid compiler being used in the project they have loaded.

       
      • Dimitry Sibiryakov

        The user already know. (S)he is not going to build this particular target in this particular environment. Your message will be simply annoying.

         
        • Morten MacFly

          Morten MacFly - 2022-02-24

          That ist my point. I don't want to see obvious messages for things I know. Your patch would cause this message to appear in 40 percent of the projects I do. And it is additionally to the non intrusive message I see when I try to compile. This and only this should trigger a message. And this is already implemented. There ist one golden rule: Never try to bei smarter than the developer. This will fail. Just report real errors.

           
          • Andrew Cottrell

            Andrew Cottrell - 2022-02-25

            In the projectloader on line 1792 the code uses "/environment/ignore_invalid_targets" , so I will modify the code to only pop up the dialog when this is set to false like if on line 1792 does.
            My code around line 1792 is:

                if (!compiler)
                {
                    if(!(Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/ignore_invalid_targets"), true)))
                    {
                        wxString msg;
                        msg.Printf(_("The defined compiler for %s cannot be located (ID: %s).\n"
                                    "Please choose the compiler you want to use instead and click \"OK\".\n"
                                    "If you click \"Cancel\", the project/target will be excluded from the build."), scope.c_str(),
                                    proposal.c_str());
                        compiler = CompilerFactory::SelectCompilerUI(msg);
                    }
                }
            

            As requested before do you have a sample project for me to test with?

             
            • Andrew Cottrell

              Andrew Cottrell - 2022-02-25

              Morten as you assigned the ticket to yourself , does this mean that you will be making any code changes for the ticket? I do not know how the C::B ticket process works once a ticket has been assigned to someone as I am used to working with other systems where once a ticket/item is assigned to someone then they are in charge iof making any of the required changes.

               
              • Morten MacFly

                Morten MacFly - 2022-04-15

                No, it just means as we are in the discussion none of the other devs needs to take care. I was wondering what the latest version is though becasue after the last discussion there was on update on the patch.

                And I don't foresee at the moment if applying this patch will cause annoying messages all over the place for people (like me) that do cross-compilation were it is perfectly normal that depending on what platform you are you will have invalid compiler settings on project or target level.

                To sum up: What exactly are you trying to solve and is that interfering with anything we don't want to change? Based on the initial explanation of the patch it should be rejected because it would screw cross-compilation completely.

                 
                • Andrew Cottrell

                  Andrew Cottrell - 2022-04-18

                  No, it just means as we are in the discussion none of the other devs needs to take care. I was wondering what the latest
                  version is though becasue after the last discussion there was on update on the patch.
                  No use me wasting my time in updating the patch if it is not going to be looked at or applied.
                  If I do update the patch as per the post of "Andrew Cottrell - 2022-02-25" regarding the "/environment/ignore_invalid_targets"
                  will this be then good or are there more changes required?

                  And I don't foresee at the moment if applying this patch will cause annoying messages all over the place for people (like me)
                  that do cross-compilation were it is perfectly normal that depending on what platform you are you will have invalid compiler
                  settings on project or target level.
                  Again, If I do update the patch as per the post of "Andrew Cottrell - 2022-02-25" regarding the "/environment/ignore_invalid_targets"
                  will this be then good or are there more changes required?

                  To sum up: What exactly are you trying to solve and is that interfering with anything we don't want to change? Based on
                  the initial explanation of the patch it should be rejected because it would screw cross-compilation completely.
                  Did you read and understand the original description?
                  So you want newbies and people who load a project where they do not have the compiler to then sopedn time trying to figure out why
                  the compilation stage fails rather than letting them know that the compiler in the project does not exist.

                   
  • Morten MacFly

    Morten MacFly - 2022-04-15

    A general note: All changes / new features should be non-intrusive. So if a new function causes new messages that there must be a very good reason (=bug) or it must be explicitly enabled by the user and off by default. I also don't know if you can decide at loading time. When a user tries to compile an invalid target - this is worth a message. But that message we have already... these are my doubts here.

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-04-18

      Generally: You get more flies with honey than with vinegar!!!!

       
  • Andrew Cottrell

    Andrew Cottrell - 2022-04-18

    Looks like no one who has responded has thought about giving feedback on using the AnnoyingDialog....

    Attached is patch V3.

     
    • Andrew Cottrell

      Andrew Cottrell - 2022-07-02

      Stalled as usual.....

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.