# Building an OOT modules with an In Tree Dependency

**URL:** <https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817>\
**Category:** GNU Radio\
**Created:** [July 30, 2015, 11:27pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817 "2015-07-30T23:27:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 30, 2015, 11:27pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/1 "2015-07-30T23:27:42Z")

</div>

I’m trying to make an out of tree module based on blocks::file\_sink that  
has some additional functionality I need. Right now, I’ve built it OOT,  
but an having trouble getting it to work. The code (file\_sink\_impl.cc,  
file\_sink\_impl.h, and file\_sink.h --\> actual names are different so  
there are no conflicts) are all identical to the ones in tree. I used  
gr-modtool to create the OOT modules with this block and it makes and  
installs fine. However, when I try to use it, I get the following error:

AttributeError: ‘file\_sink\_sptr’ object has no attribute  
‘set\_unbuffered’

What I think is happening here is that the OOT version of my code isn’t  
linking to the file\_sink\_base in gnuradio-blocks to inherit this  
function. Browsing previous mail lists, Marcus M. noted in the  
thread ’ [Discuss-gnuradio] Out of Tree linker error…  
libgnuradio-MYMOD.so:’ that the problem might be in my cmake files. He  
referenced gr-specest as an example which uses in tree modules. I  
compared the cmakelists.txt in gr-specest to the OOT module directory  
and in the OOT/lib directory and added the BLOCKS references in the  
appropriate places. However, this still hasn’t solved the problems.  
Are there any other steps necessary to make and install an OOT modules  
with in tree dependencies?

All of this is running on Ubuntu 14.04LTS with gnuradio 3.7.7.1

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 4:27pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/2 "2015-07-31T16:27:45Z")

</div>

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R. \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> AttributeError: ‘file\_sink\_sptr’ object has no attribute ‘set\_unbuffered’  
> hasn’t solved the problems. Are there any other steps necessary to make  
> and install an OOT modules with in tree dependencies? All of this is  
> running on Ubuntu 14.04LTS with gnuradio 3.7.7.1

The first thing that comes to mind when we see this is that you haven’t  
added all of the public functions of your block to the public header  
file  
(file\_sink.h), but you say that’s identical. Still probably worth  
checking  
on that file to make sure.

Have you looked at your swig directory’s .i file? That needs to properly  
reference your block to export it into Python. It seems like this is ok  
since you’re getting as far as to see the error on the method, not the  
block. Again, though, something to check.

So this is just you replicating the file sink blocks completely? You  
aren’t  
trying to inherit from them or use them internally, are you? That might  
cause other issues.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 4:52pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/3 "2015-07-31T16:52:17Z")

</div>

So the function (set\_unbuffered) that’s coming up as not being found is  
in file\_sink\_base.h which is included in the file\_sink.h so I’m pretty  
sure I’m ok here.

The swig file just includes file\_sink.h….I tried adding file\_sink\_base.h  
to this as well, but it didn’t change anything.

For the time being, I’m replicating the file\_sink block exactly (except  
the name) to try and get it to compile OOT. However, since file\_sink  
depends on file\_sink\_base, which I’m not copying, I think there are  
problems linking to it.

Would it be better to also copy file\_sink\_base to my OOT module?

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of  
Tom R.  
Sent: Friday, July 31, 2015 10:27 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
I’m trying to make an out of tree module based on blocks::file\_sink that  
has some additional functionality I need. Right now, I’ve built it OOT,  
but an having trouble getting it to work. The code (file\_sink\_impl.cc,  
file\_sink\_impl.h, and file\_sink.h → actual names are different so  
there are no conflicts) are all identical to the ones in tree. I used  
gr-modtool to create the OOT modules with this block and it makes and  
installs fine. However, when I try to use it, I get the following error:

AttributeError: ‘file\_sink\_sptr’ object has no attribute  
‘set\_unbuffered’

What I think is happening here is that the OOT version of my code isn’t  
linking to the file\_sink\_base in gnuradio-blocks to inherit this  
function. Browsing previous mail lists, Marcus M. noted in the  
thread ‘ [Discuss-gnuradio] Out of Tree linker error…  
libgnuradio-MYMOD.so:‘ that the problem might be in my cmake files. He  
referenced gr-specest as an example which uses in tree modules. I  
compared the cmakelists.txt in gr-specest to the OOT module directory  
and in the OOT/lib directory and added the BLOCKS references in the  
appropriate places. However, this still hasn’t solved the problems.  
Are there any other steps necessary to make and install an OOT modules  
with in tree dependencies?

All of this is running on Ubuntu 14.04LTS with gnuradio 3.7.7.1  
The first thing that comes to mind when we see this is that you haven’t  
added all of the public functions of your block to the public header  
file (file\_sink.h), but you say that’s identical. Still probably worth  
checking on that file to make sure.

Have you looked at your swig directory’s .i file? That needs to properly  
reference your block to export it into Python. It seems like this is ok  
since you’re getting as far as to see the error on the method, not the  
block. Again, though, something to check.

So this is just you replicating the file sink blocks completely? You  
aren’t trying to inherit from them or use them internally, are you? That  
might cause other issues.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 5:02pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/4 "2015-07-31T17:02:49Z")

</div>

On Fri, Jul 31, 2015 at 10:50 AM, Valenta, Chris R. \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> For the time being, I’m replicating the file\_sink block exactly (except  
> the name) to try and get it to compile OOT. However, since file\_sink  
> depends on file\_sink\_base, which I’m not copying, I think there are  
> problems linking to it.
> 
> Would it be better to also copy file\_sink\_base to my OOT module?

You should be able to use file\_sink\_base from libgnuradio-blocks.so, so  
no,  
keep that one in tree so you’re not carrying around extra stuff. First,  
do  
you have BLOCKS as one of the GNU Radio required components in your  
CMakeLists.txt file?

Also, and I suspect this might be the real problem, do you “#define  
BLOCKS\_API” in you .i file? There should be a #define for your module’s  
name already; just add this line here along with that one.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 7:54pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/5 "2015-07-31T19:54:01Z")

</div>

Ah, so I figured it out. Not only did I need to add #define BLOCKS\_API  
to my swig .i file, but I also had to add %include  
“gnuradio/blocks/file\_sink\_base.h” as well.

From: Valenta, Chris R.  
Sent: Friday, July 31, 2015 11:30 AM  
To: ‘Tom R.’  
Cc: removed\_email\_address@domain.invalid  
Subject: RE: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

Yes, blocks is included in the cmakelists.txt as  
set(GR\_REQUIRED\_COMPONENTS RUNTIME BLOCKS) as well as a link directory  
GNURADIO\_BLOCKS\_LIBRARY\_DIRS. Its also in the /lib cmakelists.txt as a  
target\_link\_library GNURADIO\_BLOCKS\_LIBRARIES.

BLOCKS\_API was not in the swig .i file. I added this, ran make clean,  
make, and installed and still get the same error.

From: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tom R.  
Sent: Friday, July 31, 2015 11:02 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Fri, Jul 31, 2015 at 10:50 AM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
So the function (set\_unbuffered) that’s coming up as not being found is  
in file\_sink\_base.h which is included in the file\_sink.h so I’m pretty  
sure I’m ok here.

The swig file just includes file\_sink.h….I tried adding file\_sink\_base.h  
to this as well, but it didn’t change anything.

For the time being, I’m replicating the file\_sink block exactly (except  
the name) to try and get it to compile OOT. However, since file\_sink  
depends on file\_sink\_base, which I’m not copying, I think there are  
problems linking to it.

Would it be better to also copy file\_sink\_base to my OOT module?

You should be able to use file\_sink\_base from libgnuradio-blocks.so, so  
no, keep that one in tree so you’re not carrying around extra stuff.  
First, do you have BLOCKS as one of the GNU Radio required components in  
your CMakeLists.txt file?

Also, and I suspect this might be the real problem, do you “#define  
BLOCKS\_API” in you .i file? There should be a #define for your module’s  
name already; just add this line here along with that one.

Tom

From: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf  
Of Tom R.  
Sent: Friday, July 31, 2015 10:27 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
I’m trying to make an out of tree module based on blocks::file\_sink that  
has some additional functionality I need. Right now, I’ve built it OOT,  
but an having trouble getting it to work. The code (file\_sink\_impl.cc,  
file\_sink\_impl.h, and file\_sink.h → actual names are different so  
there are no conflicts) are all identical to the ones in tree. I used  
gr-modtool to create the OOT modules with this block and it makes and  
installs fine. However, when I try to use it, I get the following error:

AttributeError: ‘file\_sink\_sptr’ object has no attribute  
‘set\_unbuffered’

What I think is happening here is that the OOT version of my code isn’t  
linking to the file\_sink\_base in gnuradio-blocks to inherit this  
function. Browsing previous mail lists, Marcus M. noted in the  
thread ‘ [Discuss-gnuradio] Out of Tree linker error…  
libgnuradio-MYMOD.so:‘ that the problem might be in my cmake files. He  
referenced gr-specest as an example which uses in tree modules. I  
compared the cmakelists.txt in gr-specest to the OOT module directory  
and in the OOT/lib directory and added the BLOCKS references in the  
appropriate places. However, this still hasn’t solved the problems.  
Are there any other steps necessary to make and install an OOT modules  
with in tree dependencies?

All of this is running on Ubuntu 14.04LTS with gnuradio 3.7.7.1  
The first thing that comes to mind when we see this is that you haven’t  
added all of the public functions of your block to the public header  
file (file\_sink.h), but you say that’s identical. Still probably worth  
checking on that file to make sure.

Have you looked at your swig directory’s .i file? That needs to properly  
reference your block to export it into Python. It seems like this is ok  
since you’re getting as far as to see the error on the method, not the  
block. Again, though, something to check.

So this is just you replicating the file sink blocks completely? You  
aren’t trying to inherit from them or use them internally, are you? That  
might cause other issues.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 7:58pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/6 "2015-07-31T19:58:07Z")

</div>

On Fri, Jul 31, 2015 at 1:52 PM, Valenta, Chris R. \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Ah, so I figured it out. Not only did I need to add #define BLOCKS\_API to  
> my swig .i file, but I also had to add %include  
> “gnuradio/blocks/file\_sink\_base.h” as well.

Ah, of course! Good catch.

We should have this documented somewhere – how to use GNU Radio classes  
and blocks in OOT projects.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [July 31, 2015, 5:30pm UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/7 "2015-07-31T17:30:51Z")

</div>

Yes, blocks is included in the cmakelists.txt as  
set(GR\_REQUIRED\_COMPONENTS RUNTIME BLOCKS) as well as a link directory  
GNURADIO\_BLOCKS\_LIBRARY\_DIRS. Its also in the /lib cmakelists.txt as a  
target\_link\_library GNURADIO\_BLOCKS\_LIBRARIES.

BLOCKS\_API was not in the swig .i file. I added this, ran make clean,  
make, and installed and still get the same error.

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of  
Tom R.  
Sent: Friday, July 31, 2015 11:02 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Fri, Jul 31, 2015 at 10:50 AM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
So the function (set\_unbuffered) that’s coming up as not being found is  
in file\_sink\_base.h which is included in the file\_sink.h so I’m pretty  
sure I’m ok here.

The swig file just includes file\_sink.h….I tried adding file\_sink\_base.h  
to this as well, but it didn’t change anything.

For the time being, I’m replicating the file\_sink block exactly (except  
the name) to try and get it to compile OOT. However, since file\_sink  
depends on file\_sink\_base, which I’m not copying, I think there are  
problems linking to it.

Would it be better to also copy file\_sink\_base to my OOT module?

You should be able to use file\_sink\_base from libgnuradio-blocks.so, so  
no, keep that one in tree so you’re not carrying around extra stuff.  
First, do you have BLOCKS as one of the GNU Radio required components in  
your CMakeLists.txt file?

Also, and I suspect this might be the real problem, do you “#define  
BLOCKS\_API” in you .i file? There should be a #define for your module’s  
name already; just add this line here along with that one.

Tom

From: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf  
Of Tom R.  
Sent: Friday, July 31, 2015 10:27 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
I’m trying to make an out of tree module based on blocks::file\_sink that  
has some additional functionality I need. Right now, I’ve built it OOT,  
but an having trouble getting it to work. The code (file\_sink\_impl.cc,  
file\_sink\_impl.h, and file\_sink.h → actual names are different so  
there are no conflicts) are all identical to the ones in tree. I used  
gr-modtool to create the OOT modules with this block and it makes and  
installs fine. However, when I try to use it, I get the following error:

AttributeError: ‘file\_sink\_sptr’ object has no attribute  
‘set\_unbuffered’

What I think is happening here is that the OOT version of my code isn’t  
linking to the file\_sink\_base in gnuradio-blocks to inherit this  
function. Browsing previous mail lists, Marcus M. noted in the  
thread ‘ [Discuss-gnuradio] Out of Tree linker error…  
libgnuradio-MYMOD.so:‘ that the problem might be in my cmake files. He  
referenced gr-specest as an example which uses in tree modules. I  
compared the cmakelists.txt in gr-specest to the OOT module directory  
and in the OOT/lib directory and added the BLOCKS references in the  
appropriate places. However, this still hasn’t solved the problems.  
Are there any other steps necessary to make and install an OOT modules  
with in tree dependencies?

All of this is running on Ubuntu 14.04LTS with gnuradio 3.7.7.1  
The first thing that comes to mind when we see this is that you haven’t  
added all of the public functions of your block to the public header  
file (file\_sink.h), but you say that’s identical. Still probably worth  
checking on that file to make sure.

Have you looked at your swig directory’s .i file? That needs to properly  
reference your block to export it into Python. It seems like this is ok  
since you’re getting as far as to see the error on the method, not the  
block. Again, though, something to check.

So this is just you replicating the file sink blocks completely? You  
aren’t trying to inherit from them or use them internally, are you? That  
might cause other issues.

Tom

---

<div class="post-metadata">

**Author:** ![ValentaS\_Chris\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@ValentaS\_Chris\_R](https://www.ruby-forum.com/u/ValentaS_Chris_R)\
**Post date:** [August 1, 2015, 1:56am UTC](https://www.ruby-forum.com/t/building-an-oot-modules-with-an-in-tree-dependency/242817/8 "2015-08-01T01:56:17Z")

</div>

If we don’t just document with comments in the proper places in the OOT  
structure, I was thinking we could have the user list GR required  
components in the gr\_modtool interactive configuration. It wouldn’t  
solve all problems like the file\_sink\_base issue, but it would be a good  
start.

Sean

From: discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid  
[[mailto:discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid](mailto:discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid)] On  
Behalf Of Tom R.  
Sent: Friday, July 31, 2015 1:57 PM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Fri, Jul 31, 2015 at 1:52 PM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
Ah, so I figured it out. Not only did I need to add #define BLOCKS\_API  
to my swig .i file, but I also had to add %include  
“gnuradio/blocks/file\_sink\_base.h” as well.

Ah, of course! Good catch.

We should have this documented somewhere – how to use GNU Radio classes  
and blocks in OOT projects.

Tom

From: Valenta, Chris R.  
Sent: Friday, July 31, 2015 11:30 AM  
To: ‘Tom R.’  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: RE: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

Yes, blocks is included in the cmakelists.txt as  
set(GR\_REQUIRED\_COMPONENTS RUNTIME BLOCKS) as well as a link directory  
GNURADIO\_BLOCKS\_LIBRARY\_DIRS. Its also in the /lib cmakelists.txt as a  
target\_link\_library GNURADIO\_BLOCKS\_LIBRARIES.

BLOCKS\_API was not in the swig .i file. I added this, ran make clean,  
make, and installed and still get the same error.

From: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tom R.  
Sent: Friday, July 31, 2015 11:02 AM

To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Fri, Jul 31, 2015 at 10:50 AM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
So the function (set\_unbuffered) that’s coming up as not being found is  
in file\_sink\_base.h which is included in the file\_sink.h so I’m pretty  
sure I’m ok here.

The swig file just includes file\_sink.h….I tried adding file\_sink\_base.h  
to this as well, but it didn’t change anything.

For the time being, I’m replicating the file\_sink block exactly (except  
the name) to try and get it to compile OOT. However, since file\_sink  
depends on file\_sink\_base, which I’m not copying, I think there are  
problems linking to it.

Would it be better to also copy file\_sink\_base to my OOT module?

You should be able to use file\_sink\_base from libgnuradio-blocks.so, so  
no, keep that one in tree so you’re not carrying around extra stuff.  
First, do you have BLOCKS as one of the GNU Radio required components in  
your CMakeLists.txt file?

Also, and I suspect this might be the real problem, do you “#define  
BLOCKS\_API” in you .i file? There should be a #define for your module’s  
name already; just add this line here along with that one.

Tom

From: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf  
Of Tom R.  
Sent: Friday, July 31, 2015 10:27 AM  
To: Valenta, Chris R.  
Cc: removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Building an OOT modules with an In Tree  
Dependency

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
I’m trying to make an out of tree module based on blocks::file\_sink that  
has some additional functionality I need. Right now, I’ve built it OOT,  
but an having trouble getting it to work. The code (file\_sink\_impl.cc,  
file\_sink\_impl.h, and file\_sink.h → actual names are different so  
there are no conflicts) are all identical to the ones in tree. I used  
gr-modtool to create the OOT modules with this block and it makes and  
installs fine. However, when I try to use it, I get the following error:

AttributeError: ‘file\_sink\_sptr’ object has no attribute  
‘set\_unbuffered’

What I think is happening here is that the OOT version of my code isn’t  
linking to the file\_sink\_base in gnuradio-blocks to inherit this  
function. Browsing previous mail lists, Marcus M. noted in the  
thread ‘ [Discuss-gnuradio] Out of Tree linker error…  
libgnuradio-MYMOD.so:‘ that the problem might be in my cmake files. He  
referenced gr-specest as an example which uses in tree modules. I  
compared the cmakelists.txt in gr-specest to the OOT module directory  
and in the OOT/lib directory and added the BLOCKS references in the  
appropriate places. However, this still hasn’t solved the problems.  
Are there any other steps necessary to make and install an OOT modules  
with in tree dependencies?

All of this is running on Ubuntu 14.04LTS with gnuradio 3.7.7.1  
The first thing that comes to mind when we see this is that you haven’t  
added all of the public functions of your block to the public header  
file (file\_sink.h), but you say that’s identical. Still probably worth  
checking on that file to make sure.

Have you looked at your swig directory’s .i file? That needs to properly  
reference your block to export it into Python. It seems like this is ok  
since you’re getting as far as to see the error on the method, not the  
block. Again, though, something to check.

So this is just you replicating the file sink blocks completely? You  
aren’t trying to inherit from them or use them internally, are you? That  
might cause other issues.

Tom
