Building an OOT modules with an In Tree Dependency

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

On Thu, Jul 30, 2015 at 5:26 PM, Valenta, Chris R. <
[email protected]> 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

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: [email protected] [mailto:[email protected]] On Behalf Of
Tom R.
Sent: Friday, July 31, 2015 10:27 AM
To: Valenta, Chris R.
Cc: [email protected]
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.
<[email protected]mailto:[email protected]>
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

On Fri, Jul 31, 2015 at 10:50 AM, Valenta, Chris R. <
[email protected]> 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

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: [email protected]
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: [email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Tom R.
Sent: Friday, July 31, 2015 11:02 AM
To: Valenta, Chris R.
Cc: [email protected]mailto:[email protected]
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.
<[email protected]mailto:[email protected]>
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: [email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]] On Behalf
Of Tom R.
Sent: Friday, July 31, 2015 10:27 AM
To: Valenta, Chris R.
Cc: [email protected]mailto:[email protected]
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.
<[email protected]mailto:[email protected]>
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

On Fri, Jul 31, 2015 at 1:52 PM, Valenta, Chris R. <
[email protected]> 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

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: [email protected] [mailto:[email protected]] On Behalf Of
Tom R.
Sent: Friday, July 31, 2015 11:02 AM
To: Valenta, Chris R.
Cc: [email protected]
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.
<[email protected]mailto:[email protected]>
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: [email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]] On Behalf
Of Tom R.
Sent: Friday, July 31, 2015 10:27 AM
To: Valenta, Chris R.
Cc: [email protected]mailto:removed_e[email protected]
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.
<[email protected]mailto:[email protected]>
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

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: [email protected]n.invalid
[mailto:[email protected]n.invalid] On
Behalf Of Tom R.
Sent: Friday, July 31, 2015 1:57 PM
To: Valenta, Chris R.
Cc: [email protected]
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.
<[email protected]mailto:[email protected]>
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: [email protected]mailto:[email protected]
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: [email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Tom R.
Sent: Friday, July 31, 2015 11:02 AM

To: Valenta, Chris R.
Cc: [email protected]mailto:[email protected]
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.
<[email protected]mailto:[email protected]>
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: [email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]] On Behalf
Of Tom R.
Sent: Friday, July 31, 2015 10:27 AM
To: Valenta, Chris R.
Cc: [email protected]mailto:[email protected]
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.
<[email protected]mailto:[email protected]>
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

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