Bug 55961 - [4.8 Regression] system.h includes gmp.h but system.h is included for build and not just target
Summary: [4.8 Regression] system.h includes gmp.h but system.h is included for build a...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.8.0
: P1 blocker
Target Milestone: 4.8.0
Assignee: Richard Biener
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2013-01-13 13:20 UTC by Denis Onischenko
Modified: 2013-01-15 15:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-01-13 00:00:00


Attachments
output (20.35 KB, application/octet-stream)
2013-01-13 13:20 UTC, Denis Onischenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Onischenko 2013-01-13 13:20:58 UTC
Created attachment 29155 [details]
output

gcc/system.h:639:17: fatal error: gmp.h: No such file or directory 
when building ARM native compiler by cross-compiler
trunc revision 195120
Comment 1 Andrew Pinski 2013-01-13 18:56:30 UTC
Basically a candian cross will fail if you don't have gmp.h installed on the build machine.
system.h includes gmp.h but system.h is included for build and not just target
Comment 2 Richard Biener 2013-01-14 13:16:40 UTC
Btw, previously we'd have #ifndef GENERATOR_FILE around gmp.h includes.  I
didn't see the point of this, but if it's not really required there we
can re-instantiate it.  Not sure if it's a good idea to change effective
system.h behavior though - system.h is included in configure tests.  I
doubt we "properly" separate tests for build vs. host.  Do we?
Comment 3 jsm-csl@polyomino.org.uk 2013-01-14 16:05:48 UTC
We run configure for the build system in a subdirectory, when build != 
host.

# auto-host.h is the file containing items generated by autoconf and is
# the first file included by config.h.
# If host=build, it is correct to have bconfig include auto-host.h
# as well.  If host!=build, we are in error and need to do more 
# work to find out the build config parameters.
if test x$host = x$build
then
        build_auto=auto-host.h
else
        # We create a subdir, then run autoconf in the subdir.
        # To prevent recursion we set host and build for the new
        # invocation of configure to the build for this invocation
        # of configure. 
[...]
Comment 4 Richard Biener 2013-01-15 13:05:23 UTC
Index: gcc/system.h
===================================================================
--- gcc/system.h        (revision 195194)
+++ gcc/system.h        (working copy)
@@ -636,7 +636,10 @@ extern int vsnprintf(char *, size_t, con
 #include <dlfcn.h>
 #endif
 
+/* Do not introduce a gmp.h dependency on the build system.  */
+#ifndef GENERATOR_FILE
 #include <gmp.h>
+#endif
 
 /* Get libiberty declarations.  */
 #include "libiberty.h"

should restore previous behavior.  I'm not sure if any configure check
for the build system includes system.h and does _not_ define GENERATOR_FILE.
So, does the build configury define GENERATOR_FILE?
Comment 5 Richard Biener 2013-01-15 15:54:10 UTC
Author: rguenth
Date: Tue Jan 15 15:54:05 2013
New Revision: 195205

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195205
Log:
2013-01-15  Richard Biener  <rguenther@suse.de>

	PR bootstrap/55961
	* system.h: Do not include gmp.h for building host tools.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/system.h
Comment 6 Richard Biener 2013-01-15 15:54:38 UTC
Fixed.