This is not an issue of missing libraries... Add "-Xlinker
--export-dynamics" to your link line (in the unlikely case you do not
know what I'm talking about, look for linker option -export-dynamic
here http://linux.die.net/man/1/ld)...
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
> OK that's helped a little, but I still have unresolved symbols and I
> can't quite figure out what link libraries I need to add. By the
> way, adding the link to the library libdl ( -ldl) helped with some
> of the unresolved symbols. But I still am getting this problem
> running the code on an Xubuntu 10 distro,
>
> /tmp/ccX38fPA.o: In function `__Pyx_InitStrings':
> /mnt/hgfs/Task21/pyembed.cpp:5201: undefined reference to
> `PyUnicodeUCS4_DecodeUTF8'
That loks like a totally different issue. Python can be compiled in
two flavors (well, many more, but for this discussion, it's two). They
concern the internal representation of unicode-literals. These can
either be UCS2 (2 bytes) or UCS4 (4 bytes).
It appears as if your system/libraries/whatever compile against a UCS4-
based library, but then try to *link* against one that is UCS2. So
there is something messed up there with your python. Do you by any
chance have a self-compiled Python flying around? For embedding? But
then, it seems the distutils seem to pick up the System's Python.h, or
something.
Diez
* Python 2.6 is my system Python
$ python2.6 -c 'from distutils import sysconfig; print
sysconfig.get_python_inc()'
/usr/include/python2.6
* Python 2.7 is a custom build installed with --prefix=/usr/local/python/2.7
$ python2.7 -c 'from distutils import sysconfig; print
sysconfig.get_python_inc()'
/usr/local/python/2.7/include/python2.7
> It seems like all three distros I've tried have had some weird
> configuration issues that make this embedding problem a nuisance.
You should take a look at Demos/embed/Makefile for a recipe about how
to query Python to get proper compiler and linker flags... This is
prepared to work with both shared lib (usually distro provided) and
static lib builds (usually custom builds) of Python.
> I
> haven't even gotten to the problem of forcing matplotlib to draw it's
> figures when invoked from the embedded C code, but that's probably not
> even a Cython issue.
>
indeed.
> On Mar 22, 6:35 pm, "Diez B. Roggisch" <de...@web.de> wrote:
>> Am 22.03.2011 um 23:20 schrieb SevenThunders:
>>
>> > OK that's helped a little, but I still have unresolved symbols and I
>> > can't quite figure out what link libraries I need to add. By the
>> > way, adding the link to the library libdl ( -ldl) helped with some
>> > of the unresolved symbols. But I still am getting this problem
>> > running the code on an Xubuntu 10 distro,
>>
>> > /tmp/ccX38fPA.o: In function `__Pyx_InitStrings':
>> > /mnt/hgfs/Task21/pyembed.cpp:5201: undefined reference to
>> > `PyUnicodeUCS4_DecodeUTF8'
>>
>> That loks like a totally different issue. Python can be compiled in
>> two flavors (well, many more, but for this discussion, it's two). They
>> concern the internal representation of unicode-literals. These can
>> either be UCS2 (2 bytes) or UCS4 (4 bytes).
>>
>> It appears as if your system/libraries/whatever compile against a UCS4-
>> based library, but then try to *link* against one that is UCS2. So
>> there is something messed up there with your python. Do you by any
>> chance have a self-compiled Python flying around? For embedding? But
>> then, it seems the distutils seem to pick up the System's Python.h, or
>> something.
>>
>> Diez
--
> I have been unable to get this to work, and I'm not seeing any
> working examples so far. I would like to embed python via cython in
> some C/C++ code. Thus I'd like to make my cython function calls from C
> ++, the opposite of what's usually done. The consumer of my code is
> not flexible in this due to the real time requirements of the C++
> code. Furthermore I have no control over the main function. I can
> not use the cython generated main() via the --embed flag
>
> After many failures due to segfaults whenever I try to call into
> cython, I figured I was not initalizing something correctly in my
> test main function, so I decided to let cython generate main for me.
What does your C++ code that calls the Cython modules look like?
I mean could you post a minimal working example?
I am still having a hard time to get this working without segfaults.
Alex.