Bug 17383 - [4.0 Regression] Building in src dir fails
Summary: [4.0 Regression] Building in src dir fails
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.4
Assignee: DJ Delorie
URL:
Keywords: build
: 18290 20500 21158 21176 21186 21187 21431 22193 (view as bug list)
Depends on:
Blocks: 19420
  Show dependency treegraph
 
Reported: 2004-09-09 18:30 UTC by johan carlsson
Modified: 2006-07-23 20:30 UTC (History)
8 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-27 00:25:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description johan carlsson 2004-09-09 18:30:50 UTC
I checked out the CVS main branch today.

cd gcc && ./configure && make fails with the error message:
./config.status: line 909: ./../../config-ml.in: No such file or directory
make: *** [configure-zlib] Error 1

cd gcc && mkdir builddir && cd builddir && ../configure && make works just fine.
Comment 1 Andrew Pinski 2004-09-09 18:34:51 UTC
Really nobody builds inside the source directory.
Comment 2 johan carlsson 2004-09-09 19:53:05 UTC
(In reply to comment #1)
> Really nobody builds inside the source directory.

Great answer! Is there ANY bug where this doesn't apply?

"Yawn, nobody does that anyway, go away".

I think a better solution would be if the configure script printed an
appropriate error message and then died.
Comment 3 Andrew Pinski 2004-09-09 20:32:14 UTC
no, what I meant is that nobody usually does it that way but we do support it and try to fix all the 
problems with it.  And it is documented the recommended way to build in seperate directory so ...
Comment 4 Andrew Pinski 2004-09-15 03:46:12 UTC
touch stamp-picdir
make[1]: *** No rule to make target `../include/ansidecl.h', needed by `regex.o'.  Stop.
make: *** [all-build-libiberty] Error 2

Confirmed.
Comment 5 Andrew Pinski 2004-10-12 11:44:46 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00968.html>.
Comment 6 Andrew Pinski 2004-11-03 21:08:08 UTC
*** Bug 18290 has been marked as a duplicate of this bug. ***
Comment 7 Thomas Koenig 2004-11-05 21:01:17 UTC
(In reply to comment #1)
> Really nobody builds inside the source directory.

How does one actually build the compiler, then?  gcc/doc/install.texi simply says

# @section Building a native compiler
#
# For a native build issue the command @samp{make bootstrap}

which fails (as shown in this bug).  INSTALL/README tells me the directory has
been obsoleted, and README points me to the doc directory (where I can't find
anything else relevant, but maybe that's just me).
Comment 8 Andrew Pinski 2004-11-05 21:04:59 UTC
Read: <http://gcc.gnu.org/install/configure.html> for how people actually install/build GCC.
Comment 9 Alexandre Oliva 2004-12-23 21:03:02 UTC
Paolo's patch looks good to me.  Paolo, would you please check it in?
Comment 10 paolo.bonzini@lu.unisi.ch 2004-12-26 11:00:27 UTC
Subject: Re:  [4.0 Regression] Building in src dir fails

aoliva at gcc dot gnu dot org wrote:
> ------- Additional Comments From aoliva at gcc dot gnu dot org  2004-12-23 21:03 -------
> Paolo's patch looks good to me.  Paolo, would you please check it in?

Yes; will you please take a look at the comment at 
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01079.html ?

Thanks,

Paolo
Comment 11 GCC Commits 2004-12-28 17:40:56 UTC
Subject: Bug 17383

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2004-12-28 17:40:41

Modified files:
	.              : ChangeLog Makefile.def Makefile.in Makefile.tpl 

Log message:
	2004-12-28  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	
	* Makefile.def (target_modules): Remove stage parameter,
	it is always true now.
	* Makefile.tpl (configure-build-[+module+],
	configure-target-[+module+]): Always build symlink tree
	for the directory and for include.  BUILD_SUBDIR and
	TARGET_SUBDIR cannot be . anymore.
	* Makefile.in: Regenerate.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.1040&r2=1.1041
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.def.diff?cvsroot=gcc&r1=1.43&r2=1.44
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.251&r2=1.252
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.tpl.diff?cvsroot=gcc&r1=1.121&r2=1.122

Comment 12 Paolo Bonzini 2004-12-28 17:42:37 UTC
Patch applied.
Comment 13 Paolo Bonzini 2004-12-30 10:39:06 UTC
Nope, my patch is not sufficient.  I am testing a better fix, but I fear it is
too invasive for 4.0.  It is a variant of the often-proposed "build out of
srcdir without telling the user" trick.
Comment 14 Nathanael C. Nerode 2005-02-08 18:53:16 UTC
I have considered doing this in the truly parallel way: namely, introducing 
HOST_SUBDIR to go along with BUILD_SUBDIR and TARGET_SUBDIR. 
 
It requires mangling of '..'s in many subdirectories, which is why I haven't 
done it.  But if it's done it allows some genuine, major simplifications. 
Comment 15 paolo.bonzini@lu.unisi.ch 2005-02-09 12:30:53 UTC
Subject: Re:  [4.0 Regression] Building in src dir fails

> I have considered doing this in the truly parallel way: namely, introducing 
> HOST_SUBDIR to go along with BUILD_SUBDIR and TARGET_SUBDIR. 

I already have a patch for this queued for 4.1 and posted to 
gcc-patches.  DJ however has a hackish fix that will go in once 4.0 
branches.

Paolo
Comment 16 GCC Commits 2005-02-28 13:27:01 UTC
Subject: Bug 17383

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2005-02-28 13:26:36

Modified files:
	.              : Makefile.def Makefile.in Makefile.tpl configure 
	                 configure.in ChangeLog 
	gcc            : ChangeLog Makefile.in configure 
	config         : ChangeLog acx.m4 
	libjava        : ChangeLog Makefile.in configure configure.ac 
	libjava/external: Makefile.in 
	libjava/external/sax: Makefile.in 
	libjava/external/w3c_dom: Makefile.in 
	libjava/gcj    : Makefile.in 
	libjava/include: Makefile.in 
	libjava/testsuite: Makefile.in 
	libada         : ChangeLog Makefile.in 
	libobjc        : ChangeLog Makefile.in configure configure.ac 

Log message:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* Makefile.def (target_modules): Remove "stage", now unnecessary.
	* Makefile.tpl (HOST_SUBDIR): New substitution.
	(STAGE_HOST_EXPORTS, EXPECT, HOST_LIB_PATH, USUAL_AR_FOR_TARGET,
	USUAL_AS_FOR_TARGET, USUAL_DLLTOOL_FOR_TARGET, USUAL_GCC_FOR_TARGET,
	USUAL_LD_FOR_TARGET, USUAL_NM_FOR_TARGET, USUAL_OBJDUMP_FOR_TARGET,
	USUAL_RANLIB_FOR_TARGET, USUAL_WINDRES_FOR_TARGET): Use it.
	(Host modules, Bootstrapped modules): Use it.
	(Build modules, Target modules): Do not create symlink trees,
	always configure out-of-srcdir.
	(distclean): Try removing $(host_subdir) with rm before using rm -rf.
	* configure.in (FLAGS_FOR_TARGET, CC_FOR_TARGET, GCJ_FOR_TARGET,
	GFORTRAN_FOR_TARGET, CXX_FOR_TARGET, RAW_CXX_FOR_TARGET): Use
	$(HOST_SUBDIR).  Create a symlink for host_subdir.
	
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	
	config:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* config/acx.m4 (GCC_TOPLEV_SUBDIRS): Set HOST_SUBDIR if an in-src
	gcc build is going.
	
	gcc:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* gcc/Makefile.in (host_subdir): New.
	(build_objdir): New.  Replace ../$(build_subdir) with it throughout.
	* gcc/configure: Regenerate.
	
	libada:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* Makefile.in (GCC_DIR): Add $(HOST_SUBDIR) to the definition.
	
	libjava:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* configure.ac: Call GCC_TOPLEV_SUBDIRS.
	(COMPPATH): Removed.
	(ZIP, GCJH): Replace it with ../$(host_subdir).
	(built_gcc_dir): Add $(host_subdir).
	* configure: Regenerate.
	* Makefile.in, include/Makefile.in, testsuite/Makefile.in,
	gcj/Makefile.in, external/Makefile.in, external/sax/Makefile.in,
	external/w3c_dom/Makefile.in: Regenerate.
	
	libobjc:
	2005-05-25  Paolo Bonzini  <bonzini@gnu.org>
	
	PR bootstrap/17383
	* configure.ac: Call GCC_TOPLEV_SUBDIRS.
	(Determine CFLAGS for gthread): Use $host_subdir.
	* configure: Regenerate.
	* Makefile.in (host_subdir): New.
	(INCLUDES): Use it.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.def.diff?cvsroot=gcc&r1=1.47&r2=1.48
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.255&r2=1.256
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.tpl.diff?cvsroot=gcc&r1=1.124&r2=1.125
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.diff?cvsroot=gcc&r1=1.205&r2=1.206
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.in.diff?cvsroot=gcc&r1=1.342&r2=1.343
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.1058&r2=1.1059
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7608&r2=2.7609
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.1448&r2=1.1449
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.diff?cvsroot=gcc&r1=1.886&r2=1.887
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/config/ChangeLog.diff?cvsroot=gcc&r1=1.59&r2=1.60
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/config/acx.m4.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3391&r2=1.3392
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.in.diff?cvsroot=gcc&r1=1.485&r2=1.486
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.diff?cvsroot=gcc&r1=1.253&r2=1.254
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.ac.diff?cvsroot=gcc&r1=1.19&r2=1.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/Makefile.in.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/sax/Makefile.in.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/w3c_dom/Makefile.in.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gcj/Makefile.in.diff?cvsroot=gcc&r1=1.62&r2=1.63
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/Makefile.in.diff?cvsroot=gcc&r1=1.64&r2=1.65
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/Makefile.in.diff?cvsroot=gcc&r1=1.73&r2=1.74
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libada/ChangeLog.diff?cvsroot=gcc&r1=1.13&r2=1.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libada/Makefile.in.diff?cvsroot=gcc&r1=1.9&r2=1.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libobjc/ChangeLog.diff?cvsroot=gcc&r1=1.157&r2=1.158
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libobjc/Makefile.in.diff?cvsroot=gcc&r1=1.44&r2=1.45
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libobjc/configure.diff?cvsroot=gcc&r1=1.56&r2=1.57
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libobjc/configure.ac.diff?cvsroot=gcc&r1=1.12&r2=1.13

Comment 17 Paolo Bonzini 2005-02-28 13:30:06 UTC
Fixed on mainline.  As I said in comment #15, DJ has patches for the 4.0 branch,
so I am assigning it to him.
Comment 18 Andrew Pinski 2005-03-16 17:59:16 UTC
*** Bug 20500 has been marked as a duplicate of this bug. ***
Comment 19 Giovanni Bajo 2005-03-17 00:21:39 UTC
DJ, any update on fixing this on the 4.0 branch?
Comment 20 Andrew Pinski 2005-04-22 11:04:14 UTC
*** Bug 21158 has been marked as a duplicate of this bug. ***
Comment 21 Andrew Pinski 2005-04-23 23:43:10 UTC
*** Bug 21176 has been marked as a duplicate of this bug. ***
Comment 22 Andrew Pinski 2005-04-24 04:57:51 UTC
*** Bug 21186 has been marked as a duplicate of this bug. ***
Comment 23 Andrew Pinski 2005-04-24 04:58:03 UTC
*** Bug 21187 has been marked as a duplicate of this bug. ***
Comment 24 Andrew Pinski 2005-05-07 06:43:12 UTC
*** Bug 21431 has been marked as a duplicate of this bug. ***
Comment 25 GRONDIN 2005-06-06 19:35:07 UTC
I'm used ./configure --prefix=/usr

I've the make error :
(...)
updating cache ./config.cache
configure: creating ./config.status
config.status: creating Makefile
config.status: executing default-1 commands
./config.status: line 910: ./../../config-ml.in: No such file or directory
make: *** [configure-zlib] Erreur 1


Comment 26 GCC Commits 2005-06-22 20:49:05 UTC
Subject: Bug 17383

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	echristo@gcc.gnu.org	2005-06-22 20:42:06

Modified files:
	.              : ChangeLog configure.in configure 

Log message:
	2005-06-22  Eric Christopher  <echristo@redhat.com>
	
	PR bootstrap/17383
	* configure.in: Reject building in the source directory.
	* configure: Regenerate.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1057.2.15&r2=1.1057.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.341.2.4&r2=1.341.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.204.2.5&r2=1.204.2.6

Comment 27 Andrew Pinski 2005-06-26 17:51:26 UTC
*** Bug 22193 has been marked as a duplicate of this bug. ***
Comment 28 Eric Christopher 2006-07-23 20:30:15 UTC
We're not going to support building 4.0 in the source directory. Closing.