9 Replies Latest reply on Nov 26, 2019 2:41 AM by DheerajK_81

    Unable to build libraries when importing a project from a git repository in Windows

    user_1669321

      Hi,

       

      We need to have fixed library versions at each commit of our project. Thus, I have committed all .lib files in ./libs/. However, when my colleague clones the repository on his Windows computer, imports it in Modus, then builds it, it fails with:

       

      C:/Users/username/ModusToolbox/tools_2.0/make/start.mk:338: libs/psoc6make/make/core/main.mk: No such file or directory

      make: *** No rule to make target 'libs/psoc6make/make/core/main.mk'.  Stop.

       

      When he opens Library Manager, the manager is blank and doesn't show any options to add libraries to the project. If he does a "make getlibs" beforehand, then it works. I don't have "make" on my computer, and I don't think that it should be required to build a project. I tried adding "PREBUILD=make getlibs" to the Makefile, but it made the "auto-discovery" never end.

       

      If I import the project with the "New application" wizard and import the project, then I get the error: "Unable to remove project 'project_name'. Unable to delete directory C:\Users\username\Documents\workspace_name\project_name.", so we're stuck with importing the project by right-clicking in the project explorer and selecting "import".

       

      How can we perform the "make getlibs" command through Modus?

        • 1. Re: Unable to build libraries when importing a project from a git repository in Windows
          DheerajK_81

          Looks like you have imported the project incorrectly. Please delete the project files from your workspace manually. Then follow the steps mentioned in the below KBA to import the application correctly:

          Importing Code Example into ModusToolbox IDE - KBA225201

           

          Also, if you are behind a firewall it might restrict certain functions in ModusToolbox, please follow this KBA to solve this: Using ModusToolbox Software Behind a Firewall – KBA228784

           

          How can we perform the "make getlibs" command through Modus?

          We provide Cygwin shell as part of the ModusToolbox installation directory. Run "Cygwin.bat" present in the path: "<ModusToolbox Install Dir>\tools_2.0\modus-shell". Navigate to the application directory and then run "make getlibs".

           

          Note that "make getlibs" is automatically done in the background when you click "Apply" on selected libraries inside Library Manager.

           

          Regards,

          Dheeraj

          2 of 2 people found this helpful
          • 2. Re: Unable to build libraries when importing a project from a git repository in Windows
            user_1669321

            Hi Dheeraj,

             

            I have tried starting from a clean git clone, but to no avail. Here are my steps:

             

            1- Clone git repository "cy-ble-test" (not real name)

            2- Open workspace

            3- Quick Panel -> New Application

            4- Select CY8CPROTO-063-BLE

            5- Import->Select folder cy-ble-test/cy-ble-modus

            6- Rename cy_ble_modus to cy-ble-modus (I don't know why modus replaces dashes with underscores)

            7- Click Next, then click Finish

            8- I get the pop-up "Overwrite existing projects? An application name "cy-ble-modus" already exists in the workspace. Would you like to continue and overwrite it?

             

            If I select "No", then everything gets cancelled and I have to start again. If I select "Yes", then I get the message "Successfully created "cy-ble-modus" application." in the console, but there are no projects in the Project Explorer, and the folder "cy-ble-modus" has been deleted in Windows Explorer, thus there are no source files to be added.

             

            It seems that the import procedure you're referencing is only for code examples, and is used to create a new application, not import an already existing one.

             

            Am I missing something?

             

            Thanks,

            Fred

            • 3. Re: Unable to build libraries when importing a project from a git repository in Windows
              DheerajK_81

              I tried your steps. I'm not sure why Modus replaces dashes with underscores, looks like a bug, I'll check with the development team.

               

              Please navigate to the workspace directory in windows explorer and delete the folder "cy-ble-modus" manually. After this, follow the steps to import the project the same way you mentioned. Note that this is not only for code examples, it works for all applications.

               

              I tried the overwrite operation and seemed to work correctly for me, the source files were displayed. It might have happened that the workspace directory might have access restrictions and when it tried to delete or overwrite previously something would have gone wrong, not sure.

               

              So best way would be to delete the folder manually and retry. If you still see the error, please zip the project and attach it here and I'll have a look.

               

              Regards,

              Dheeraj

              • 4. Re: Unable to build libraries when importing a project from a git repository in Windows
                user_1669321

                Hi Dheeraj,

                 

                I don't understand how deleting my project folder helps, as all committed files are in that folder.

                 

                cy-ble-modus/src/...      --> All source files

                cy-ble-modus/libs/...     --> .lib files, as well as git submodules that are necessary for this project

                cy-ble-modus/Makefile     --> The Makefile contains custom commands that are needed

                cy-ble-modus/design.cybt  --> BLE parameters

                cy-ble-modus/design.modus --> I/Os, clocks, peripherals, etc.

                 

                Why must I delete the project folder? It seems to me that it would only result in a new empty project.

                • 5. Re: Unable to build libraries when importing a project from a git repository in Windows
                  DheerajK_81

                  You can just move the project folder from the workspace directory to another location, need not delete it. The reason behind it being, I do not want Modus to prompt saying there is already another directory and cause problems during import.

                   

                  Regards,
                  Dheeraj

                  • 6. Re: Unable to build libraries when importing a project from a git repository in Windows
                    user_1669321

                    Hi Dheeraj,

                     

                    I tried it, but I'm not satisfied with the result.

                     

                    As I thought, importing a project through the wizard just copies a folder to another place. That's fine, however KBA225201 should say so.

                     

                    Where I'm left unsatisfied is that the wizard doesn't copy the .git files in the git submodules present in the project. That means that performing a "git submodule update --recursive" would fail.

                     

                    So, right now, the procedure for importing a cloned Modus project that uses submodules is to:

                    1- Clone the git repository

                    2- Rename the project "ProjectName" folder to "ProjectName2"

                    3- Import the project using the wizard, name it ProjectName (so that git keeps track of it)

                    4- Copy the submodules folders from "ProjectName2" to "ProjectName"

                     

                    I don't think that is a good flow for sharing code, or at least it should be documented. The alternative would be to import the project through Eclipse (right-click -> import project) and manually perform the "make getlibs" by using the distributed Cygwin make, but that should be documented as well.

                     

                    Thanks for you help,

                    Fred

                    • 7. Re: Unable to build libraries when importing a project from a git repository in Windows
                      DheerajK_81

                      Hello Fred,

                       

                      Whenever you import the project to eclipse, the .git files don't get copied. If you want version control on the files you import you need to add support for it through the IDE itself. Please refer to the KBA to understand how to do so: Git Version Control in ModusToolbox - KBA226845

                       

                      Users who import cloned repositories may not want version control, hence by default git files aren't copied. But based on the requirement, the option remains available in Modus.

                       

                      Regards,

                      Dheeraj

                      • 8. Re: Unable to build libraries when importing a project from a git repository in Windows
                        user_1669321

                        Hi Dheeraj,

                         

                        The version control is done with another software, so that's not the issue.

                         

                        I think (and correct me if I'm wrong) that the difference of importing a project between Modus and Eclipse is that Eclipse creates references, while Modus creates copies.

                         

                        I still think it's way more complicated than needed. When I use Code Composer Studio, which is also Eclipse-based, I don't have any issue importing cloned repositories that use submodules, modifying them, then committing my changes. I don't need to do any manipulation in Windows Explorer.

                         

                        I think this closes the issue, thank you very much for your feedback.

                         

                        Fred

                        • 9. Re: Unable to build libraries when importing a project from a git repository in Windows
                          DheerajK_81

                          I think (and correct me if I'm wrong) that the difference of importing a project between Modus and Eclipse is that Eclipse creates references, while Modus creates copies.

                          Yes you are right.

                           

                          Regards,

                          Dheeraj