This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Build error using make VPATH feature
Type: Stage:
Components: Build Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: davidedb, gvanrossum, loewis, mwh, tseaver
Priority: normal Keywords:

Created on 2002-10-22 15:36 by davidedb, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (10)
msg12903 - (view) Author: Davide Di Blasi (davidedb) Date: 2002-10-22 15:36
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.Lib/distutils/core.py", line
138, in setup
    dist.run_commands()
  File "~wrk/Python-2.Lib/distutils/dist.py", line
893, in run_commands
    self.run_command(cmd)
  File "~wrk/Python-2.Lib/distutils/dist.py", line
913, in run_command
    cmd_obj.run()
  File
"~wrk/Python-2.Lib/distutils/command/build.py",
line 107, in run
    self.run_command(cmd_name)
  File "~wrk/Python-2.Lib/distutils/cmd.py", line
330, in run_command
    self.distribution.run_command(command)
  File "~wrk/Python-2.Lib/distutils/dist.py", line
913, in run_command
    cmd_obj.run()
  File
"~wrk/Python-2.Lib/distutils/command/build_ext.py",
line 231, in run
    customize_compiler(self.compiler)
  File "~wrk/Python-2.Lib/distutils/sysconfig.py",
line 139, in customize_compiler
    (cc, opt, ccshared, ldshared, so_ext) = \
  File "~wrk/Python-2.Lib/distutils/sysconfig.py",
line 421, in get_config_vars
    func()
  File "~wrk/Python-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
msg12904 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-22 17:04
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.
msg12905 - (view) Author: Davide Di Blasi (davidedb) Date: 2002-10-28 10:16
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.
msg12906 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-28 10:39
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.
msg12907 - (view) Author: Tres Seaver (tseaver) * Date: 2003-05-05 15:17
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)
 
msg12908 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-05-05 17:44
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?
msg12909 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-05-05 17:49
Logged In: YES 
user_id=6656

I think I may have fixed this in CVS some time ago... (on
the release22-maint branch).
msg12910 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-05-05 17:52
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/.
msg12911 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-05-05 18:12
Logged In: YES 
user_id=6656

Well, it works for me.

I can't tell you what revision of sysconfig.py I made my fix
in, because CVS has just stopped working :-(  It was shortly
after 222 went out.
msg12912 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-05-16 02:04
Logged In: YES 
user_id=6380

I've been told that this has been fixed in distutils for
2.2.3 and 2.3, so I'll close this now.
History
Date User Action Args
2022-04-10 16:05:46adminsetgithub: 37357
2002-10-22 15:36:54davidedbcreate