gr-how-to-write-a-blockを
この通りにやったけど、
howtoモジュールをimportすると以下のようなエラーがでる。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "howto.py", line 6, in <module>
import _howto
ImportError: ./_howto.so: undefined symbol: _Z19howto_make_print_ffv
howto_make_print_ffのライブラリオブジェクトである、_howto_la-print_ff.loが生成されていないので、
おそらくリンクに失敗している。
Makefile.amの変更(howto_print_ffのコンパイル)がMakeFILEに反映されていなかった。
親ディレクトリで、automake→configure→make→make installする必要がる。(詳しくは
ここ
)
しかし、automakeパッケージをインストールできなかった。
ubuntu9.04(jaunty)のレポジトリはもうなく、apt-get updateができなくなってしまっている。
なので、/etc/apt/sources.listを以下のように編集する必要がある。
deb http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
を
deb http://old-releases.ubuntu.com/ubuntu jaunty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
と編集する必要がある。
なぜかqa_print_ff.pyはエラーをはいたが、/usr/lib/python2.6/dist-package/gnuradio/ではimpor print_ffに成功した。
以下、作成したhowto.print_ffを動作させたpythonスクリプト(test_print_ff.py)。なぜかpython test_print_ff.pyとやらないとエラーがでる。
from gnuradio import gr, howto
class my_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
src_data = (-3, 4, -5.5, 2, 3, 1, 3, 4 ,5)
src = gr.vector_source_f (src_data)
sqr = howto.print_ff ()
dst = gr.vector_sink_f ()
self.connect (src, sqr)
self.connect (sqr, dst)
def main():
tb = my_top_block()
my_top_block().run()
if __name__=='__main__':
try:
main()
except KeyboardInterrupt:
pass
結果
root@omori-desktop:/usr/share/gnuradio/examples/digital# python test_print_ff.py
noutput_items = 8
in[0]=-3.000000, out[0]=-3.000000
in[1]=4.000000, out[1]=4.000000
in[2]=-5.500000, out[2]=-5.500000
in[3]=2.000000, out[3]=2.000000
in[4]=3.000000, out[4]=3.000000
in[5]=1.000000, out[5]=1.000000
in[6]=3.000000, out[6]=3.000000
in[7]=4.000000, out[7]=4.000000
noutput_items = 1
in[0]=5.000000, out[0]=5.000000
ブロックを編集した場合は親ディレクトリでmake→make installでライブラリは更新される!
新しいブロックを作成した場合は、automake→configure→make→make install!
最終更新:2011年06月29日 12:46