Link libraries to a OOT block

Hello,

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?

Thanks!

Jim KA2RVO

On Sat, Dec 07, 2013 at 08:40:45PM -0500, James A. wrote:

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 B.
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

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

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:53 AM, James A. [email protected] wrote:

called libsdriq.a, now I want to use that library with gnuradio. Following
CMake, but haven’t figured it out yet.

Jim

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.

Tom

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs