This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: How to specify libraries in project dependencies?

Tool/software: Code Composer Studio

I'm using a CCS workspace to build several projects. I have two projects which build libraries: libA, libB. Another project builds a program: fdtab. I want project fdtab to link in the library produced by project libA. In project fdtab, I just want to specify the dependent project (libA) and which configuration to use (debug). I want the library pathname to be specified by the libA project.

I've tried using the Export page in project libA to specify what resource to export. In project fdtab, I use the References tab of the Paths and Symbols page to specify project libA and which configuration to use. This sort of works, but the library from project libA is added two times to my linker path.

Now I want to switch from using libA to using libB. In project fdtab, I unselect my libA dependency and select by libB dependency. This adds the library from libB to my link path (two times again) but does not remove the library from the libA project.

Please advise if there is a better way to do this.

Thank you,
~Ramsey

  • Ramsey,

    Ramsey said:
    In project fdtab, I just want to specify the dependent project (libA) and which configuration to use (debug). I want the library pathname to be specified by the libA project.

    As far as I know, there isn't a way to "automatically" pass the path or output of a dependent project into the main project.  Specifying a dependency simply tells the build system that the dependent project, in your case the library project, needs to built prior to the main project. However you would still need to manually add the path and name of library to be linked into the main application, and this is typically done under the Linker->File Search Path options.

    Ramsey said:
    Now I want to switch from using libA to using libB. In project fdtab, I unselect my libA dependency and select by libB dependency. This adds the library from libB to my link path (two times again) but does not remove the library from the libA project.

    How about using two build configurations for fdtab: one that is dependent on libA and links in the libA library, and the other that is dependent on libB and links in the libB library?

  • AartiG,

    Thanks for the reply.

    The Export page is intended to support automatic resource exports. In other words, when project fdtab declares a dependency on project libA, all resources specified in libA/Export page are automatically exported into project fdtab. This much is working with the exception that the exported library resource from libA is added twice to the fdtab link line. This feels like a bug.

    When removing the project dependency on libA from project fdtab, I would expect CCS to inspect the exported resources in libA and remove them from fdtab. This would cleanly remove any lingering dependencies. The fact that this is not happening indicates another bug.

    I was hoping someone could shed some light on this behavior.

    I don't think using multiple build configurations will work. In project fdtab, the project references page does not support per-configuration settings. In other words, the project references don't change with different build configuration.

    Thanks,
    ~Ramsey

  • Ramsey said:
    The Export page is intended to support automatic resource exports. In other words, when project fdtab declares a dependency on project libA, all resources specified in libA/Export page are automatically exported into project fdtab. This much is working with the exception that the exported library resource from libA is added twice to the fdtab link line.

    I'm sorry but could you elaborate a bit more on how you are doing this in CCS? I don't see a way to export a library file (.lib) from a library project through the "Paths and Symbols" property page. Is that where you are doing it from? If you could please provide details and steps on how you set this up that would be very helpful (screenshots will be very helpful as well).

    Also could you please copy/paste the full output in the CCS build console when you rebuild the main project (that shows the libA being added twice in the command line) to a text file and attach it here?

  • AartiG,

    By default, CCS does not display the Export Settings page. You have to enable this in the Preferences dialog.

    Window > Preferences > C/C++ > Property Page Settings
    Display "Export Settings" page > Select

    Now, you can open the Export Settings page for the libA project. Note that you must enable advanced setting in the property dialog.

    Select libA project
    Project > Properties
    Show advanced settings > Click (if needed)
    C/C++ General > Export Settings

    You can now specify which project resources to export. These depend on the build configuration. I'm using Debug build configuration. I'm exporting an include path and a library.

    Configuration > Debug
    Includes (tab) > Add...

    I click the workspace button and select my current project. This seems odd, but I don't see any other way to do it. I then repeat the same process to specify my library. I click the Libraries tab, then the Add button. My "libA" project is actually called ti_posix_MSP432P401R_ccs. Here are the screen shots.

    Now I go to my fdtab project and declare a dependency on my ti_posix project. You have to save the change because there is no Apply button. Then open your project properties again and inspect the compiler include path. You will see that ti_posix include path has been added for you.

    Now inspect the libraries and you will see the ti_posix library has been added twice.

    When building, the library shows up twice in the output.

    When I remove the project dependency, the include path is removed from the compiler options. But the library reference is not removed.

    Thanks,
    ~Ramsey

  • Ramsey,

    Thank you for sending the detailed steps. With this, I was able to reproduce the issues you described: 
    1) the library resource gets added twice to the linker --library option and
    2) switching out the project dependency does not remove the previously added library

    I have filed a bug report so these issues can be analyzed and fixed. The tracking # is CCSIDE-3163. You may track them using the SDOWP link in my signature (after giving it some time to sync up).

    For the second issue, I think you can use multiple build configurations of the main project to work around it. For example, one build configuration that uses libA as dependency and another configuration that uses libB as dependency. That way you do not have to face the issue of manually having to remove the previously added library from the --library option. Instead, each build configuration will have its own fixed dependency/resources and you don't have to keep switching between the two.

    Thank you for bringing these to our attention and for your patience.

  • Ramsey,

    The CCS engineer has looked into this issue and his feedback is that TI does not contribute to these specific Eclipse CDT components, so unfortunately there are currently no plans to address this from the TI side. That is also the reason we've hidden these pages/settings by default.

    You are welcome to file it as an Eclipse bug though, and hopefully they will address it in a future release of Eclipse. Sorry about the inconvenience caused due to this.

  • AartiG,

    Oh well. Thanks for trying.

    ~Ramsey