Compiling c++ blocks

All,

I’m attempting to write a block for GNU Radio. However, the tutorial on
http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html is
significantly different than the structure of gr-how-to-write-a-block
included with the current release of gnuradio. Insofar as I can tell,
the
tutorial written by Eric B. only explains how to run a QA test on
the
block, not how to compile or install it. As a person who has never
worked
with autotools (other than to compile other people’s code), I am lost in
the
dark. Can anyone point me to any resources?

Thanks,
Jordan

On Fri, Aug 14, 2009 at 2:53 PM, Mattias K. [email protected] wrote:

with autotools (other than to compile other people’s code), I am lost in the
In the case of c++ development I can give you some hints on how to write a
Makefile, but if you are planning on python development, the black- magic of
swig is to mighty for me :wink:

Cheers!
//Mattias

Mattias,

I am attempting to modify the block gr_interleaved_short_to_complex such
that it outputs std::complex<int16_t>, as required by usrp2_sink_16sc.
Before I try and compile my own code, however, I am simply trying to
compile
an unmodified gr_interleaved_short_to_complex block by adapting the
build
scripts in gr-how-to-write-a-block. And while many of the necessary
modifications are obvious (such as replacing instances of
“howto_square_ff.h” with “gr_interleaved_short_to_complex.h”), plenty
more
are not obvious (such as how to modify src/lib/Makefile.swig.gen). I
really
can’t express how frustrating this is- I only need to compile four small
source files.
The problem is that there is just alot going on in the build and I
really
don’t understand most if it. Compounding the problem is that the
aforementioned tutorial does not go in to this at all.

Thanks,
Jordan

On Fri, Aug 14, 2009 at 03:07:28PM -0600, Jordan J Riggs wrote:

tutorial written by Eric B. only explains how to run a QA test on the
an unmodified gr_interleaved_short_to_complex block by adapting the build
scripts in gr-how-to-write-a-block. And while many of the necessary
modifications are obvious (such as replacing instances of
“howto_square_ff.h” with “gr_interleaved_short_to_complex.h”), plenty more
are not obvious (such as how to modify src/lib/Makefile.swig.gen).

You don’t need to modify that file; it’s generated.

Just modify Makefile.am

I really can’t express how frustrating this is- I only need to
compile four small source files. The problem is that there is just
alot going on in the build and I really don’t understand most if
it. Compounding the problem is that the aforementioned tutorial does
not go in to this at all.

The tutorial can’t possible cover all of the tools involved.
If you can’t intuit what to do, you might consider taking a quick look
at the automake documentation:

http://www.gnu.org/software/automake

The build system is admittedly complicated, but real world software
tends to be that way. GNU Radio runs on several operating systems, on
several architectures, 32-bit or 64-bit, with-or-without-python, etc.
As far as I can tell, nobody’s come up with a build system that
doesn’t require some kind of investment in learning how to use it.

Eric

You don’t need to modify that file; it’s [Makefile.swig.gen] generated.

Are you sure about this? When I replace every occurrence of “howto” in
Makefile.swig.gen with my own package name, it seems to work. However,
when
I leave this file as it is in gr-how-to-write-a-block, or remove it
entirely, the build process fails. (At make or in bootstrap,
respectively.)
After looking closely at that file, it looks like it should be
generated,
but my experiences say otherwise.

I believe you need to re-generate it manually (I’m not sure if the
intent was to have it automagically re-built or not). If you go into
the directory(s) that contain the .i files, you can call:
make generate-makefile-swig
And the Makefile.swig.gen’s will be rebuilt from the top-level
template (Makefile.swig.gen.t) according to the names you’ve set in
the Makefile.am. Removing it entirely does seem to make the
automake/autoconf system choke.

On Mon, Aug 17, 2009 at 4:44 PM, Jordan J Riggs[email protected]
wrote:


Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Doug G.
[email protected]

Hi all,

If I have .cc .h .i and Makefile.am all ready, could I go back to the
top
directory containing “configure” and make again(make from the top)
instead
of using automake at src/lib directory in order to generate the make
file?

Thank you,

Milo

On Fri, Aug 21, 2009 at 9:15 AM, Douglas G. <

OK, I’ve gotten my code to compile and install. I can import my package
(form gnuradio import package), but I can’t access the block I wrote.

from gnuradio import its
its.interleaved_short_to_complex_short
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘module’ object has no attribute
‘interleaved_short_to_complex_short’

Upon inspecting the .py file generated by SWIG, I find that there is no
definition of my block. I wrote one myself (based on what I found in
other
SWIG-generated .py files), and I am able to access the block. Clearly,
however, something is wrong. I am stumped.

Jordan

If I have .cc .h .i and Makefile.am all ready, could I go back to the top
directory containing “configure” and make again(make from the top) instead
of using automake at src/lib directory in order to generate the make file?

I’m not sure exactly what you mean. I always make from the root
directory.
In any case, I would do a “make clean” before running “make” again. And
if
you change the names of your source files, I would start over at
“./bootstrap”.

Jordan

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