help with building Python-3.7
#1
help with building Python-3.7
I was able to build python-2.7.15 and all it's modules using MIPSpro, but I am just not having much luck with Python-3.7, I was wondering if someone can help guide me a bit here.

I guess I have three questions - first question - is something broken with gcc 4.7.1 and pthreads?  I just couldn't get 4.7.1 to compile at all - here was the first line:


Code:
export CC=/usr/nekoware/gcc-4.7/bin/gcc
export CXX=/usr/nekoware/gcc-4.7/bin/g++
export CFLAGS="-std=gnu99 -g -O0 -mips4"
export CXXFLAGS="-g -O0 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"

./configure --prefix=/usr/local
<snip>
-bash-4.2$ gmake
/usr/nekoware/gcc-4.7/bin/gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -Wall -std=gnu99 -g -O0 -mips4 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include -I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include  -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
In file included from ./Include/pythread.h:114:0,
                 from ./Include/pystate.h:11,
                 from ./Include/traceback.h:8,
                 from ./Include/Python.h:100,
                 from ./Programs/python.c:3:
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:277:33: error: unknown type name 'pthread_barrierattr_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:278:30: error: unknown type name 'pthread_barrierattr_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:279:36: error: unknown type name 'pthread_barrierattr_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:280:36: error: unknown type name 'pthread_barrierattr_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:281:26: error: unknown type name 'pthread_barrier_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:282:8: error: unknown type name 'pthread_barrierattr_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:283:26: error: unknown type name 'pthread_barrier_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:284:29: error: unknown type name 'pthread_barrier_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:297:26: error: unknown type name 'pthread_spinlock_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:298:23: error: unknown type name 'pthread_spinlock_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:299:23: error: unknown type name 'pthread_spinlock_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:300:26: error: unknown type name 'pthread_spinlock_t'
/usr/nekoware/gcc-4.7/lib/gcc/mips-sgi-irix6.5/4.7.1/include-fixed/pthread.h:301:25: error: unknown type name 'pthread_spinlock_t'
gmake: *** [Programs/python.o] Error 1
-bash-4.2$


2nd question - I don't really have the chops to figure out why MIPSpro was dying on this, here is where it died:


Code:
export CC=/usr/bin/cc
export CXX=/usr/bin/CC
export CFLAGS="-c99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -woff all -O2 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"

./configure --prefix=/usr/local 
gmake
<snip>

/usr/bin/cc -c  -DNDEBUG -O -c99 -g0 -O2 -mips4 -c99 -g0 -O2 -mips4     -I. -I./Include -I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include -I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include  -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c
cc-1142 cc: ERROR File = Objects/dictobject.c, Line = 424
  There are too many initializers for a declared aggregate.

          {DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY,
          ^

Here is the function in question:


Code:
static PyDictKeysObject empty_keys_struct = {
        1, /* dk_refcnt */
        1, /* dk_size */
        lookdict_split, /* dk_lookup */
        0, /* dk_usable (immutable) */
        0, /* dk_nentries */
        {DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY,
         DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY, DKIX_EMPTY}, /* dk_indices */
};

3rd question:

so I can get Python-3.7 to compile fine (I guess) using 3.4.6, but for the life of me I just can't seem to figure out why the modules (edit: really meant to say extensions) are all failing linking with unresolved symbols.  I was able to fix it on Python-2.7.15 by appending the "ld" line with all the proper -L paths, but the same approach just isn't working for 3.7.  I've spent a few days on it and I'm just not sure what I'm not seeing


Code:
export CC=gcc
export CXX=g++
export CFLAGS="-std=gnu99 -g -O0 -mips4"
export CXXFLAGS="-g -O0 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"

./configure --prefix=/usr/local
gmake

Everything is compiling fine, when it gets to the modules it just starts failing the linking.  I've tried to do the modules manually but they still fail for me:


Code:
gcc -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -Wall -std=gnu99 -g -O0 -mips4 -std=gnu99 -g -O0 -mips4 -std=c99 -Wextra -Wno-unused-parameter -I./Include -I. -I/usr/local/include/ncurses -I/usr/nekoware/include -I/usr/local/include -I/usr/people/develop/dev/python/Python-3.7.0/Include -I/usr/people/develop/dev/python/Python-3.7.0 -c /usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.c -o build/temp.irix-6.5-IP32-3.7/usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.o

ld -L. -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib -L/usr/people/develop/dev/python/Python-3.7.0  build/temp.irix-6.5-IP32-3.7/usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.o -L. -L/usr/people/develop/dev/python/Python-3.7.0 -L/usr/local/lib32 -L/usr/local/lib -L/usr/nekoware/lib -o build/lib.irix-6.5-IP32-3.7/_struct.so  -L. -L/usr/people/develop/dev/python/Python-3.7.0 -L/usr/local/lib32 -L/usr/local/lib -L/usr/nekoware/lib

ld32: ERROR   33 : Unresolved text symbol "_xpg5_vsnprintf" -- 1st referenced by build/temp.irix-6.5-IP32-3.7/usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "_linkfollow" -- 1st referenced by build/temp.irix-6.5-IP32-3.7/usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "__xpg4_setregid" -- 1st referenced by build/temp.irix-6.5-IP32-3.7/usr/people/develop/dev/python/Python-3.7.0/Modules/_struct.o.

etc etc

4rth question:

I'm sort of new to Python - it doesn't seem there is a "gmake test" or "gmake check", anyone know how to run a test suite on Python?  I found the Lib/test dir, but there was no readme file, and I must of missed a mention of it in the general readme file
(This post was last modified: 09-26-2018, 01:11 AM by gijoe77.)
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
09-25-2018, 10:30 PM
#2
RE: help with building Python-3.7
Python's tests: https://devguide.python.org/runtests/

Yes. GCC mangles pthreads in the 4.7 branch with certain libs. It sucks.

Regarding the error, looks related to your array: https://stackoverflow.com/questions/2662...rray-error

Have you tried another GCC version in obsolete?

I'm the manager
Besides IRIX Network, I run these sites:
projectkitsune.com

Tezro
Octane2
Indigo2 IMPACT
Indigo2
3x O2
3x Indy

Raion
Operator
*******

Posts: 352
Threads: 68
Joined: Nov 2017
Website Find Reply
09-26-2018, 02:17 AM
#3
RE: help with building Python-3.7
(09-26-2018, 02:17 AM)Raion Wrote:  Python's tests: https://devguide.python.org/runtests/

Yes. GCC mangles pthreads in the 4.7 branch with certain libs. It sucks.

Regarding the error, looks related to your array: https://stackoverflow.com/questions/2662...rray-error

Have you tried another GCC version in obsolete?

awesome! Thanks for the runtests link.

I'll keep playing with trying to get MIPSpro to compile.

I get a (partially) successful compile done with gcc 3.4.6, but still can't seem to figure out the unresolved symbols/lib issue with the extensions/modules.  Basically this is what I mean (I'm not sure if I'm using proper python lingo, I've only spent the last few days learning it)


Code:
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_uuid                 ossaudiodev                              
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           


Failed to build these modules:
_asyncio              _bisect               _blake2            
_bz2                  _codecs_cn            _codecs_hk         
_codecs_iso2022       _codecs_jp            _codecs_kr         
_codecs_tw            _contextvars          _crypt             
_csv                  _ctypes               _ctypes_test       
_curses               _curses_panel         _datetime          
_dbm                  _decimal              _elementtree       
_gdbm                 _hashlib              _heapq             
_json                 _lsprof               _lzma              
_md5                  _multibytecodec       _multiprocessing   
_opcode               _pickle               _posixsubprocess   
_queue                _random               _sha1              
_sha256               _sha3                 _sha512            
_socket               _sqlite3              _ssl               
_struct               _testbuffer           _testcapi          
_testimportmultiple   _testmultiphase       _tkinter           
_xxtestfuzz           array                 audioop            
binascii              cmath                 fcntl              
grp                   math                  mmap               
nis                   parser                pyexpat            
readline              resource              select             
spwd                  syslog                termios            
unicodedata           xxlimited             zlib               


Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
edit:  ok, seems running a test should be easy enough, seems the full test suite needs the extenstions tho.

Code:
-bash-4.2$ ./python -m test
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/test/__main__.py", line 1, in <module>
    from test.libregrtest import main
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/test/libregrtest/__init__.py", line 4, in <module>
    from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES, ALL_RESOURCES
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/test/libregrtest/cmdline.py", line 4, in <module>
    from test import support
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/test/support/__init__.py", line 15, in <module>
    import logging.handlers
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/logging/handlers.py", line 26, in <module>
    import logging, socket, os, pickle, struct, time, re
  File "/usr/people/develop/dev/python/Python-3.7.0/Lib/socket.py", line 49, in <module>
    import _socket
ModuleNotFoundError: No module named '_socket'
-bash-4.2$ 
edit2:  seems its not quite so simple even with what I believe to be a complete build, such as python-2.7.15.  

Code:
Python build finished, but the necessary bits to build these modules were not found:
bsddb185           linuxaudiodev      ossaudiodev     
sunaudiodev                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

running build_scripts
copying and adjusting /usr/people/develop/dev/python/Python-2.7.15/Tools/scripts/pydoc -> build/scripts-2.7
copying and adjusting /usr/people/develop/dev/python/Python-2.7.15/Tools/scripts/idle -> build/scripts-2.7
copying and adjusting /usr/people/develop/dev/python/Python-2.7.15/Tools/scripts/2to3 -> build/scripts-2.7
copying and adjusting /usr/people/develop/dev/python/Python-2.7.15/Lib/smtpd.py -> build/scripts-2.7
changing mode of build/scripts-2.7/pydoc from 644 to 755
changing mode of build/scripts-2.7/idle from 644 to 755
changing mode of build/scripts-2.7/2to3 from 644 to 755
changing mode of build/scripts-2.7/smtpd.py from 644 to 755
-bash-4.2$ ./python -m test
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
== CPython 2.7.15 (default, Sep 23 2018, 10:06:11) [C]
==   IRIX-6.5-IP32-mips-n32bit-ELF big-endian
==   /usr/people/develop/dev/python/Python-2.7.15/build/test_python_548826
Traceback (most recent call last):
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/test/__main__.py", line 3, in <module>
    regrtest.main_in_temp_cwd()
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/test/regrtest.py", line 2024, in main_in_temp_cwd
    main()
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/test/regrtest.py", line 668, in main
    ncpu = cpu_count()
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/test/regrtest.py", line 311, in cpu_count
    return multiprocessing.cpu_count()
  File "/usr/people/develop/dev/python/Python-2.7.15/Lib/multiprocessing/__init__.py", line 136, in cpu_count
    raise NotImplementedError('cannot determine number of cpus')
NotImplementedError: cannot determine number of cpus
-bash-4.2$ 
(This post was last modified: 09-26-2018, 08:48 AM by gijoe77.)
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
09-26-2018, 08:29 AM
#4
RE: help with building Python-3.7
That's about the limit of my skills here. I'm hoping somebody else can pipe in and we can figure out how to get both python 2 and 3 fully working

I'm the manager
Besides IRIX Network, I run these sites:
projectkitsune.com

Tezro
Octane2
Indigo2 IMPACT
Indigo2
3x O2
3x Indy

Raion
Operator
*******

Posts: 352
Threads: 68
Joined: Nov 2017
Website Find Reply
09-26-2018, 11:03 PM
#5
RE: help with building Python-3.7
I can't help for python3 and my python2 mipspro is still at the "core dumps during test runs" phase.

I'm no python programmer and it's a long time since I had to delve into compiler innards, so slow going at the moment.

But if it's any use, the patch for python2 I use is here (allows multiprocessing to detect num irix CPUs):

https://github.com/danielhams/didbs/blob...ixes.patch

The dependencies I use are:

make,tar,xz,perl,openssl,berkeley-db

And it's configured like this:

https://github.com/danielhams/didbs/blob...onfigureit

My issues are here:

https://github.com/danielhams/didbs/blob.../knownbugs

I need to go back and re-review the brokenness of my openssl and berkely-db ports as part of getting this up and running - these are undoubtedly a source of issues.
(This post was last modified: 09-27-2018, 06:34 AM by mrthinlysliced.)
mrthinlysliced
Octane

Posts: 76
Threads: 5
Joined: May 2018
Find Reply
09-27-2018, 06:33 AM
#6
RE: help with building Python-3.7
(09-27-2018, 06:33 AM)mrthinlysliced Wrote:  I can't help for python3 and my python2 mipspro is still at the "core dumps during test runs" phase.

I'm no python programmer and it's a long time since I had to delve into compiler innards, so slow going at the moment.

But if it's any use, the patch for python2 I use is here (allows multiprocessing to detect num irix CPUs):

https://github.com/danielhams/didbs/blob...ixes.patch

The dependencies I use are:

make,tar,xz,perl,openssl,berkeley-db

And it's configured like this:

https://github.com/danielhams/didbs/blob...onfigureit

My issues are here:

https://github.com/danielhams/didbs/blob.../knownbugs

I need to go back and re-review the brokenness of my openssl and berkely-db ports as part of getting this up and running - these are undoubtedly a source of issues.

awesome!  I'll take a look and do some deeping diving of my newb self too Smile
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
09-27-2018, 10:55 AM
#7
RE: help with building Python-3.7
Hi Mrthinlysliced,

I don't have berkeley-db but it looks like my 2.7.15 compile tests are also core dumping (dang I lost the terminal, I remember it skipped over the bdb tests, I would have mentioned what test number it core dumped after but It was in the two digits).

I'm trying to compile using gcc 3.4.6 just for kicks but I'm sort of stuck - wondering if you can help me out with the Makefile. Basically I get to the point where the compile finishes and the modules _ctypes, _ctypes_test, _curses, _curses_panel, _socket and _ssl fail to build. I know how to fix this (append LDFLAGS along with -lss -lcurses -ltermcap -lcrypto to come after the *.so object in the "ld" line). I just can't figure where in the Makefile I need to append this too... Can you help steer me in that direction? I've been able to unravel Makefiles in the past to append the various "-lm" or whatnot libs, I just can't seem to figure out this particular Makefile. I thought that maybe that's what the LDLAST was for but nope.
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
09-28-2018, 08:13 PM
#8
RE: help with building Python-3.7
(09-28-2018, 08:13 PM)gijoe77 Wrote:  I don't have berkeley-db but it looks like my 2.7.15 compile tests are also core dumping (dang I lost the terminal, I remember it skipped over the bdb tests, I would have mentioned what test number it core dumped after but It was in the two digits).

I'm trying to compile using gcc 3.4.6 just for kicks but I'm sort of stuck - wondering if you can help me out with the Makefile.  Basically I get to the point where the compile finishes and the modules _ctypes, _ctypes_test, _curses, _curses_panel, _socket and _ssl fail to build.  I know how to fix this (append LDFLAGS along with -lss -lcurses -ltermcap -lcrypto to come after the *.so object in the "ld" line).  I just can't figure where in the Makefile I need to append this too... Can you help steer me in that direction? I've been able to unravel Makefiles in the past to append the various "-lm" or whatnot libs, I just can't seem to figure out this particular Makefile. I thought that maybe that's what the LDLAST was for but nope.

Hi gijoe,

Sorry for tardy reply, things have been rather busy at work lately and I prefer to actually check before I open the flappy hole .-)

So, python2.

Basically python2 has an "autoconf/automake/libtool" style builder (2.7.15 I'm trying with).

For these kinds of "builds" - setting the following flags can be enough to get headers and libraries picked up:


Code:
CPPFLAGS=-I/path/to/include
LDFLAGS=-L/path/to/lib
LD_LIBRARYN32_PATH=/path/to/lib:$LD_LIBRARYN32_PATH


But (hehe always a but, right!), python uses dynamic module loading - so it's possible to separately link and load the modules.

If you have a look in the Modules/Setup file, there you can search for "curses" and you'll see there are some lines that are commented out - if you uncomment them and have a play, you should be able to add or remove compilation and linker flags.

Be aware - the Modules/Setup file is generated from the Modules/Setup.dist, so you run the risk of changes being overwritten if you re-run "configure".

Now all the above said, I found I didn't need to edit those - I just needed to specify the right CPPFLAGS, LDFLAGS and LD_LIBRARYN32_PATH before running "configure".


Code:
The CPPFLAGS needs to have "-I/pathto/include" - once for each place where headers for openssl, curses live.

The LDFLAGS needs to have "-L/pathto/lib" - once for each place where libraries for openssl, curses live.

The LD_LIBRARYN32_PATH needs to include each path to the place where libraries for openssl, curses live.


I'd recommend getting those variables correct and re-running configure on a freshly extracted + patched python2. For my money, 99% of the time if you are hand-editing makefiles with an "autoconf" project, you've not set things up correctly before launching configure.

Kr,

Mr TS
mrthinlysliced
Octane

Posts: 76
Threads: 5
Joined: May 2018
Find Reply
10-02-2018, 09:51 AM
#9
RE: help with building Python-3.7
if you need basic features, I suggest ucPython (micro-pythong). It's minimalistic, written in C, and designed for embedded stuff, usually without an OS under the hood, but there is a port for Linux that should also work on Irix.
niwe
Banned

Posts: 35
Threads: 3
Joined: May 2018
Find Reply
10-02-2018, 10:28 AM
#10
RE: help with building Python-3.7
(10-02-2018, 10:28 AM)niwe Wrote:  if you need basic features, I suggest ucPython (micro-pythong). It's minimalistic, written in C, and designed for embedded stuff, usually without an OS under the hood, but there is a port for Linux that should also work on Irix.

seems to be failing at compiling rsa.c.  pretty strange there is no configure script but there is a Makefile.  I'll keep this on the backburner as I learn more about autoconfig/autogen or whatever is used to generate Makefiles, as of right now too many other things I have lined up to try to compile and learn, but thanks for the pointer.

(10-02-2018, 09:51 AM)mrthinlysliced Wrote:  
(09-28-2018, 08:13 PM)gijoe77 Wrote:  I don't have berkeley-db but it looks like my 2.7.15 compile tests are also core dumping (dang I lost the terminal, I remember it skipped over the bdb tests, I would have mentioned what test number it core dumped after but It was in the two digits).

I'm trying to compile using gcc 3.4.6 just for kicks but I'm sort of stuck - wondering if you can help me out with the Makefile.  Basically I get to the point where the compile finishes and the modules _ctypes, _ctypes_test, _curses, _curses_panel, _socket and _ssl fail to build.  I know how to fix this (append LDFLAGS along with -lss -lcurses -ltermcap -lcrypto to come after the *.so object in the "ld" line).  I just can't figure where in the Makefile I need to append this too... Can you help steer me in that direction? I've been able to unravel Makefiles in the past to append the various "-lm" or whatnot libs, I just can't seem to figure out this particular Makefile. I thought that maybe that's what the LDLAST was for but nope.

Hi gijoe,

Sorry for tardy reply, things have been rather busy at work lately and I prefer to actually check before I open the flappy hole .-)

So, python2.

Basically python2 has an "autoconf/automake/libtool" style builder (2.7.15 I'm trying with).

For these kinds of "builds" - setting the following flags can be enough to get headers and libraries picked up:


Code:
CPPFLAGS=-I/path/to/include
LDFLAGS=-L/path/to/lib
LD_LIBRARYN32_PATH=/path/to/lib:$LD_LIBRARYN32_PATH


But (hehe always a but, right!), python uses dynamic module loading - so it's possible to separately link and load the modules.

If you have a look in the Modules/Setup file, there you can search for "curses" and you'll see there are some lines that are commented out - if you uncomment them and have a play, you should be able to add or remove compilation and linker flags.

Be aware - the Modules/Setup file is generated from the Modules/Setup.dist, so you run the risk of changes being overwritten if you re-run "configure".

Now all the above said, I found I didn't need to edit those - I just needed to specify the right CPPFLAGS, LDFLAGS and LD_LIBRARYN32_PATH before running "configure".


Code:
The CPPFLAGS needs to have "-I/pathto/include" - once for each place where headers for openssl, curses live.

The LDFLAGS needs to have "-L/pathto/lib" - once for each place where libraries for openssl, curses live.

The LD_LIBRARYN32_PATH needs to include each path to the place where libraries for openssl, curses live.


I'd recommend getting those variables correct and re-running configure on a freshly extracted + patched python2. For my money, 99% of the time if you are hand-editing makefiles with an "autoconf" project, you've not set things up correctly before launching configure.

Kr,

Mr TS

It seems everytime I play with Python-2.7.15 I get different results!  I did find that ncurses line in the Modules/Setup file and it looks like that was able to take care of the _curses and _curses_panel extensions, but I've been playing so much with tweaking stuff I can't really even get a good handle on what I did to fix what.  I am to the point where all the extension are built except for _ctypes and _ctypes_test.  The first time I ran through the compile process I was able to compile those two manually, but for whatever reason when I re-run gmake it gives me a "importing it failed" message due to a unresolved symbol.

BTW here is my build enviroment

Code:
export CC=gcc
export CXX=g++
export CFLAGS="-std=gnu99 -g -O1 -mips4"
export CXXFLAGS="-g -O1 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/openssl -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib -lssl -lcrypt -lcurses -ltermcap"
export LD_LIBRARYN32_PATH=/usr/local/lib:/usr/local/lib32:/usr/nekoware/lib

./configure --prefix=/usr/local
gmake



I'll probably work on rebuilding everything from a fresh source tree so I can document with much finer detail what I'm changing and where - but I might wait a while before I do that, I need to get my Makefile/module/libtool/whatever-this-is skills up a bit more, I'm sort of lost trying to trace back what does the link line in what file.  

I'm currently working through the stuff you already compiled in didbs, if I get stuck or if I'm able to get something done I go and take a look at your notes, it feels like its good practice and I am really determined to be much better at this stuff.
(This post was last modified: 10-03-2018, 12:11 PM by gijoe77.)
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
10-03-2018, 11:13 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)