# Problems when trying to make out of tree modules

**URL:** <https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934>\
**Category:** GNU Radio\
**Created:** [May 13, 2015, 6:39pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934 "2015-05-13T18:39:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [May 13, 2015, 6:39pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/1 "2015-05-13T18:39:22Z")

</div>

Dear All,

I am trying to make an out of tree module by following the tutorial on  
Gnu  
radio website. I can write simple blocks in C++, compile it and install  
it  
to it usable in Gnuradio company.

But for some complex block, I want to implement them based on the  
gnuradio  
build-in blocks, for example, clock\_recovery\_mm\_ff. So I make a new  
block  
in my out-of-tree module and try to first “copy” the build-in block into  
my  
out-of-tree module.

I changed the following 4 files in my OOT module to match the  
corresponding  
files of the build-in block:

lib/my\_block\_impl.cc  
lib/my\_block\_impl.h  
include/my\_block.h  
grc/my\_block.xml

In each file, I changed all the “clock\_recovery\_mm\_ff” into “my\_block”.

I can successfully make and install the block without error and warring.  
But when I try to run the grc graph, an error happens.

AttributeError: ‘module’ object has no attribute ‘my\_block’.

Anyone can tell me what I should do to correct this error? Is there any  
other files I should change?

When I make simple blocks by myself, I only change this 4 files and it  
works.

Best regards,

Su Li

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 13, 2015, 6:48pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/2 "2015-05-13T18:48:08Z")

</div>

Hi Su Li,

have you added the new source files to the CMakeLists.txt in lib,  
include and grc?  
Do these block have the YOURMODULE\_API property?

Best regards,  
Marcus

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 13, 2015, 7:12pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/3 "2015-05-13T19:12:40Z")

</div>

Hi Marcus,

Thank you for your reply.

The source files are added to the CMakeLists.text files. But they are  
not  
added by my self, they are added when I use “gr\_modtool add -t general  
my\_block” and “gr\_modtool makexml my\_block” to make a new block and xml  
file.

Only the my\_block.h file in include directory contains API

class MY\_MODULE\_API my\_block : virtual public gr::block  
{  
…  
}

Could you please tell me how to check the API property for the block?  
Thanks in advance.

Best regards,

Su

2015-05-13 18:47 GMT+02:00 Marcus Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 14, 2015, 2:34pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/4 "2015-05-14T14:34:01Z")

</div>

Hi Peter,

Thanks for your reply and suggestions.

I checked all the 4 files. I changed the original module and block names  
of  
build-in block into my module and block names. But unfortunately, the  
error  
still exists.

Could it be possibly because the build-in block, in my case  
“clock\_recovery\_mm\_ff” block, has some special dependency which is  
included  
in the code of the module but not in the code of the block.

The type of “clock\_recovery\_mm\_ff” block is abnormal. It is just block,  
not  
gr::block nor gr::sync\_block as mentioned in the OOT tutorial . Here is  
the  
code of declaration of this block in \*.h file in “include” folder.

class DIGITAL\_API clock\_recovery\_mm\_ff : virtual public block

In my code, I change it into

class MY\_MODULE\_API my\_block : virtual public block

Thank you for your reply again.

Best regards,

Su Li

2015-05-13 20:36 GMT+02:00 Peter M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 13, 2015, 8:38pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/5 "2015-05-13T20:38:33Z")

</div>

I’ve had a similar problem when I generated files for my own module  
using the gr\_modtool and then copied some existing code by replacing the  
file(s) that gr\_modtool generates. It turns out I had overlooked that  
the new “my\_block” name needs to be changed in several places, like the  
namespace declaration, the #include compiler directive, and the  
conditional #ifndef INCLUDED … directives. Once I updated that  
correctly the AttributeError got resolved.

-Peter-

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 15, 2015, 11:48am UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/6 "2015-05-15T11:48:45Z")

</div>

Hi all,

I found the problem.

In my OOT block, I try to use mmse\_fir\_interpolator. Thus, in the  
my\_block\_impl.h file I use the following code to include the fir  
interpolator:

_#include \<gnuradio/filter/mmse\_fir\_interpolator\_ff.h\>_

But when I run ctest for my block, I got the following error:

_ImportError:  
/home/suli/gr-ctia802\_15\_4/build/lib/libgnuradio-ctia802\_15\_4.so:  
undefined  
symbol: \_ZN2gr6filter24mmse\_fir\_interpolator\_ffC1Ev_

where ctia802\_15\_4 is my OOT module name. It seems that this fir filter  
is  
not correctly included.

Anyone can tell me how to fix it? Thanks in advance.

Best regards,

Su Li

2015-05-14 14:33 GMT+02:00 Su Li [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 15, 2015, 2:50pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/7 "2015-05-15T14:50:26Z")

</div>

There’s a GR\_REQUIRED\_COMPONENTS CMake variable[e.g. 1]; add FILTER.

Best regards,  
Marcus  
[1]

> <https://github.com/marcusmueller/gr-debugme/blob/master/CMakeLists.txt#L113>

Am 15. Mai 2015 11:47:51 MESZ, schrieb Su Li [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Su\_Li](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9e5f3/32.png) [@Su\_Li](https://www.ruby-forum.com/u/Su_Li)\
**Post date:** [May 16, 2015, 8:12pm UTC](https://www.ruby-forum.com/t/problems-when-trying-to-make-out-of-tree-modules/241934/8 "2015-05-16T20:12:19Z")

</div>

Hi Marcus,

Thanks a lot. It works now.

Best regards,

Su

2015-05-15 14:49 GMT+02:00 Marcus Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
