[Distutils] relocation R_X86_64_32 against `a local symbol' can not be used...

Gour gour at mail.inet.hr
Thu Aug 14 09:58:19 CEST 2008


Hi!

I am trying to install pyswisseph
(http://pypi.python.org/pypi/pyswisseph) extension on my x86_64 system,
but building of extension fails with:

[gour at nitai pyswisseph-1.74.00-0] python setup.py --verbose build 
rm -f *.o swetest libswe*
gcc	 -c -g -O9 -Wall -pedantic 	   swedate.c     
In file included from swephexp.h:80,
                 from swedate.c:86:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swehouse.c     
In file included from swehouse.c:62:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swejpl.c     
In file included from swephexp.h:80,
                 from swejpl.c:71:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swemmoon.c     
In file included from swephexp.h:80,
                 from swemmoon.c:182:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swemplan.c     
In file included from swephexp.h:80,
                 from swemplan.c:63:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swepcalc.c     
In file included from swephexp.h:80,
                 from swepcalc.h:75,
                 from swepcalc.c:76:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
swepcalc.c: In function ‘calcserv’:
swepcalc.c:169: warning: ‘rspeed’ may be used uninitialized in this function
swepcalc.c: In function ‘nacalc’:
swepcalc.c:134: warning: ‘rspeed’ may be used uninitialized in this function
gcc	 -c -g -O9 -Wall -pedantic 	   sweph.c     
In file included from swejpl.h:68,
                 from sweph.c:66:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
sweph.c: In function ‘app_pos_etc_plan’:
sweph.c:2143: warning: array subscript is above array bounds
gcc	 -c -g -O9 -Wall -pedantic 	   swepdate.c     
In file included from swephexp.h:80,
                 from swepcalc.h:75,
                 from swepdate.c:77:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swephlib.c     
In file included from swephexp.h:80,
                 from swephlib.c:79:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
gcc	 -c -g -O9 -Wall -pedantic 	   swecl.c     
In file included from swejpl.h:68,
                 from swecl.c:62:
sweodef.h:201: warning: ISO C90 does not support ‘long long’
swecl.c: In function ‘swe_lun_occult_when_glob’:
swecl.c:1093: warning: ‘tjd’ may be used uninitialized in this function
ar r libswe.a	swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o
swepcalc.o \
sweph.o swepdate.o swephlib.o swecl.o 
ar: creating libswe.a
running build
running build_ext
building 'swisseph' extension
skipping pyswisseph.c (build/temp.linux-x86_64-2.5/pyswisseph.o up-to-date)
skipping swhdatetime.c (build/temp.linux-x86_64-2.5/swhdatetime.o up-to-date)
skipping swhfmt.c (build/temp.linux-x86_64-2.5/swhfmt.o up-to-date)
skipping swhsearch.c (build/temp.linux-x86_64-2.5/swhsearch.o up-to-date)
gcc -pthread -shared build/temp.linux-x86_64-2.5/pyswisseph.o \
build/temp.linux-x86_64-2.5/swhdatetime.o
build/temp.linux-x86_64-2.5/swhfmt.o \
build/temp.linux-x86_64-2.5/swhsearch.o -Lsrc -L/usr/lib -lswe
-lpython2.5 \
-o build/lib.linux-x86_64-2.5/swisseph.so
/usr/bin/ld: src/libswe.a(swedate.o): relocation R_X86_64_32 against `a
local symbol' can not be used when making a shared object; recompile
with -fPIC

src/libswe.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


Here is the setup.py:

[gour at nitai pyswisseph-1.74.00-0] cat  setup.py 
#!/usr/bin/env python
# -*- coding: utf8 -*-

import os.path, sys
From distutils.core import setup, Extension

VERSION = '1.74.00-0'

if 'build' in sys.argv or 'install' in sys.argv:
	instdir = os.path.dirname(os.path.abspath(__file__))
	os.chdir(os.path.join(instdir, 'src'))
	os.system('make clean')
	os.system('make libswe.a')
	os.chdir(instdir)

swemodule = Extension(
	'swisseph',
	include_dirs = ['src'],
	libraries = ['swe'],
	library_dirs = ['src'],
	sources = ['pyswisseph.c', 'swhdatetime.c', 'swhfmt.c', 'swhsearch.c']
)

setup(
	name = 'pyswisseph',
	version = VERSION,
	description='Python extension to the Swiss Ephemeris',
	long_description="""Python extension to AstroDienst's Swiss Ephemeris library.

Swiss Ephemeris homepage: http://www.astro.com/swisseph

Now Python 3 compatible (experimental).

Usage example:

>>> import swisseph as swe
>>> swe.set_ephe_path('/usr/share/ephe') # set path to ephemeris files
>>> now = swe.julday(2007,3,3) # get Julian day number
>>> res = swe.lun_eclipse_when(now) # find next lunar eclipse (from now on)
>>> ecltime = swe.revjul(res[1][0]) # get date UTC
>>> ecltime
(2007, 3, 3, 23.347975596785545)
>>> jd = swe.julday(2008,3,21)
>>> swe.calc_ut(jd, swe.AST_OFFSET+13681)[0] # asteroid Monty Python
0.098474291148756998
>>> help(swe)

Installation via: # python setup.py install

""",
	author='S.Marquis',
	author_email='stnsls at gmail.com',
	url='http://pyswisseph.atarax.org',
	download_url='http://pypi.python.org/pypi/pyswisseph',
	classifiers=[
		'Development Status :: 5 - Production/Stable',
		'Intended Audience :: Developers',
		'Intended Audience :: Religion',
		'License :: OSI Approved :: GNU General Public License (GPL)',
		'Programming Language :: C',
		'Programming Language :: Python',
		'Topic :: Religion',
		'Topic :: Scientific/Engineering :: Astronomy',
		'Topic :: Software Development :: Libraries :: Python Modules'
		],
	keywords='Astrology Ephemeris Swisseph',
	ext_modules = [swemodule]
)

# End.


I'm quite new (just started learning Python) with Python and its tools,
but, afaik, "recompile with -fPIC" means that something is missing so
that extension is not compiled properly.

I use:

[gour at nitai pyswisseph-1.74.00-0] gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared \
--enable-languages=c,c++,fortran,objc,obj-c++,treelang \
--enable-threads=posix --mandir=/usr/share/man --enable-__cxa_atexit \
--disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib \
--enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.3.1 20080724 (prerelease) (GCC)

on:

[gour at nitai pyswisseph-1.74.00-0] uname -a
Linux nitai 2.6.25-ARCH #1 SMP PREEMPT Mon Jul 14 14:56:27 UTC 2008 \
x86_64 AMD Turion(tm) 64 Mobile ML-34 AuthenticAMD GNU/Linux


Any idea?


Sincerely,
Gour

-- 

Gour  | Zagreb, Croatia  | GPG key: C6E7162D
----------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20080814/6d025583/attachment.pgp>


More information about the Distutils-SIG mailing list