Question

I have created an Eclipse CDT project that uses autotools from the libsndfile source code library. It builds fine in Eclipse. How do I modify this project to use it as a REDHAWK component the way that the dsp library and others are used?

Thanks!

Was it helpful?

Solution

There are multiple approaches to adding a shared library to work with REDHAWK. The simplest approach is to install the library on your GPP and follow the steps outlined in the section "Including External Libraries" found in the REDHAWK documentation.

The approach taken in the dsplib you asked about is slightly different. This creates a REDHAWK softpackage library dependency which is installed in the SDRROOT and deployed at runtime along with your component. Here are the steps to get a pre-exsisting c++ project working in REDHAWK. This answer does not cover getting the library to build or the process of importing it into eclipse as there are numerous posts on these topics:

  1. Import the library into your IDE.

  2. Build your shared library so that you have a shared object (.so file)

  3. Add a .spd.xml file to your library such as the one found here.

  4. Edit this .spd.xml file:

4a. Update the localfile tag to point to the location of your specific .so file.

4b. Ensure that the value of the implementation id tag is a unique revision number for your library

  1. Add a .project file if it doesn't exist such as the one found found here. Open your .project file and ensure that the following natures are included:

    <nature>gov.redhawk.ide.natures.sca.project</nature>
    <nature>gov.redhawk.ide.natures.sca.component</nature>
    
  2. You should now be able to drag your sofpackage library to the SDR root.

Here are the steps to update your individual components you are building to make use of your new library:

  1. Edit the components Makefile.am in the cpp implementation folder. Edit the _CXXFLAGS to add the path to your header files, _LDADD to add your library, and _LDFLAGS to include the path to your library. See this example for how the agc component modifies these variables to include the dsp library.

  2. Edit the .spd.xml file to include the softpackage dependency. Under the implementation section add a run time dependency on your library such as the one found here. Specifically - your dependency section should be as follows:

    <dependency type="runtime_requirements">
      <softpkgref>
        <localfile name="XXXX"/>
        <implref refid="YYYY"/>
      </softpkgref>
    </dependency>
    

XXXX is the path to your installed library .spd.xml file in the SDRROOT relative to the dom directory (it should start with /components) YYYY is your specific implementation value defined in 4b above.

OTHER TIPS

I can't add comments, so I apologize for providing an "answer."

For me, Youssef's description worked perfectly for building components with shared libraries. However, in order to load the shared libraries at runtime, I needed to add the following to the makefile.am _LDFLAGS:

-Xlinker -rpath -Xlinker ../../dsp/Release

Where "/dsp/Release" is the relative path to whichever shared library you created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top