Mailing List Archive

what is reloc error ?
Hello, everyone.
I am now working on building Python interface
to my C++ matrix library.

I have a problem.
After compiling and when trying to import my
module
I get following message.

% gcc -c XXXtype.cc
% gcc -c subXXXtype.cc
.......................
% ld -o XXXtype.so -dy -G -g *.o -lstdc++
% python -c "import XXXtype"
python: can't handle reloc type <NULL>
<====this!!!

I don't understand why this occurs.
Please help me!
(Platform: python 1.5.2, Linux 2.0.34 with gcc.)


Thooney Millennier.
what is reloc error ? [ In reply to ]
Thooney Millennier <thooney@pk.highway.ne.jp> writes:
>I am now working on building Python interface
>to my C++ matrix library.

>I have a problem.
>After compiling and when trying to import my
>module
>I get following message.

> % gcc -c XXXtype.cc

You are compiling position independent code, so use -fPIC flag.

> % gcc -c subXXXtype.cc
> .......................
> % ld -o XXXtype.so -dy -G -g *.o -lstdc++

What about gcc -o XXXtype.so *.o -shared -g -lstdc++?

> % python -c "import XXXtype"
> python: can't handle reloc type <NULL>
><====this!!!

>I don't understand why this occurs.
>Please help me!
>(Platform: python 1.5.2, Linux 2.0.34 with gcc.)

The best way to do compile modules is to write a Setup file and let
Python to create the Makefile by itself. For details, see
Demo/extend in the Python source distribution.

Pekka

--
Pekka.Pessi@hut.fi
what is reloc error ? [ In reply to ]
> Hello, everyone.
> I am now working on building Python interface
> to my C++ matrix library.
>
> I have a problem.
> After compiling and when trying to import my
> module
> I get following message.
>
> % gcc -c XXXtype.cc
> % gcc -c subXXXtype.cc
> .......................
> % ld -o XXXtype.so -dy -G -g *.o -lstdc++
> % python -c "import XXXtype"
> python: can't handle reloc type <NULL>
> <====this!!!

I'm not entirely sure if this will fix your problem, but
I think you need to give a flag to gcc to tell it to make a shared
library.

Try gcc -fPIC -c *.cc # not sure if this is necessary with gcc
and ld -shared -o XXXtype.so *.o


Good luck,


Travis