Run-time error when using gsl libraries in a custom block

All,

I have a custom block which uses the GSL libraries to compute the FFT of
a sequence. When I run the flow-graph containing my custom block, I get
the following error.

Traceback (most recent call last):
File “/home/wlab/my grc files/top_block.py”, line 17, in
import howto
File “/usr/local/lib/python2.7/dist-packages/howto/init.py”, line
45, in
from howto_swig import *
File “/usr/local/lib/python2.7/dist-packages/howto/howto_swig.py”, line
26, in
_howto_swig = swig_import_helper()
File “/usr/local/lib/python2.7/dist-packages/howto/howto_swig.py”, line
22, in swig_import_helper
_mod = imp.load_module(’_howto_swig’, fp, pathname, description)
ImportError: /usr/local/lib/libgnuradio-howto.so: undefined symbol:
gsl_fft_complex_radix2_forward

I kind of know that the error is related to use of GSL within gnuradio
since when I comment the below lines:
#include <gsl/gsl_fft_complex.h>
gsl_fft_complex_radix2_forward (data_fft_1, 1, d_N);

I get no error and flow-graph runs normal.

So, I think either the GSL header files are not being located by gcc or
somehow the swig interface is broken. Does anyone has any suggestions?

Thanks,
Yu.

On 10/26/2012 12:39 PM, Zing Yu wrote:

_howto_swig = swig_import_helper()

So, I think either the GSL header files are not being located by gcc or somehow
the swig interface is broken. Does anyone has any suggestions?

If you expose gsl routines in your header, and you give this header to
swig, swig tries to “export” everything it sees in the header.

You can probably make the error go away by adding gsl libraries to
GR_SWIG_LIBRARIES (set this before the call to GR_SWIG_MAKE).

My advice to to avoid exposing any internal dependencies in public
header files. Keep the headers as simple as possible.

-josh

So now, is “cblas_dasum” not being identified? Why? Any suggestions?

Sorry, I should have replied to the list.

You can fix this by linking to gslcblas

-josh

forgot to cc my response to the list, so, here it is:

If you expose gsl routines in your header, and you give this header to

swig, swig tries to “export” everything it sees in the header.

You can probably make the error go away by adding gsl libraries to
GR_SWIG_LIBRARIES (set this before the call to GR_SWIG_MAKE).

I have changed the below line in CMakeLists.txt file in
gnuradio/gr-howto-write-a-block/swig:
set(GR_SWIG_LIBRARIES gnuradio-howto)
to:
set(GR_SWIG_LIBRARIES gnuradio-howto gsl)

Now, I get the following error when I run my flow-graph in GRC:
Traceback (most recent call last):
File “/home/wlab/Desktop/mahboob-grc-files/top_block.py”, line
15, in
import howto
File “/usr/local/lib/python2.7/dist-packages/howto/init.py”, line
45, in
from howto_swig import *
File “/usr/local/lib/python2.7/dist-packages/howto/howto_swig.py”, line
26, in
_howto_swig = swig_import_helper()
File “/usr/local/lib/python2.7/dist-packages/howto/howto_swig.py”, line
22, in swig_import_helper
_mod = imp.load_module(’_howto_swig’, fp, pathname, description)
ImportError: /usr/local/lib/libgsl.so.0: undefined symbol: cblas_dasum

So now, is “cblas_dasum” not being identified? Why? Any suggestions?

Sorry, I should have replied to the list.

You can fix this by linking to gslcblas

Yep. It works now!

I have made it to work by changing below line in CMakeLists.txt file in
gnuradio/gr-howto-write-a-block/swig:
set(GR_SWIG_LIBRARIES gnuradio-howto gsl)
to:
set(GR_SWIG_LIBRARIES gnuradio-howto gsl gslcblas)

Thanks Josh.

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