[Python-Dev] problems building Python 2.1a1 on QNX 4.25

Guido van Rossum guido@digicool.com
Fri, 26 Jan 2001 16:52:47 -0500


> [CC'ing to Armin Steinhoff, who maintains pyqnx on SourceForge.]
> 
> I'm having trouble building Python 2.1a1 on QNX 4.25. Caveat: my C is very
> rusty (long live Python!), I don't know my way around configure, and am not
> familiar with Python's Makefile. Python 2.0 compiled fine (with a couple of
> tweaks), but I'm getting caught by the new way of building things. Please
> help if you can! Many thanks in advance.
> 
> Here's an excerpt of my efforts:
> 
>     # cd /tmp/py
>     # gunzip -c < python-2.1a1.tgz | tar -rf -
>     # cd Python-2.1a1
>     # ./configure 2>&1 | tee ../configure.1
>     # make 2>&1 | tee ../make.1
>     ...
>     ./python //5/tmp/py/Python-2.1a1/setup.py build
>     'import site' failed; use -v for traceback
>     Traceback (most recent call last):
>       File "//5/tmp/py/Python-2.1a1/setup.py", line 4, in ?
>         import sys, os, string, getopt
>     ImportError: No module named string
> 
> Running ./python results in stack overflow. The old QNX instructions in
> README recommend editing Modules/Makefile:
>     LDFLAGS=    -N 64k
> 
>     # make 2>&1 | tee ../make.2
> 
> Same error as first make. But now the stack doesn't overflow.
> 
>     # python
>     'import site' failed; use -v for traceback
>     Python 2.1a1 (#2, Jan 26 2001, 11:38:55) [C] on qnxJ
>     Type "copyright", "credits" or "license" for more information.
>     >>> import sys
>     >>> sys.path
>     ['', '/usr/local/lib/python', '/home/dgoodger/lib/python', 
>     '/5/tmp/py/Python-2.1a1/Lib', '/5/tmp/py/Python-2.1a1/Lib/plat-qnxJ', 
>     '/tmp/py/Python-2.1a1/Modules']
>     >>> ^D
> 
>     # fullpath .
>     . is //5/tmp/py/Python-2.1a1
> 
> The QNX node number prefix '//5' (machine or host number, equivalent to a
> 'hostname:' prefix for network paths) is being reduced somehow (path
> normalization?) to '/5', so paths don't resolve. 2 slashes ('//') are
> required at the head of the path. Is this something that can be fixed?

Aha -- you may need QNX-specific path manipulation functions.  What's
going on is that site.py normalizes the entries in sys.path, using
this function:

    def makepath(*paths):
	dir = os.path.join(*paths)
	return os.path.normcase(os.path.abspath(dir))

I've got a feeling that os.path.abspath(dir) here is the culprit in
posixpath.py:

def abspath(path):
    """Return an absolute path."""
    if not isabs(path):
        path = join(os.getcwd(), path)
    return normpath(path)

And here I think that normpath(path) is the routine that actually gets
rid of the double leading /.

Feel free to submit a patch that leaves double leading slashes in if
on QNX.

> I added a prefix (QNX virtual-to-real path mapping on the filesystem tree)
> to correct this:
> 
>     # prefix -A /5=//5
> 
> Now /5 points to //5, similar to a link.
> 
>     # make 2>&1 | tee ../make.3
>     ...
>     ./python //5/tmp/py/Python-2.1a1/setup.py build
>     unable to execute ld: No such file or directory
>     running build
>     running build_ext
>     building 'struct' extension
>     creating build
>     creating build/temp.qnx-J-PCI-2.1
>     cc -O -I. -I/5/tmp/py/Python-2.1a1/./Include -IInclude/
> -I/usr/local/include -c /5/tmp/py/Python-2.1a1/Modules/structmodule.c -o
> build/temp.qnx-J-PCI-2.1/structmodule.o
>     creating build/lib.qnx-J-PCI-2.1
>     ld build/temp.qnx-J-PCI-2.1/structmodule.o -L/usr/local/lib -o
> build/lib.qnx-J-PCI-2.1/struct.so
>     error: command 'ld' failed with exit status 1
>     make: *** [sharedmods] Error 1
> 
> QNX doesn't have an 'ld' command. Is configure not getting its info to
> setup.py? (Is it supposed to?)
> 
> What should I check? I have logs of each of the configure & make runs.
> Should I submit this as a bug on SourceForge?
> 
> Hope to hear from somebody soon.

This is probably in the realm of the distutils.  I have no idea how to
teach it to build on QNX, sorry!

--Guido van Rossum (home page: http://www.python.org/~guido/)