[Python-bugs-list] [ python-Bugs-626926 ] Build error using make VPATH feature

SourceForge.net noreply@sourceforge.net
Mon, 05 May 2003 10:52:45 -0700


Bugs item #626926, was opened at 2002-10-22 11:36
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=626926&group_id=5470

Category: Build
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Davide Di Blasi (davidedb)
Assigned to: Nobody/Anonymous (nobody)
Summary: Build error using make VPATH feature

Initial Comment:
PROBLEM DESCRIPTION
=====================

After building successfully Python 2.2.2 from scratch
on Solaris 8 using the usual commands (cd
~wrk/Python-2.2.2; ./configure; make), I decided to
build it for multiple architectures (SunOS 5.6, 5.7 and
5.8), exploiting the supported VPATH feature of GNU make.

Here are the commands I run for Solaris 6:

1. mkdir ~/wrk/Python-2.2.2/binaries/SunOS_5.6
2. cd ~/wrk/Python-2.2.2/binaries/SunOS_5.6
3. ../../configure -prefix=/usr/local/python
4. make

Unfortunately the last command failed with the
following error:...
ranlib libpython2.2.a
gcc  -Xlinker --export-dynamic -o python \
		Modules/python.o \
		libpython2.2.a -lsocket -lnsl -ldl  -lpthread -lthread  
-lm  
case $MAKEFLAGS in \
*-s*) CC='gcc' LDSHARED='gcc -shared' OPT='-DNDEBUG -g
-O3 -Wall -Wstrict-prototypes' ./python -E
../../setup.py -q build;; \
*) CC='gcc' LDSHARED='gcc -shared' OPT='-DNDEBUG -g -O3
-Wall -Wstrict-prototypes' ./python -E ../../setup.py
build;; \
esac
running build
running build_ext
Traceback (most recent call last):
  File "../../setup.py", line 795, in ?
    main()
  File "../../setup.py", line 790, in main
    scripts = ['Tools/scripts/pydoc']
  File "~wrk/Python-2.2.2/Lib/distutils/core.py", line
138, in setup
    dist.run_commands()
  File "~wrk/Python-2.2.2/Lib/distutils/dist.py", line
893, in run_commands
    self.run_command(cmd)
  File "~wrk/Python-2.2.2/Lib/distutils/dist.py", line
913, in run_command
    cmd_obj.run()
  File
"~wrk/Python-2.2.2/Lib/distutils/command/build.py",
line 107, in run
    self.run_command(cmd_name)
  File "~wrk/Python-2.2.2/Lib/distutils/cmd.py", line
330, in run_command
    self.distribution.run_command(command)
  File "~wrk/Python-2.2.2/Lib/distutils/dist.py", line
913, in run_command
    cmd_obj.run()
  File
"~wrk/Python-2.2.2/Lib/distutils/command/build_ext.py",
line 231, in run
    customize_compiler(self.compiler)
  File "~wrk/Python-2.2.2/Lib/distutils/sysconfig.py",
line 139, in customize_compiler
    (cc, opt, ccshared, ldshared, so_ext) = \
  File "~wrk/Python-2.2.2/Lib/distutils/sysconfig.py",
line 421, in get_config_vars
    func()
  File "~wrk/Python-2.2.2/Lib/distutils/sysconfig.py",
line 326, in _init_posix
    raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: invalid Python
installation: unable to open
/usr/local/python/lib/python2.2/config/Makefile (No
such file or directory)
make: *** [sharedmods] Error 1

PROBLEM ANALYSIS==================
By looking the code inside sysconfig.py module, it is
clear that the problem is generated by the first IF
clause (starting at line 32), where the python_build
variable is set: the path obtained by joining "Lib" to
the argv0_path variable does not exist, since no
directory named Lib exists in the (current) work
directory. In fact the only existing directories  are:
 - Grammar
 - Modules
 - Objects
 - Parser
 - Python
 - build


WORKAROUND
=============
Simply create a link to the Lib directory provided with
Python 2.2.2, i.e. in my example:

ln -s ../../Lib
make
make test
make install


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-05-05 13:52

Message:
Logged In: YES 
user_id=6380

Could you find details about the fix? I still get failures
when I build Python outside the src directory when there's
no Python installation in /usr/local/.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2003-05-05 13:49

Message:
Logged In: YES 
user_id=6656

I think I may have fixed this in CVS some time ago... (on
the release22-maint branch).

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-05-05 13:44

Message:
Logged In: YES 
user_id=6380

Tres's patch may work, but I think creating a symlink in the
build directory named "Lib" pointing to the source Lib
directory just masks the real problem. What is the real problem?


----------------------------------------------------------------------

Comment By: Tres Seaver (tseaver)
Date: 2003-05-05 11:17

Message:
Logged In: YES 
user_id=127625

The following patch works for me (derived from davideb's work):

--- Tools/Python2/configure.in:1.1.1.2  Fri May  2 08:36:31 2003
+++ Tools/Python2/configure.in  Mon May  5 10:56:17 2003
@@ -2116,6 +2116,12 @@
 done
 AC_MSG_RESULT(done)
 
+AC_MSG_CHECKING(for Lib directory)
+if test ! -d Lib; then
+    ln -s $srcdir/Lib
+fi
+AC_MSG_RESULT(done)
+
 # generate output files
 AC_OUTPUT(Makefile.pre Modules/Setup.config)
 


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-10-28 05:39

Message:
Logged In: YES 
user_id=21627

Eventually, your change has to end up in Makefile, right? So
I would suggest you start from there: Have configure
generate a Makefile, and modify the Makefile so that it
suits your needs. If you then don't know how to proceed,
please attach both Makefile (the original and the modified
one) to this report, and we'll see how to proceed.

Most likely, for your change to show up in Makefile, it
would have to appear in Makefile.pre, with likely no changes
to configure.in/configure. Makefile.pre, in turn, is
generated from Makefile.pre.in, so that your change most
likely needs to appear in Makefile.pre.in.

----------------------------------------------------------------------

Comment By: Davide Di Blasi (davidedb)
Date: 2002-10-28 05:16

Message:
Logged In: YES 
user_id=633937

I'd like to help, but unfortunately I do not know the
autoconf configuration file syntax (i.e. configure.in),
where - I guess - the problem has to be solved.
Yet, by looking at the provided configure script, I added
the following lines (starting at line #7600):

---------------------
echo $ac_n "checking for Lib directory""... $ac_c" 1>&6    
                                                           
                  echo "configure: checking for Lib
directory" >&5                                             
                                            if test ! -d
Lib; then                                                  
                                                           
           ln -s $srcdir/Lib                               
                                                           
                         fi                                
                                                           
                                           echo
"$ac_t""done" 1>&6                                         
                                                           
             
---------------------

This works fine when using the VPATH feature as well as when
building directly in the standard source directory.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-10-22 13:04

Message:
Logged In: YES 
user_id=21627

Would you like to work on a patch that fixes this problem?
The patch should support both the case of in-place building,
and VPATH building.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=626926&group_id=5470