On Fri, Jul 31, 2015 at 1:52 PM, Valenta, Chris R. < chris.vale...@gtri.gatech.edu> 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 Rondeau' > *Cc:* discuss-gnuradio@gnu.org > *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:* trond...@trondeau.com [mailto:trond...@trondeau.com > <trond...@trondeau.com>] *On Behalf Of *Tom Rondeau > *Sent:* Friday, July 31, 2015 11:02 AM > > *To:* Valenta, Chris R. > *Cc:* discuss-gnuradio@gnu.org > *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. < > chris.vale...@gtri.gatech.edu> 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:* trond...@trondeau.com [mailto:trond...@trondeau.com] *On Behalf > Of *Tom Rondeau > *Sent:* Friday, July 31, 2015 10:27 AM > *To:* Valenta, Chris R. > *Cc:* discuss-gnuradio@gnu.org > *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. < > chris.vale...@gtri.gatech.edu> 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 Muller 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 > > > > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio