[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Link libraries to a OOT block

From: James Austin
Subject: Re: [Discuss-gnuradio] Link libraries to a OOT block
Date: Wed, 11 Dec 2013 10:32:57 -0500

Thanks for the tips, I did get this to work after digging further into the CMake files.

I made the static archive work, but it was ugly (recompile with -fPIC, linking with --whole-archive). Changing the build for the the library to produce both an archive and shared library and using the shared library in my gnuradio block made things simpler.

On Mon, Dec 9, 2013 at 9:14 PM, Tom Rondeau <address@hidden> wrote:
On Mon, Dec 9, 2013 at 9:53 AM, James Austin <address@hidden> wrote:
> Hi Martin,
> I did look through the CMake documentation and was trying different things
> with the target_link_libraries tag, with no success.
> What I am trying to do is (and this may be a solved problem already) build a
> gnuradio block for the RFSpaces SDR-IQ receiver. This is mostly for me to
> become more familiar with Linux programming and to learn more about Python.
> I wrote a library that is able to retrieve data from the SDR-IQ and it is
> called libsdriq.a, now I want to use that library with gnuradio. Following
> the gnuradio tutorial on out of tree blocks, I created a block called
> gr-sdriq and it works fine with dummy data, has a complex output port and
> outputs a cosine and sine to the real and imaginary parts and I can see the
> data as expected in gnuradio. My problem is getting the gnuradio block  to
> use my libsdriq.a library and that is where things are breaking. Compiling
> is not a problem, but linking is not producing a gnuradio block that
> includes my libsdriq.a.
> I've looked through some gnuradio blocks to see if I could find something
> similar and through CMake documentation. This is likely solved through
> CMake, but haven't figured it out yet.
> Jim


You're on the right track with using the target_link_libraries. I
think your mail problem is using an archive library (the libsdriq.a).
While it's possible, you don't really want to use a static archive
like that. Look into building that into a shared object library (.so)
instead. That will be easier to use with the cmake tools.

Also, when asking questions about a problem you're having, providing
us with the error results you're seeing would help us help you better.


> On Sun, Dec 8, 2013 at 9:24 AM, Martin Braun (CEL) <address@hidden>
> wrote:
>> On Sat, Dec 07, 2013 at 08:40:45PM -0500, James Austin wrote:
>> > I'm a long time Windows programmer trying to write a gnuradio module to
>> > improve
>> > my Linux development skills.
>> >
>> > I created a gnuradio module following the tutorial that just sends dummy
>> > data
>> > back to gnuradio. That works fine, I can plot the dummy data in my
>> > flowgraph
>> > and it works and displays as expected.
>> >
>> > I also created a static library that produces data, no reason I can't
>> > make it a
>> > shared library if that is the solution.
>> >
>> > My problem is trying to get the gnuradio module to link against the
>> > static
>> > library, so that the data produced by this library can be fed into
>> > gnuradio. I
>> > haven't been able to figure out the cmake magic to make this happen. I
>> > get a
>> > variety of error messages on everything I try.
>> >
>> > Does anyone have any hints to get me past this?
>> Hey Jim,
>> you're not giving us much to work on here. You might want to specify
>> what exactly you're linking to, and what you've tried.
>> What you're trying to do seems like a cmake problem, so checking cmake
>> tutorials (unrelated to GNU Radio) might help.
>> Most often, you want your C++ blocks to access some library. This would
>> mean editing the lib/CMakeLists.txt file to make sure you're linking to
>> the right libs.
>> MB
>> --
>> Karlsruhe Institute of Technology (KIT)
>> Communications Engineering Lab (CEL)
>> Dipl.-Ing. Martin Braun
>> Research Associate
>> Kaiserstraße 12
>> Building 05.01
>> 76131 Karlsruhe
>> Phone: +49 721 608-43790
>> Fax: +49 721 608-46071
>> www.cel.kit.edu
>> KIT -- University of the State of Baden-Württemberg and
>> National Laboratory of the Helmholtz Association

reply via email to

[Prev in Thread] Current Thread [Next in Thread]