Importing blocks to GRC

Hi,

I am working on a ubuntu machine and am following the HOWTO example as
the
following link shows. My program works fine until loading the
howto_square2_ff module into the GRC library. The tutorial says that
“If
you do a make install from the build directory, you can use the block in
GRC. If GRC is already running, you can hit the “Reload Blocks” button
in
the GRC toolbar; it’s a blue circular arrow on the right-hand side. You
should now see a “HOWTO” category in the block tree.” After I executed
the
commands specified by the tutorial, I did not see any HOWTO blocks when
I
boot the GRC using $gnuradio-companion. Attached is a tarball of my
code.
Would be great to get comments. Thanks.

http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules

Pengyu

On Wed, May 28, 2014 at 1:01 PM, Pengyu Z. [email protected]
wrote:

After I executed the commands specified by the tutorial, I did not see any
HOWTO blocks when I boot the GRC using $gnuradio-companion

If all the tests pass then this usually means there is a problem with
your
xml files. You should remove and everything in it as those …
aren’t allowed. Also sudo ldconfig

I executed $gr_modtool makexml square2_ff before. So the content in
/gr-howto/grc/howto_square2_ff.xml
should be correct. As you pointed that stuff should be removed,
I
also did $gr_modtool makexml square_ff. Now the content in
/gr-howto/grc/howto_square_ff.xml
is shown below. Although I did $make install and $sudo ldconfig, I still
cannot see the block on GRC…

Square ff howto_square_ff HOWTO import howto howto.square_ff() in float out float

On Wed, May 28, 2014 at 1:43 PM, Pengyu Z. [email protected]
wrote:

I still cannot see the block on GRC

I’m assuming you’re using ubuntu then.

Check your python path
echo $PYTHONPATH

and ensure that you see the howto folder located there in the
dist-packages

On 05/28/2014 09:11 PM, Pengyu Z. wrote:

<mailto:[email protected]>> wrote:
dist-packages

Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page
No, it’s an environment variable. A Linux shell thing.

PYTHONPATH should be set to include the place where the installer
installed the Python modules.

Setting users environment variables is unrelated to building software.

I usually set mine in my .bashrc:

PYTHONPATH=.:$HOME/bin:/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages
PYTHONPATH=$PYTHONPATH:/usr/local/lib64/python2.7/site-packages:/usr/local/lib64/python2.7/dist-packages
export PYTHONPATH

When I do “echo $PYTHONPATH”, nothing shows up. How is $PYTHONPATH set?
I
thought it should be configured automatically by cmake and make.
Correct?

On Wed, May 28, 2014 at 6:36 PM, Marcus D. Leech [email protected]
wrote:

Setting users environment variables is unrelated to building software.

That’s right. I more wanted to make sure that the thing installed
correctly.

Pengyu,

I downloaded your zip and rebuilt it on my machine with no errors. I can
use your square2 ff block just fine in GRC which leads me to believe
there
is something off with your setup. Not sure of the right question to ask
at
the moment though…

For fun, can you pastebin the output of
cmake …
make
make install

On Thu, May 29, 2014 at 5:13 AM, Pengyu Z. [email protected]
wrote:

I also think some configurations on my machine are not correct

Let’s simplify the problem even more. It should be the case that when
you
place a xml file in /usr/local/share/gnuradio/blocks/ it will show up in
GNU Radio Companion regardless of if you actually made the block. Do a
sudo
cp on howto_square2_ff.xml. Then open up GNU Radio and see if you can
find
the HOWTO category and the square block.

If that doesn’t work, GNU Radio is likely searching somewhere else for
new
blocks similar to this problem
http://gnuradio.4.n7.nabble.com/Cannot-see-my-custom-blocks-in-GRC-td45780.htmlsince
your versions match. I recommend updating.

Yeah. I also think some configurations on my machine are not correct.
Here
are the output of several commands.

$ cmake …
– The CXX compiler identification is GNU 4.8.2
– The C compiler identification is GNU 4.8.2
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Build type not specified: defaulting to release.
– Boost version: 1.54.0
– Found the following Boost libraries:
– filesystem
– system
– Found PkgConfig: /usr/bin/pkg-config (found version “0.26”)
– checking for module ‘gnuradio-runtime’
– found gnuradio-runtime, version 3.7.2.1
– Found GNURADIO_RUNTIME:
/usr/lib/x86_64-linux-gnu/libgnuradio-runtime.so
– checking for module ‘cppunit’
– found cppunit, version 1.13.1
– Found CPPUNIT: /usr/lib/x86_64-linux-gnu/libcppunit.so;dl
– Found SWIG: /usr/bin/swig2.0 (found version “2.0.11”)
– Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found
suitable version “2.7.6”, minimum required is “2”)
CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:28 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:28 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:25 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:28 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

– Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.6”,
minimum required is “2”)
CMake Warning (dev) at swig/CMakeLists.txt:29 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at swig/CMakeLists.txt:29 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at swig/CMakeLists.txt:29 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

– Found Doxygen: /usr/bin/doxygen (found version “1.8.6”)
CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:47 (GR_SWIG_INSTALL)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:47 (GR_SWIG_INSTALL)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Modules/GrSwig.cmake:182 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
swig/CMakeLists.txt:47 (GR_SWIG_INSTALL)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at python/CMakeLists.txt:23 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:44

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:92

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/CMakeLists.txt:20 (include):
Syntax Warning in cmake code at

/home/vijaykp/gr-howto/cmake/Modules/GrPython.cmake:196:100

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

– Configuring done
– Generating done
– Build files have been written to: /home/vijaykp/gr-howto/build

$ make
Scanning dependencies of target gnuradio-howto
[ 5%] Building CXX object
lib/CMakeFiles/gnuradio-howto.dir/square_ff_impl.cc.o
[ 10%] Building CXX object
lib/CMakeFiles/gnuradio-howto.dir/square2_ff_impl.cc.o
Linking CXX shared library libgnuradio-howto.so
[ 10%] Built target gnuradio-howto
Scanning dependencies of target test-howto
[ 15%] Building CXX object lib/CMakeFiles/test-howto.dir/test_howto.cc.o
[ 21%] Building CXX object lib/CMakeFiles/test-howto.dir/qa_howto.cc.o
Linking CXX executable test-howto
[ 21%] Built target test-howto
Scanning dependencies of target _howto_swig_doc_tag
[ 26%] Building CXX object
swig/CMakeFiles/_howto_swig_doc_tag.dir/_howto_swig_doc_tag.cpp.o
Linking CXX executable _howto_swig_doc_tag
[ 26%] Built target _howto_swig_doc_tag
Scanning dependencies of target _howto_swig_swig_tag
[ 31%] Building CXX object
swig/CMakeFiles/_howto_swig_swig_tag.dir/_howto_swig_swig_tag.cpp.o
Linking CXX executable _howto_swig_swig_tag
[ 31%] Built target _howto_swig_swig_tag
[ 36%] Generating doxygen xml for howto_swig_doc docs
Warning: Tag SYMBOL_CACHE_SIZE' at line 289 of file /home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has become obsolete. To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u" Warning: Tag SHOW_DIRECTORIES’ at line 477 of file
/home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has
become obsolete.
To avoid this warning please remove this line from your configuration
file
or upgrade it using “doxygen -u”
Warning: Tag HTML_ALIGN_MEMBERS' at line 803 of file /home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has become obsolete. To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u" Warning: Tag USE_INLINE_TREES’ at line 956 of file
/home/vijaykp/gr-howto/build/swig/howto_swig_doc_swig_docs/Doxyfile has
become obsolete.
To avoid this warning please remove this line from your configuration
file
or upgrade it using “doxygen -u”
Warning: doxygen no longer ships with the FreeSans font.
You may want to clear or change DOT_FONTNAME.
Otherwise you run the risk that the wrong font is being used for dot
generated graphs.
[ 42%] Generating howto_swig_doc.i
[ 47%] Generating howto_swig.tag
[ 52%] Swig source
Scanning dependencies of target _howto_swig
[ 57%] Building CXX object
swig/CMakeFiles/_howto_swig.dir/howto_swigPYTHON_wrap.cxx.o
Linking CXX shared module _howto_swig.so
[ 57%] Built target _howto_swig
Scanning dependencies of target pygen_swig_34533
[ 63%] Generating howto_swig.pyc
[ 68%] Generating howto_swig.pyo
[ 89%] Built target pygen_swig_34533
Scanning dependencies of target pygen_python_62df5
[ 94%] Generating init.pyc
[100%] Generating init.pyo
[100%] Built target pygen_python_62df5
Scanning dependencies of target pygen_apps_9a6dd
[100%] Built target pygen_apps_9a6dd

$ make test
Running tests…
Test project /home/vijaykp/gr-howto/build
Start 1: test_howto
1/2 Test #1: test_howto … Passed 0.00 sec
Start 2: qa_square_ff
2/2 Test #2: qa_square_ff … Passed 0.36 sec

100% tests passed, 0 tests failed out of 2

Total Test time (real) = 0.37 sec

$ sudo make install
[ 10%] Built target gnuradio-howto
[ 21%] Built target test-howto
[ 26%] Built target _howto_swig_doc_tag
[ 31%] Built target _howto_swig_swig_tag
[ 57%] Built target _howto_swig
[ 89%] Built target pygen_swig_34533
[100%] Built target pygen_python_62df5
[100%] Built target pygen_apps_9a6dd
Install the project…
– Install configuration: “Release”
– Up-to-date: /usr/local/lib/cmake/howto/howtoConfig.cmake
– Up-to-date: /usr/local/include/howto/api.h
– Up-to-date: /usr/local/include/howto/square_ff.h
– Up-to-date: /usr/local/include/howto/square2_ff.h
– Installing: /usr/local/lib/libgnuradio-howto.so
– Installing:
/usr/local/lib/python2.7/dist-packages/howto/_howto_swig.so
– Removed runtime path from
“/usr/local/lib/python2.7/dist-packages/howto/_howto_swig.so”
– Installing:
/usr/local/lib/python2.7/dist-packages/howto/howto_swig.py
– Installing:
/usr/local/lib/python2.7/dist-packages/howto/howto_swig.pyc
– Installing:
/usr/local/lib/python2.7/dist-packages/howto/howto_swig.pyo
– Up-to-date: /usr/local/include/howto/howto/swig/howto_swig.i
– Installing: /usr/local/include/howto/howto/swig/howto_swig_doc.i
– Up-to-date: /usr/local/lib/python2.7/dist-packages/howto/init.py
– Installing: /usr/local/lib/python2.7/dist-packages/howto/init.pyc
– Installing: /usr/local/lib/python2.7/dist-packages/howto/init.pyo
– Up-to-date: /usr/local/share/gnuradio/grc/blocks/howto_square_ff.xml
– Up-to-date: /usr/local/share/gnuradio/grc/blocks/howto_square2_ff.xml

$ sudo ldconfig
$

On Wed, May 28, 2014 at 10:11 PM, Alfredo M. [email protected]

I think the default GNU Radio search path is
/usr/share/gnuradio/grc/blocks
because all existing blocks are stored within this directory. I added
the
new path into GRC_BLOCKS_PATH variable.

export
GRC_BLOCKS_PATH=/usr/local/share/gnuradio/grc/blocks:$GRC_BLOCKS_PATH

Now I can see the howto block in GRC. For a quick test, I connected a
constant source 0.5 to the howto module. The output of howto module is
0.25, which is the square of input. Therefore, the gr-howto block
functions
as expected. However, when I run the GRC, I saw one error message and am
not sure what it indicates.

libGL error: failed to load driver: swrast

On Thu, May 29, 2014 at 12:28 PM, Alfredo M. [email protected]