I am having a problem making SWIG work for me;
actually I am not sure if SWIG is the problem.
Anyway here it goes:
I have implemented an internal c++ function template in
gr-trellis/src/lib in the files:
quick_sort_index.h
quick_sort_index.cc
I DO NOT want to make this function available in python, and thus
I do not have a .i file.
Now I am using this function in another class implemented in the files:
interleaver.h
interleaver.cc
interleaver.i
which I want to have available in python (and thus I have the .i file)
I have modified the Makefile.am to to include ALL .h and .cc files,
and trellis.i file only including interleaver.h and interleaver.i
make succeeds, but make check DOES NOT.
It gives my the message:
make[2]: Entering directory
/home/anastas/gnuradio_svn/gr-trellis/src/python' make check-TESTS make[3]: Entering directory
/home/anastas/gnuradio_svn/gr-trellis/src/python’
Traceback (most recent call last):
File “./qa_trellis.py”, line 24, in ?
import trellis
File “/home/anastas/gnuradio_svn/gr-trellis/src/lib/trellis.py”, line
4, in ?
import _trellis
ImportError:
/home/anastas/gnuradio_svn/gr-trellis/src/lib/.libs/_trellis.so:
undefined symbol:
_Z15quicksort_indexIiEvRSt6vectorIT_SaIS1_EERS0_IiSaIiEEii
FAIL: run_tests
1 of 1 tests failed
Any ideas?
Thanks
Achilleas
I’m having the exact same problem. I haven’t had time to work it out
yet, but I’ll be looking into it shortly … unless someone else
knows a “quick fix” for this issue. - MLD
Jonathan,
I took a look at the example you pointed out (gri_agc).
I guess what I I didn’t make clear earlier is that
the situation I described actually WORKS (make, make check succeed)
when quick_sort_index.* implements an actual function and not a c++
templete without even having a .i file.
The problem arises ONLY when I change it to a c++ function template.
(Michael, is this exactly what you meant?)
Achilleas
Michael D. wrote:
src/python’
Traceback (most recent call last):
File “./qa_trellis.py”, line 24, in ?
import trellis
File “/home/anastas/gnuradio_svn/gr-trellis/src/lib/trellis.py”,
line 4, in ?
import _trellis
ImportError: /home/anastas/gnuradio_svn/gr-trellis/src/lib/.libs/
_trellis.so: undefined symbol:
_Z15quicksort_indexIiEvRSt6vectorIT_SaIS1_EERS0_IiSaIiEEii
FAIL: run_tests
I am having a problem making SWIG work for me;
actually I am not sure if SWIG is the problem.
Anyway here it goes:
I have implemented an internal c++ function template in
gr-trellis/src/lib in the files:
quick_sort_index.h
quick_sort_index.cc
I DO NOT want to make this function available in python, and thus
I do not have a .i file.
Now I am using this function in another class implemented in the files:
interleaver.h
interleaver.cc
interleaver.i
which I want to have available in python (and thus I have the .i file)
I have modified the Makefile.am to to include ALL .h and .cc files,
and trellis.i file only including interleaver.h and interleaver.i
make succeeds, but make check DOES NOT.
It gives my the message:
make[2]: Entering directory
/home/anastas/gnuradio_svn/gr-trellis/src/python' make check-TESTS make[3]: Entering directory
/home/anastas/gnuradio_svn/gr-trellis/src/python’
Traceback (most recent call last):
File “./qa_trellis.py”, line 24, in ?
import trellis
File “/home/anastas/gnuradio_svn/gr-trellis/src/lib/trellis.py”, line
4, in ?
import _trellis
ImportError:
/home/anastas/gnuradio_svn/gr-trellis/src/lib/.libs/_trellis.so:
undefined symbol:
_Z15quicksort_indexIiEvRSt6vectorIT_SaIS1_EERS0_IiSaIiEEii
FAIL: run_tests
1 of 1 tests failed
Any ideas?
Thanks
Achilleas
Michael D. wrote:
I’m having the exact same problem. I haven’t had time to work it out
yet, but I’ll be looking into it shortly … unless someone else knows a
“quick fix” for this issue. - MLD
I don’t have time at the moment to go into detail, but look at the way
this is handled in gnuradio-core/src/lib/general for the gri_agc_cc.cc
file.
gri_agc_cc.cc implements a class that gets used in gr_agc_cc.cc.
There is a corresponding gri_agc_cc.h and gri_agc_cc.i file.
grc_agc_cc.i is not put into general.i, but is included directly in
the .i file for the functions that use it. In this case, the file
gr_agc_cc.i has an include at the top.
This way SWIG is aware of the function and can link to it, but doesn’t
include it in what gets turned into Python.
Let me know if this is the right solution for you.
-Johnathan
On Aug 11, 2006, at 1:22 PM, Achilleas A. wrote:
I took a look at the example you pointed out (gri_agc).
I guess what I I didn’t make clear earlier is that
the situation I described actually WORKS (make, make check succeed)
when quick_sort_index.* implements an actual function and not a c++
templete without even having a .i file.
The problem arises ONLY when I change it to a c++ function template.
(Michael, is this exactly what you meant?)
Yes.
Achilleas A. wrote:
I guess what I I didn’t make clear earlier is that
the situation I described actually WORKS (make, make check succeed)
when quick_sort_index.* implements an actual function and not a c++
templete without even having a .i file.
The problem arises ONLY when I change it to a c++ function template.
Ah, we will then have to fall back upon our fearless leader’s expertise,
as this exceeds my ability to diagnose.
(That is fluff speak for: I have no friggin’ clue!)
Eric?
-Johnathan