Title: sparc linux build fails with "could not import runpy module"
Type: Stage: resolved
Components: Build Versions: Python 3.3
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, uservorname.usernachname
Priority: normal Keywords:

Created on 2013-02-16 16:02 by uservorname.usernachname, last changed 2013-08-03 02:52 by ned.deily. This issue is now closed.

File name Uploaded Description Edit
config.log uservorname.usernachname, 2013-02-16 16:02 config
config.log uservorname.usernachname, 2013-02-17 13:59 configure
build-log.txt uservorname.usernachname, 2013-02-17 15:27 make 2>&1 | tee build-log.txt
Messages (7)
msg182232 - (view) Author: uservorname usernachname (uservorname.usernachname) Date: 2013-02-16 16:02

make fails at:
ar rc libpython3.3m.a Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o
ar rc libpython3.3m.a Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/bltinmodule.o Python/ceval.o Python/compile.o Python/codecs.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/modsupport.o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/random.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o   Python/thread.o Python/frozen.o
ar rc libpython3.3m.a Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o
ar rc libpython3.3m.a Modules/_threadmodule.o  Modules/signalmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/symtablemodule.o  Modules/xxsubtype.o
ranlib libpython3.3m.a
gcc -pthread   -Xlinker -export-dynamic -o python Modules/python.o libpython3.3m.a -lpthread -ldl  -lutil   -lm
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Could not import runpy module
make: *** [Lib/] Error 1

What is wrong here? Do you need any other information?

best regards
msg182242 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-16 21:58
For some reason in your build, the first bootstrap use of the compiler (to generate the sysconfig data) is failing because the runpy module can't be found.  Python should be able to find it in the source directory; the "Could not find platform dependent libraries <exec_prefix>" is normal at this point and can be ignored.  I see from your config.log that you do have a lot of configure options set, including some invalid ones (configure:16344: WARNING: unrecognized options: --enable-clocale, --enable-debug).  I suggest you try rebuilding from a freshly untarred source directory with as simple a ./configure as possible and as few environment variables set as possible and see what happens when you run make, something like:

./configure && make

If that fails similarly, please include that whole output from configure through make and the config.log output.
msg182269 - (view) Author: uservorname usernachname (uservorname.usernachname) Date: 2013-02-17 13:59
Thanks for your hint. I did:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --bindir=/usr  --sysconfdir=/etc --sbindir=/usr/sbin/ & make 2>&1 | tee build-log.txt

and get:

gcc -pthread -fPIC -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -I/c/backup/fes-a120d19nas/Python-3.3.0/Include -I/c/backup/fes-a120d19nas/Python-3.3.0 -c /c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.c -o build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-padre-3.3/
make: *** [sharedmods] Error 138

I also tried to compile with ./configure --build=sparc-linux but it results in getting the same make error.

Maybe it have to do something with uname --m
When compiling other programs I have to set build=sparc-linux But as you can see its using here  linux-padre. Also gcc is using sparc-unkown-linux

If you need any other information let me know it.
msg182274 - (view) Author: uservorname usernachname (uservorname.usernachname) Date: 2013-02-17 15:27
I also tried to compile with

./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --bindir=/usr  --sysconfdir=/etc --sbindir=/usr/sbin/ --build=sparc-linux --libdir=/usr/lib --includedir=/usr/include --datarootdir=/usr/share --localedir=/usr/local --host=sparc-linux
which results in the same error. Strange is that i set libdir but it seems that is using /usr/local/lib instead of /usr/lib

Attached you will find the output of make ( make 2>&1 | tee build-log.txt )
msg182284 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-17 21:27
I'm glad you got a little further.  Now it seems the build is failing when trying to build the _ssl and _hashlib extension modules.

building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -I/c/backup/fes-a120d19nas/Python-3.3.0/Include -I/c/backup/fes-a120d19nas/Python-3.3.0 -c /c/backup/fes-a120d19nas/Python-3.Modules/_ssl.c -o build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_ssl.o
gcc -pthread -shared build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-padre-3.3/
*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-padre-3.3/ undefined symbol: time, version key
building '_hashlib' extension
gcc -pthread -fPIC -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -I/c/backup/fes-a120d19nas/Python-3.3.0/Include -I/c/backup/fes-a120d19nas/Python-3.3.0 -c /c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.c -o build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-padre-3.3/c/backup/fes-a120d19nas/Python-3.Modules/_hashopenssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-padre-3.3/
make: *** [sharedmods] Error 138

Both of these modules are dependent on libssl and libcrypto, both normally supplied by openssl.  In the main file which is used to build the interpreter's extension modules, there are tests for the presence of these libs and their corresponding include files ( line 759).  There are a list of locations that are searched including the standard system locations and /usr/local/ssl and /usr/contrib/ssl.  Apparently, is finding both includes and libs in one of those directories because otherwise it would skip attempting to build _ssl altogether.  But for some reason the link step fails with the undefined symbol message.  And then it seems that the _hashlib step fails altogether.  I have no personal experience with sparc linux installs, much less with the ReadyNAS (and I doubt anyone else here does either), so I can only speculate that the most likely cause of this failure is a broken openssl installation.  I'd check the above locations as well as under /usr/lib and /usr/include.  If you are using a package manager to install openssl, make sure it is a dev version with headers, like libssl-dev.  Good luck!
msg182324 - (view) Author: uservorname usernachname (uservorname.usernachname) Date: 2013-02-18 14:59
Thanks for your hints.

I got installed openssl-1.0.1d and ssl in 
fes-a120d19nas:/backup/fes-a120d19nas/Python-3.3.0# whereis openssl
openssl: /usr/bin/openssl /usr/include/openssl
fes-a120d19nas:/backup/fes-a120d19nas/Python-3.3.0# whereis ssl
ssl: /etc/ssl /usr/lib/ssl

I compiled openssl-1.0.1d and gnutls-3.1.7 by my self. Package manager doesn't work at this machine. But anyway because I compiled this libaries all header files should be avaibel.

I also recognized that line 759 searches in /usr/local/lib instead of /usr/lib.

So I changed the setup lines regarding 759 to :

     # Detect SSL support for the socket module (via _ssl)
        search_for_ssl_incs_in = [
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
        if ssl_incs is not None:
            krb5_h = find_file('krb5.h', inc_dirs,
            if krb5_h:
                ssl_incs += krb5_h
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
                                     ] )
and executed again make. 

Which now results in

fes-a120d19nas:/backup/fes-a120d19nas/Python-3.3.0# make
case $MAKEFLAGS in *s*) quiet=-q; esac; \
 CC='sparc-linux-gcc -pthread' LDSHARED='sparc-linux-gcc -pthread -shared  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' \
        ./python -E ./ $quiet build
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
make: *** [sharedmods] Error 139

So now I'm compiling Tcl from source, and hope this will have some positive effects.
msg194230 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-08-03 02:52
Since there has been no further activity on this issue and it seems to be isolated to a particular user build, I'm going to close this.  Feel free to reopen with more documentation if you believe there is a problem with Python itself.
Date User Action Args
2013-08-03 02:52:51ned.deilysetstatus: open -> closed
resolution: not a bug
messages: + msg194230

stage: resolved
2013-02-18 14:59:27uservorname.usernachnamesetmessages: + msg182324
2013-02-17 21:27:53ned.deilysetmessages: + msg182284
2013-02-17 15:27:27uservorname.usernachnamesetfiles: + build-log.txt

messages: + msg182274
2013-02-17 13:59:26uservorname.usernachnamesetfiles: + config.log

messages: + msg182269
2013-02-16 21:58:50ned.deilysettitle: Could not find platform dependent libraries <exec_prefix> -> sparc linux build fails with "could not import runpy module"
nosy: + ned.deily

messages: + msg182242

type: compile error ->
2013-02-16 16:02:29uservorname.usernachnamecreate