Thanks for the help Chris. I think the problem is my lack of
knowledge of C which is compounded by the Python-to-C and Numeric
Python-to-C interfaces. I might need to learn a lot more about C
pointers and structures and how they are used in the two interfaces
before I can fix the problem. Oh well, the C modules will have to
remain dysfunctional on non 32 bit x86 chips for now.
Thanks again,
Edward
On 13/03/06, Chris MacRaild <c.a.macraild@xxxxxxxxxxx> wrote:
I get a segfault at the grid search in your test script whenever -fPIC
is used in the compile, using any of the permutations you suggested. eg:
bin/relax1.2.3> gcc -fPIC -I/usr/include/python2.4 -c -o
maths_fns/c_chi2.os maths_fns/c_chi2.c
maths_fns/c_chi2.c: In function 'chi2':
maths_fns/c_chi2.c:54: warning: cast from pointer to integer of
different size
bin/relax1.2.3> gcc -fPIC -I/usr/include/python2.4 -c -o
maths_fns/exponential.os maths_fns/exponential.c
maths_fns/exponential.c: In function 'exponential':
maths_fns/exponential.c:47: warning: cast from pointer to integer of
different size
bin/relax1.2.3> gcc -fPIC -I/usr/include/python2.4 -c -o
maths_fns/relax_fit.os maths_fns/relax_fit.c
maths_fns/relax_fit.c: In function 'back_calc_I':
maths_fns/relax_fit.c:158: warning: cast from pointer to integer of
different size
maths_fns/relax_fit.c:162: warning: cast from pointer to integer of
different size
bin/relax1.2.3> gcc -shared -o maths_fns/relax_fit.so
maths_fns/c_chi2.os maths_fns/exponential.os maths_fns/relax_fit.os
compiles ok but segfaults
Manual compile without -fPIC fails on the final gcc -shared command:
bin/relax1.2.3> gcc -shared -o maths_fns/relax_fit.so
maths_fns/c_chi2.os maths_fns/exponential.os maths_fns/relax_fit.os
/usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld:
maths_fns/c_chi2.os: relocation R_X86_64_32S against `back_calc' can not
be used when making a shared object; recompile with -fPIC
maths_fns/c_chi2.os: could not read symbols: Bad value
collect2: ld returned 1 exit status
On Sun, 2006-03-12 at 18:42 +1100, Edward d'Auvergne wrote:
Actually as the chip architecture is different, maybe the commands
$ gcc -fPIC -I/usr/include/python2.4 -c -o maths_fns/c_chi2.os
maths_fns/c_chi2.c
$ gcc -fPIC -I/usr/include/python2.4 -c -o maths_fns/exponential.os
maths_fns/exponential.c
$ gcc -fPIC -I/usr/include/python2.4 -c -o maths_fns/relax_fit.os
maths_fns/relax_fit.c
$ gcc -shared -o maths_fns/relax_fit.so maths_fns/c_chi2.os
maths_fns/exponential.os maths_fns/relax_fit.os
will produce functional modules. I forgot to mention that the bug
report is called 'bug #5473'.
Thanks,
Edward