Problem using FFT-class in my own written block (part II)

Hello all,

In order to keep discussions separated (I apparently did something
stupid which mixed up 2 threads), I start a new thread here.

Summarizing: when writing my own out of tree block in C++ using FFTs
(including the ‘fft/fft.h’ header) and following the tutorial
“Out-of-tree modules”, I get an error when I want to use the block in
GNU Radio Companion:

 ImportError /usr/local/libgnuradio-MY_MODULE.so: undefined symbol:

fft_complex

According to Tom R. the FFT-library is not included in the link
process, and he suggested the following tutorial:

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

I started following that tutorial, setting some environment variables
first, and I found out that I am using version 3.6.5git (on an Ettus
Research USB stick) while I suspect that the suggested tutorial only
covers versions >= 3.7.

Even when I only changed the following (as suggested by the tutorial):

 find_package(GnuradioCore)

into:

 set(GR_REQUIRED_COMPONENTS CORE)
 find_package(Gnuradio "3.6.5" REQUIRED)

I get the following error when I run “cmake …/” from the
build-directory:

=================================================
– Build type not specified: defaulting to release.
– Boost version: 1.49.0
– Found the following Boost libraries:
– filesystem
– system
CMake Error at CMakeLists.txt:92 (find_package):
By not providing “FindGnuradio.cmake” in CMAKE_MODULE_PATH this
project has
asked CMake to find a package configuration file provided by
“Gnuradio”,
but CMake did not find one.

Could not find a package configuration file provided by “Gnuradio”
(requested version 3.6.5) with any of the following names:

 GnuradioConfig.cmake
 gnuradio-config.cmake

Add the installation prefix of “Gnuradio” to CMAKE_PREFIX_PATH or set
“Gnuradio_DIR” to a directory containing one of the above files. If
“Gnuradio” provides a separate development package or SDK, be sure it
has
been installed.

So I tried (as suggested by the error message):

 1) set CMAKE_MODULE_PATH to the path where 

"FindGnuradio.cmake"resides
2) add the installation prefix of “Gnuradio” to CMAKE_PREFIX_PATH

The two mentioned config .cmake files are not even present on the
environment I am working on (not found by a search at the GNU radio
installation prefix which is usr/local).

So I am pretty stuck here. My goal is to get this working in my current
environment before trying to port my blocks to the latest version > 3.7.
Any help is greatly appreciated.

Best regards,

 Jeroen Boschma

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jeroen,

it’s not advisable to use the 3.7 Out of tree-module directory
architecture with GR 3.6.
However, gr_modtool should be generating modules that fit exactly your
installed version. You shouldn’t have to change anything on the
gnuradio core/runtime/gruel/whatever includes.

After you have set up your new module with gr_modtool, just copy over
the original GNU Radio FindFFTWf.cmake into the cmake/Modules directory,
and use FindPackage(FFTWf) as well as add the found directories to
your target link libraries and the found includes to your include
directories; see my reply to Johannes D.'s post of yesterday.

Greetings, and happy hacking!

Marcus

On 05.12.2013 21:30, Jeroen Boschma wrote:

ImportError /usr/local/libgnuradio-MY_MODULE.so: undefined symbol:
tutorial only covers versions >= 3.7.

So I am pretty stuck here. My goal is to get this working in my
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSoXahAAoJEAFxB7BbsDrLi2QH/AmKmrZNZYn7BIz7snz/eu0G
X4e2u++r7UJ8M3ty4PB33txGDT83LNlvVLXhHWjnl6BPKClaEezmU6iYLsCSOyKA
otFUvzUw5lc7Q4KgM1aS6KVCCCPczbKWIHGm2d4+4octnabIx1NfuKgeSwwSUdX/
BFXw3q/mjRQpHGXKD+lkcJgCUYLXerLNQd9YCYsY9XxQJL855rBIQd7QEUBi3GXB
c+Foq1/+wVWWbOx+Za1XGkBgmjIIzmQSqwsNLatIhEEbZTseVRH8eJ8UUq4IJSRX
sAVaI3k4j6SvvtNC+EMSee8/kdxj08OlmrNLYrWaU9y9wA/pG0R9PXWwGf3n7Sw=
=CYIj
-----END PGP SIGNATURE-----

Marcus Müller schreef op 2013-12-06 08:02:

(on an Ettus R. USB stick) while I suspect that the suggested
REQUIRED)
but CMake did not find one.

mailing list [email protected]
sAVaI3k4j6SvvtNC+EMSee8/kdxj08OlmrNLYrWaU9y9wA/pG0R9PXWwGf3n7Sw=
=CYIj
-----END PGP SIGNATURE-----


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Thanks for your reply Marcus. It did help me a bit, but results are not
yet there… So what I did:

  1. I Copied the FindFFTW3f.cmake into the cmake/Modules dir of my
    module.
  2. In the top-level CMakeLists.txt I modified/added (just guessing what
    to do…):

find_package(FFTW3f) # added this

include_directories(
${CMAKE_SOURCE_DIR}/include
${Boost_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${CPPUNIT_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
${FFTW3F_INCLUDE_DIRS} # added this, I checked that it
actually points to an include dir
)

link_directories(
${Boost_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS}
${CPPUNIT_LIBRARY_DIRS}
${GNURADIO_CORE_LIBRARY_DIRS}
${FFTW3F_LIBRARY_DIRS} # added this, is an empty variable
)

  1. In the module CMakeLists.txt I modified/added (again just guessing
    what to do…):

########################################################################

Setup library

########################################################################
target_link_libraries(gnuradio-LTE_jamming ${Boost_LIBRARIES}
${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} ${FFTW3F_LIBRARIES}) #
added last one

########################################################################

Build and register unit test

########################################################################
target_link_libraries(
test-LTE_jamming
${GNURADIO_CORE_LIBRARIES}
${Boost_LIBRARIES}
${CPPUNIT_LIBRARIES}
${FFTW3F_LIBRARIES} # added this, I checked that it
actually points to an .so file
gnuradio-LTE_jamming
)

All of this is just a wild guess of me: I see something refering to, for
example, ${CPPUNIT_LIBRARIES} and I conclude that there is a chance that
${FFTW3F_LIBRARIES} should also be there…

But after (from build dir):

cmake …/
make
sudo make install
sudo ldconfig

I still get the error:

 ImportError: /usr/local/lib/libgnuradio-LTE_jamming.so: undefined

symbol: _ZN2gr3fft11fft_complexC1Eibi

Did I forget something? Hacking is difficult when you don’t fully
understand what’s going on…

Best regards,

Jeroen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hej Jeroen,

  1. In the top-level CMakeLists.txt I modified/added (just guessing
    what to do…):

I wouldn’t call your method “guessing”; you used strong indications! :smiley:
Ok, now I see what your problem is: It’s not that you don’t link
against FFTW (the library that does the actual FFT calculations), but
that you don’t link against gr-fft, the GNU Radio fft helpers and
wrappers and widgets!

Now everything makes sense. The point is: with 3.7 it’s easy to use
certain GNU Radio components, just by adding[1]:
set(GR_REQUIRED_COMPONENTS RUNTIME FILTER)
to the master CMakeLists.txt.

For 3.6, I can’t verify that right now, but doing
find_package(gnuradio-fft)
instead should do the trick (I hope the spelling is right, though.
Look into /usr/local/lib/pkgconfig/gnuradio* ). The resulting
variables should then be something like[2]:
GNURADIO_FFT_INCLUDE_DIRS (or LIBRARY_DIRS, respectively).
You might need to google the correct naming, though.

Jay!
Happy hacking

1:
http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModulesConfig#Configuring-Our-Project-to-Use-GNU-Radio-Libraries
2: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSocVCAAoJEAFxB7BbsDrLYeMH/iyINXohTKFSxNaZL5df6qdE
tpUni2POUwzfM32vcmdVovj6IQcKppEWz3Xugd8KAxtkSQYJd9+f7EZydIvnsG+R
/ToQ8ARBTDUsFZpe0HaKUGKTiY6Q8pI3SneOAug7/RMZffK8UcV/ObFyCn0ZEI7+
2phikCxt4XaQr+KqvA/242BPR3jPPiDil3Ok1ocsQpn/CuLf+NHTnSFQaSFGTPPQ
I/rw9c5GIy7Hn4s7I+KCjxdkJcZ/PXVJcfOveec3BzV03NTXjpV8tgr4cTj5aars
9o48MrnbGjdZO5irRmaUi7mDj7sAKGC3wWPmgCk9Iapo2lI+BIBZ16d7hCkVexs=
=bQt9
-----END PGP SIGNATURE-----

On Fri, Dec 6, 2013 at 8:43 AM, [email protected] wrote:

tpUni2POUwzfM32vcmdVovj6IQcKppEWz3Xugd8KAxtkSQYJd9+f7EZydIvnsG+R
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
This is kind of frustrating, already spending like three full days on just
trying to link an FFT library and searching the internet for doing that.
It’s absurd…

Jeroen

You don’t want to use find_package for something if you’re just trying
to get information out of the .pc file. Use PKG_CHECK_MODULES:

http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
http://www.cmake.org/cmake/help/cmake2.6docs.html#module:FindPkgConfig

Tom

Marcus Müller schreef op 2013-12-06 13:38:

against FFTW (the library that does the actual FFT calculations), but
instead should do the trick (I hope the spelling is right, though.

http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModulesConfig#Configuring-Our-Project-to-Use-GNU-Radio-Libraries

9o48MrnbGjdZO5irRmaUi7mDj7sAKGC3wWPmgCk9Iapo2lI+BIBZ16d7hCkVexs=
=bQt9
-----END PGP SIGNATURE-----


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Sorry, does not work. There is a gnuradio-fft.pc so I tried:

 find_package(gnuradio-fft)

But it immediatly starts whining about not finding
“gnuradio-fftConfig.cmake” or “gnuradio-fft-config.cmake”. Well, neither
of those two files exists in the GNU installation…

This is kind of frustrating, already spending like three full days on
just trying to link an FFT library and searching the internet for doing
that. It’s absurd…

Jeroen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hej,

don’t despair :wink:
Honestly, with 3.7 I could help you personally, but for 3.6 I’ve never
tried to do that.
If you really just want to do FFTs and don’t want to use any other
functionality provided by gr-fft, drop every usage of gr-fft and use
FFTW directly, doing what I proposed before.
I’m fairly certain there are some out-of-tree modules that use gr-fft
functionality, though if their developers where active the last
months, the projects have been ported to GR 3.7., so that one must try
to find a version before that. I can’t do that for you right now - but
I’m fairly certain that it could work out.

Greetings,
Marcus Müller
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSoe/YAAoJEAFxB7BbsDrLCtQH/jD50cMmwahp/jlx5rwleeTx
qgAg3fWcftE7gCGpml7mSttUd3313Mj2uiWum99a7BX5oXn6rw5X+pQR4ON0tHGz
00Td7c8Kq/cw+VTyWQO24KWZjQ/af5L5Ht8Rl+U4qloY6wA8aBapARU8gbxPMp1U
QPoNZiVgO1zEYUkrV2JrONXKm70Hbnt8y/AWt0fvUyZb2o6woKmW4vcD88OqlE1K
GneseXvQZU9RD8eVc9HR1wEnjdEEOI5RTY27NNC9JgKBAS+LH69b730qd0p13cVl
RAbc78Bq8jrWSrqd/100cWWXpkWbq0MyCSxpDYuBEjNNLxaa6hBgJToQ3mWcN04=
=aKPD
-----END PGP SIGNATURE-----

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